unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12670: 24.2.50; Uncustomizable defcustom
@ 2012-10-18  9:33 Katsumi Yamaoka
  2012-12-22  1:41 ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Katsumi Yamaoka @ 2012-10-18  9:33 UTC (permalink / raw)
  To: 12670

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

Hi,

I realized that a certain defcustom form is unable to customize
a user option.  To reproduce this, evaluate the following form,
perform M-x customize-option, and press the [INS] button.

(defcustom foo nil
  "Doc"
  :type '(repeat (group (group :inline t (choice string function)))))

Then you will find a funny thing there and see it is unable to
edit.  After some investigations I found this is due to
`widget-default-get', that fails to get the default value of
components within an inlined form (I mean (bar :inline t ...)).

A patch is attached, not tested with all sorts of defcustom
forms though.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: DIFF --]
[-- Type: text/x-patch, Size: 792 bytes --]

--- wid-edit.el~	2012-04-22 21:52:01.618551000 +0000
+++ wid-edit.el	2012-10-18 09:27:17.158803700 +0000
@@ -525,9 +525,18 @@
 (defun widget-default-get (widget)
   "Extract the default external value of WIDGET."
   (widget-apply widget :value-to-external
 		(or (widget-get widget :value)
-		    (widget-apply widget :default-get))))
+		    (progn
+		      (when (widget-get widget :args)
+			(let (args)
+			  (dolist (arg (widget-get widget :args))
+			    (setq args (append args
+					       (if (widget-get arg :inline)
+						   (widget-get arg :args)
+						 (list arg)))))
+			  (widget-put widget :args args)))
+		      (widget-apply widget :default-get)))))
 
 (defun widget-match-inline (widget vals)
   "In WIDGET, match the start of VALS."
   (cond ((widget-get widget :inline)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12670: 24.2.50; Uncustomizable defcustom
  2012-10-18  9:33 bug#12670: 24.2.50; Uncustomizable defcustom Katsumi Yamaoka
@ 2012-12-22  1:41 ` Chong Yidong
  2012-12-22 13:35   ` Katsumi Yamaoka
  0 siblings, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2012-12-22  1:41 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 12670

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> evaluate the following form, perform M-x customize-option, and press
> the [INS] button.
>
> (defcustom foo nil
>   "Doc"
>   :type '(repeat (group (group :inline t (choice string function)))))
>
> Then you will find a funny thing there and see it is unable to
> edit.

I can't reproduce this on Emacs 23.4, the emacs-24 branch, or trunk.
After opening the customization buffer for `foo', I click on INS and it
opens up

INS DEL Choice: Value Menu invalid (nil)

and clicking on "Value Menu" allows me to insert a function or string.







^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12670: 24.2.50; Uncustomizable defcustom
  2012-12-22  1:41 ` Chong Yidong
@ 2012-12-22 13:35   ` Katsumi Yamaoka
  2013-01-06  3:37     ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Katsumi Yamaoka @ 2012-12-22 13:35 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 12670

Chong Yidong <cyd@gnu.org> wrote:
> Katsumi Yamaoka <yamaoka@jpl.org> writes:

>> evaluate the following form, perform M-x customize-option, and press
>> the [INS] button.

>> (defcustom foo nil
>>   "Doc"
>>   :type '(repeat (group (group :inline t (choice string function)))))

>> Then you will find a funny thing there and see it is unable to
>> edit.

> I can't reproduce this on Emacs 23.4, the emacs-24 branch, or trunk.
> After opening the customization buffer for `foo', I click on INS and it
> opens up

> INS DEL Choice: Value Menu invalid (nil)

> and clicking on "Value Menu" allows me to insert a function or string.

Oops, you're right.  I don't recall why I said it's uncustomisable,
but please let me rephrase it:
That defcustom form is unable to suggest a default value, that's
the one suitable to beginners for example, to a user.  Could you
try the following two examples?  Both behaviors should be the same.
And my patch solves it.

(defcustom foo1 nil
  "Doc"
  :type '(repeat (group (group :inline t
			       (choice (string :value "foo")
				       function)))))
(defcustom foo2 nil
  "Doc"
  :type '(repeat (group (choice (string :value "foo")
				function))))





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12670: 24.2.50; Uncustomizable defcustom
  2012-12-22 13:35   ` Katsumi Yamaoka
@ 2013-01-06  3:37     ` Chong Yidong
  2013-01-07 11:25       ` Katsumi Yamaoka
  0 siblings, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2013-01-06  3:37 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 12670

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> Oops, you're right.  I don't recall why I said it's uncustomisable,
> but please let me rephrase it:
> That defcustom form is unable to suggest a default value, that's
> the one suitable to beginners for example, to a user.  Could you
> try the following two examples?  Both behaviors should be the same.
> And my patch solves it.

Ah, OK.  Looks fine to me, please go ahead and commit to trunk.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12670: 24.2.50; Uncustomizable defcustom
  2013-01-06  3:37     ` Chong Yidong
@ 2013-01-07 11:25       ` Katsumi Yamaoka
  0 siblings, 0 replies; 5+ messages in thread
From: Katsumi Yamaoka @ 2013-01-07 11:25 UTC (permalink / raw)
  To: 12670-done; +Cc: cyd

Chong Yidong wrote:
> Ah, OK.  Looks fine to me, please go ahead and commit to trunk.

Thanks.  Done.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-07 11:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-18  9:33 bug#12670: 24.2.50; Uncustomizable defcustom Katsumi Yamaoka
2012-12-22  1:41 ` Chong Yidong
2012-12-22 13:35   ` Katsumi Yamaoka
2013-01-06  3:37     ` Chong Yidong
2013-01-07 11:25       ` Katsumi Yamaoka

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).