[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69079: [PATCH] Add 'customize-toggle-option' command
From: |
Eli Zaretskii |
Subject: |
bug#69079: [PATCH] Add 'customize-toggle-option' command |
Date: |
Mon, 12 Feb 2024 19:47:57 +0200 |
> From: Philip Kaludercic <philipk@posteo.net>
> Date: Mon, 12 Feb 2024 17:32:37 +0000
>
> +;;;###autoload
> +(defun customize-toggle-option (opt)
> + "Toggle the value of boolean option OPT for this session."
> + (interactive (let (opts)
> + (mapatoms
> + (lambda (sym)
> + (when (eq (get sym 'custom-type) 'boolean)
> + (push sym opts))))
> + (list (intern (completing-read "Option: " opts)))))
> + (message "%s user options '%s'."
> + (if (funcall (or (get opt 'custom-set) #'set-default)
> + opt (not (funcall (or (get opt 'custom-get)
> + #'symbol-value)
> + opt)))
> + "Enabled" "Disabled")
> + opt))
Shouldn't this have some validation? what if the argument OPT is not a
boolean?
And the prompt should IMO say "Toggle boolean option: ".
- bug#69079: [PATCH] Add 'customize-toggle-option' command, Philip Kaludercic, 2024/02/12
- bug#69079: [PATCH] Add 'customize-toggle-option' command,
Eli Zaretskii <=
- bug#69079: [PATCH] Add 'customize-toggle-option' command, Drew Adams, 2024/02/12
- bug#69079: [PATCH] Add 'customize-toggle-option' command, Philip Kaludercic, 2024/02/12
- bug#69079: [PATCH] Add 'customize-toggle-option' command, Eli Zaretskii, 2024/02/12
- bug#69079: [PATCH] Add 'customize-toggle-option' command, Philip Kaludercic, 2024/02/12
- bug#69079: [PATCH] Add 'customize-toggle-option' command, Eli Zaretskii, 2024/02/13
- bug#69079: [PATCH] Add 'customize-toggle-option' command, Eshel Yaron, 2024/02/13
- bug#69079: [PATCH] Add 'customize-toggle-option' command, Philip Kaludercic, 2024/02/13