GNU bug report logs - #69079
[PATCH] Add 'customize-toggle-option' command

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Mon, 12 Feb 2024 17:34:01 UTC

Severity: normal

Tags: patch

Done: Philip Kaludercic <philipk <at> posteo.net>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 69079 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: 69079 <at> debbugs.gnu.org
Subject: Re: bug#69079: [PATCH] Add 'customize-toggle-option' command
Date: Mon, 12 Feb 2024 19:47:57 +0200
> From: Philip Kaludercic <philipk <at> 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: ".




This bug report was last modified 1 year and 154 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.