unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Jens.Schmidt27@epost.de: Customize creating wrong defaults]
       [not found] ` <rj3crqzc96.fsf@zuse.dina.kvl.dk>
@ 2002-10-02  4:07   ` Richard Stallman
  2002-10-02 13:26     ` Per Abrahamsen
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2002-10-02  4:07 UTC (permalink / raw)
  Cc: emacs-devel, Jens.Schmidt27

Thanks for analyzing the situation.

    This is a very common error, perhaps the most common error when
    creating customize types.  It really should be explained better in the
    manual.  Anyone have a suggestion of where and how?

How about this?  Do it in the node Composite Types, in
lispref/customize.texi, and do it by (1) adding a subnode to explain
the problem and give an examplem and (2) adding a brief note and xref
to that subnode in the vairous table entries for the composite types
for which this is necessary.

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

* Re: [Jens.Schmidt27@epost.de: Customize creating wrong defaults]
  2002-10-02  4:07   ` [Jens.Schmidt27@epost.de: Customize creating wrong defaults] Richard Stallman
@ 2002-10-02 13:26     ` Per Abrahamsen
  2002-10-03  0:32       ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Per Abrahamsen @ 2002-10-02 13:26 UTC (permalink / raw)
  Cc: emacs-devel, Jens.Schmidt27

Richard Stallman <rms@gnu.org> writes:

> How about this?  Do it in the node Composite Types, in
> lispref/customize.texi, and do it by (1) adding a subnode to explain
> the problem and give an examplem and (2) adding a brief note and xref
> to that subnode in the vairous table entries for the composite types
> for which this is necessary.

Actually, testing it I found that customize got a good default value
in more cases than I had expected, and a rather simple fix seems to
get the rest of the cases right too.  So let's fix the code instead of
the documentation.

2002-10-02  Per Abrahamsen  <abraham@dina.kvl.dk>

	* wid-edit.el (widget-default-get): Change to return external
	value. 
	(widget-choice-action): Update caller.
	(widget-editable-list-entry-create): Update caller.

cd /home/user_2/abraham/ftp/emacs/lisp/
diff -c wid-edit.el_ORIG wid-edit.el
*** wid-edit.el_ORIG	Wed Oct  2 15:13:47 2002
--- wid-edit.el	Wed Oct  2 15:18:20 2002
***************
*** 508,516 ****
  					 :value-to-internal value)))
  
  (defun widget-default-get (widget)
!   "Extract the default value of WIDGET."
!   (or (widget-get widget :value)
!       (widget-apply widget :default-get)))
  
  (defun widget-match-inline (widget vals)
    "In WIDGET, match the start of VALS."
--- 508,517 ----
  					 :value-to-internal value)))
  
  (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))))
  
  (defun widget-match-inline (widget vals)
    "In WIDGET, match the start of VALS."
***************
*** 1993,2001 ****
        (when this-explicit
  	(widget-put widget :explicit-choice current)
  	(widget-put widget :explicit-choice-value (widget-get widget :value)))
!       (widget-value-set
!        widget (widget-apply current
! 			    :value-to-external (widget-default-get current)))
        (widget-setup)
        (widget-apply widget :notify widget event)))
    (run-hook-with-args 'widget-edit-functions widget))
--- 1994,2000 ----
        (when this-explicit
  	(widget-put widget :explicit-choice current)
  	(widget-put widget :explicit-choice-value (widget-get widget :value)))
!       (widget-value-set widget (widget-default-get current))
        (widget-setup)
        (widget-apply widget :notify widget event)))
    (run-hook-with-args 'widget-edit-functions widget))
***************
*** 2621,2629 ****
  		    (setq child (widget-create-child-value
  				 widget type value))
  		  (setq child (widget-create-child-value
! 			       widget type
! 			       (widget-apply type :value-to-external
! 					     (widget-default-get type))))))
  	       (t
  		(error "Unknown escape `%c'" escape)))))
       (widget-put widget
--- 2620,2626 ----
  		    (setq child (widget-create-child-value
  				 widget type value))
  		  (setq child (widget-create-child-value
! 			       widget type (widget-default-get type)))))
  	       (t
  		(error "Unknown escape `%c'" escape)))))
       (widget-put widget

Compilation exited abnormally with code 1 at Wed Oct  2 15:20:07

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

* Re: [Jens.Schmidt27@epost.de: Customize creating wrong defaults]
  2002-10-02 13:26     ` Per Abrahamsen
@ 2002-10-03  0:32       ` Richard Stallman
  2002-10-03 13:47         ` Per Abrahamsen
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2002-10-03  0:32 UTC (permalink / raw)
  Cc: emacs-devel, Jens.Schmidt27

    Actually, testing it I found that customize got a good default value
    in more cases than I had expected, and a rather simple fix seems to
    get the rest of the cases right too.  So let's fix the code instead of
    the documentation.

Good news.  Will you go ahead and install that?

Is the :value option still useful, or should we dedocument it?

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

* Re: [Jens.Schmidt27@epost.de: Customize creating wrong defaults]
  2002-10-03  0:32       ` Richard Stallman
@ 2002-10-03 13:47         ` Per Abrahamsen
  2002-10-04  3:48           ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Per Abrahamsen @ 2002-10-03 13:47 UTC (permalink / raw)
  Cc: emacs-devel, Jens.Schmidt27

Richard Stallman <rms@gnu.org> writes:

>     Actually, testing it I found that customize got a good default value
>     in more cases than I had expected, and a rather simple fix seems to
>     get the rest of the cases right too.  So let's fix the code instead of
>     the documentation.
>
> Good news.  Will you go ahead and install that?

I have committed it to CVS.   I committed the other patch as well, it
is a lot less dangerous.

2002-10-02  Per Abrahamsen  <abraham@dina.kvl.dk>

	* wid-edit.el (widget-types-copy): New function.
	(default): Added :copy keyword.
	(menu-choice): Ditto.
	(checklist): Ditto.
	(radio-button-choice): Ditto.
	(editable-list): Ditto.
	(group): Ditto.
	(widget-copy): New function.
	(widget-create-child): Use it.
	(widget-create-child-value): Use it.

It solved the problem reported by Jens where the various choice item
in a

   "(repeat (choice ...))"

affected each other.

> Is the :value option still useful, or should we dedocument it?

Yes, the programmer may know a better initial value than what
customize can come up with.

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

* Re: [Jens.Schmidt27@epost.de: Customize creating wrong defaults]
  2002-10-03 13:47         ` Per Abrahamsen
@ 2002-10-04  3:48           ` Richard Stallman
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2002-10-04  3:48 UTC (permalink / raw)
  Cc: emacs-devel, Jens.Schmidt27

Thanks for fixing these things.

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

end of thread, other threads:[~2002-10-04  3:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E17wGMQ-0006jm-00@fencepost.gnu.org>
     [not found] ` <rj3crqzc96.fsf@zuse.dina.kvl.dk>
2002-10-02  4:07   ` [Jens.Schmidt27@epost.de: Customize creating wrong defaults] Richard Stallman
2002-10-02 13:26     ` Per Abrahamsen
2002-10-03  0:32       ` Richard Stallman
2002-10-03 13:47         ` Per Abrahamsen
2002-10-04  3:48           ` Richard Stallman

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).