unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
@ 2005-11-16 10:47 Richard M. Stallman
  2005-11-18  0:54 ` Luc Teirlinck
  2005-11-18  1:04 ` Luc Teirlinck
  0 siblings, 2 replies; 14+ messages in thread
From: Richard M. Stallman @ 2005-11-16 10:47 UTC (permalink / raw)


Could someone please debug this and ack?

------- Start of forwarded message -------
Date: Tue, 15 Nov 2005 09:46:13 +0100
From: Martin Buchmann <Martin.Buchmann@uni-jena.de>
X-Accept-Language: de-DE, de, en-us, en
To: rms@gnu.org
Subject: Re: erase customization does not work
In-Reply-To: <E1EbtbE-0004Cr-VO@fencepost.gnu.org>
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on monty-python
X-Spam-Level: 
X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.63

Richard,

I applied your patch and don't get any error messages now if I choose 
"Erase Customization". But I am not sure if it is really working, i.e. 
customizations are not reverted to their standard values. I checked with 
the "Horizontal" section of the ps-print group:

M-x customize-group RET ps-print, clicked on "Go to group" for 
Horizontal and changed the value for "Ps Left Margin" to "55". I choose 
"Set for Current Session" and "Save for Future Sessions" but "Erase 
Customization" has no effect at all afterwards. I enabled debugging on 
error (M-x toggle-degub-on-error) but there was no error.

Best regards
   Martin

- -- 
California is a fine place to live -- if you happen to be an orange.
		-- Fred Allen
------- End of forwarded message -------

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-16 10:47 [Martin.Buchmann@uni-jena.de: Re: erase customization does not work] Richard M. Stallman
@ 2005-11-18  0:54 ` Luc Teirlinck
  2005-11-18  1:38   ` Luc Teirlinck
                     ` (2 more replies)
  2005-11-18  1:04 ` Luc Teirlinck
  1 sibling, 3 replies; 14+ messages in thread
From: Luc Teirlinck @ 2005-11-18  0:54 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:

   Could someone please debug this and ack?

The problem is that the current code assumes that, in a group
customization buffer, the mapc in Custom-reset-default will loop over
all variables and faces in the Custom buffer, calling
custom-{face,variable}-reset-standard on all of them.  This assumption
is false.  The mapc loop has only one single iteration: it calls
`custom-group-reset-standard' on the buffer's group.
`custom-group-reset-standard' then iterates over the variables and
faces.  The group widget has a nil :custom-standard-value and no
'standard-value.  Hence, in a group customization buffer,
Custom-reset-default produced an error before your latest change and
is a no-op after that change.

The following would make the buffer-wide "Erase Customization" button
work probably as well as the "Reset" and "Reset to saved" buttons:

(defun Custom-reset-standard (&rest ignore)
  "Erase all customization (either current or saved) for the group members.
The immediate result is to restore them to their standard settings.
This operation eliminates any saved settings for the group members,
making them as if they had never been customized at all."
  (interactive)
  (let ((children custom-options))
    (mapc (lambda (widget)
	    (when (memq (widget-get widget :custom-state)
			'(modified set changed saved rogue))
	      (widget-apply widget :custom-reset-standard)))
	  children)))

*I did not heavily test the above function* and do not recommend
installing it, but if somebody else wants to install it (without
attributing it to me), then that is OK with me.  The problem is that I
believe that this is a dangerous button, that could make people loose
a lot of customizations carefully built up over the years, by
inadvertently clicking mouse-1 on it (just to give focus to the
frame).  When that happens, I prefer them to blame somebody else,
rather than me.  Although other people will probably not agree with me
on this, I personally believe that the best thing would be to get rid
of these buffer-wide buttons altogether, _except_ for buffers customizing
single options, where they are OK and convenient.

The buffer-wide "Erase Customization" button has apparently *never*
worked _in a group customization buffer_ in any released Emacs
version.  Nobody ever noticed until now (after 8 years and seven
months).  The other two buttons ("Reset" and "Reset to saved")
apparently only started working until a change by Markus Rost made
them work in 2002 after nearly six years.  Before that, nobody
apparently noticed that they did not work.  All evidence that barely
anybody ever uses them.

I know that there was a thread (I participated in it) in which people
claimed that most people would actually always use the buffer-wide
buttons, because that is what they are used to from other
applications.  How come it took six, respectively eight and a half,
years for _somebody_ among all those people to notice that the buttons
they were using were actually no-ops (or threw errors) in group
customization buffers?

Sincerely,

Luc.

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-16 10:47 [Martin.Buchmann@uni-jena.de: Re: erase customization does not work] Richard M. Stallman
  2005-11-18  0:54 ` Luc Teirlinck
@ 2005-11-18  1:04 ` Luc Teirlinck
  1 sibling, 0 replies; 14+ messages in thread
From: Luc Teirlinck @ 2005-11-18  1:04 UTC (permalink / raw)
  Cc: emacs-devel

>From my previous message:

   The following would make the buffer-wide "Erase Customization" button
   work probably as well as the "Reset" and "Reset to saved" buttons:

and:

   *I did not heavily test the above function*

On rereading, I noticed that I wrote this in a somewhat misleading
way.  The function in question is *not* a completely new function, as
my posting may have inadvertently given the impression, but
essentially the current function with:

          (and (widget-get widget :custom-standard-value)
	        (widget-apply widget :custom-standard-value)

removed.

I thought that the actual function might be easier for people to C-M-x
than a patch.  (This is how I tested it myself.)

Sincerely,

Luc.

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-18  0:54 ` Luc Teirlinck
@ 2005-11-18  1:38   ` Luc Teirlinck
  2005-11-18  2:17     ` Luc Teirlinck
  2005-11-18  2:24     ` Luc Teirlinck
  2005-11-18  4:39   ` Luc Teirlinck
  2005-11-19 23:26   ` Richard M. Stallman
  2 siblings, 2 replies; 14+ messages in thread
From: Luc Teirlinck @ 2005-11-18  1:38 UTC (permalink / raw)
  Cc: rms, emacs-devel

>From my previous message:

   I know that there was a thread (I participated in it) in which people
   claimed that most people would actually always use the buffer-wide
   buttons, because that is what they are used to from other
   applications.  How come it took six, respectively eight and a half,
   years for _somebody_ among all those people to notice that the buttons
   they were using were actually no-ops (or threw errors) in group
   customization buffers?

In as far as CVS is concerned, the "six" in the above was a slight
overstatement: it was actually five and a half.  The whole buffer "Set"
and "Reset" buttons in a Custom group buffer started working in CVS
three years and one month ago.  They work in 21.3, but not in 22.2,
and apparently not in any earlier released version.  Again, the
buffer-wide "Erase Customization" button and its predecessor
"Reset to Standard" button apparently never worked in a Custom group
buffer in any released version.

Sincerely,

Luc.

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-18  1:38   ` Luc Teirlinck
@ 2005-11-18  2:17     ` Luc Teirlinck
  2005-11-18  2:24     ` Luc Teirlinck
  1 sibling, 0 replies; 14+ messages in thread
From: Luc Teirlinck @ 2005-11-18  2:17 UTC (permalink / raw)
  Cc: rms, emacs-devel

>From my earlier message:

   The whole buffer "Set" and "Reset" buttons in a Custom group buffer
   started working in CVS three years and one month ago.  They work in
   21.3, but not in 22.2,

I meant:  They work in 21.3, but not in 21.2 (obviously).

Sincerely,

Luc.

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-18  1:38   ` Luc Teirlinck
  2005-11-18  2:17     ` Luc Teirlinck
@ 2005-11-18  2:24     ` Luc Teirlinck
  1 sibling, 0 replies; 14+ messages in thread
From: Luc Teirlinck @ 2005-11-18  2:24 UTC (permalink / raw)
  Cc: rms, emacs-devel

>From my earlier message:

   The whole buffer "Set" and "Reset" buttons in a Custom group buffer
   started working in CVS three years and one month ago.  They work in
   21.3, but not in 22.2,

Not only did I mean "21.2" instead of "22.1", I also meant "Reset" and
"Reset to Saved" (not "Set").

Sincerely,

Luc.

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-18  0:54 ` Luc Teirlinck
  2005-11-18  1:38   ` Luc Teirlinck
@ 2005-11-18  4:39   ` Luc Teirlinck
  2005-11-19 23:26   ` Richard M. Stallman
  2 siblings, 0 replies; 14+ messages in thread
From: Luc Teirlinck @ 2005-11-18  4:39 UTC (permalink / raw)
  Cc: rms, emacs-devel

>From my prior message:

   The following would make the buffer-wide "Erase Customization" button
   work probably as well as the "Reset" and "Reset to saved" buttons:

   (defun Custom-reset-standard (&rest ignore)
     "Erase all customization (either current or saved) for the group members.
   The immediate result is to restore them to their standard settings.
   This operation eliminates any saved settings for the group members,
   making them as if they had never been customized at all."
     (interactive)
     (let ((children custom-options))
       (mapc (lambda (widget)
	       (when (memq (widget-get widget :custom-state)
			   '(modified set changed saved rogue))
		 (widget-apply widget :custom-reset-standard)))
	     children)))

   *I did not heavily test the above function* and do not recommend
   installing it,

Maybe some further remarks.  Apart from the fact that the "Erase
Customization" buttons are especially dangerous to an inadvertent
user, I feel reasonably confident that the above works _as well as_
the code for the buffer-wide "Reset" and "Reset to Saved" buttons.
What I did was just remove the same type of conditionals that the
change three years ago removed.  However, if there were any problems
with the change to the "Reset" and "Reset to Saved" button code three
years ago, that is if the removed lines were actually sometimes
necessary in Custom buffers _other_ than group customization buffers,
then nobody would have noticed any of the involved bugs in the
meantime (even if some bugs would be very obvious or severe), just
like nobody noticed that these buttons were no-ops in the prior five
and a half years: barely anybody uses these whole buffer buttons.

I am not going to spend a lot of time checking whether whether these
conditionals might be necessary in some situations in other types of
Custom buffers, because these whole buffer buttons are not used (and
should not be used) by anybody anyway (_except_ in buffers customizing
a single option or face).  It is impossible to rely on CVS users or
pretesters to discover any involved bugs, for that same reason.

Sincerely,

Luc.

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-18  0:54 ` Luc Teirlinck
  2005-11-18  1:38   ` Luc Teirlinck
  2005-11-18  4:39   ` Luc Teirlinck
@ 2005-11-19 23:26   ` Richard M. Stallman
  2005-11-19 23:42     ` David Kastrup
                       ` (2 more replies)
  2 siblings, 3 replies; 14+ messages in thread
From: Richard M. Stallman @ 2005-11-19 23:26 UTC (permalink / raw)
  Cc: emacs-devel

      The problem is that I
    believe that this is a dangerous button, that could make people loose
    a lot of customizations carefully built up over the years, by
    inadvertently clicking mouse-1 on it (just to give focus to the
    frame).

If you delete customizations this way, they will remain in the backup
file of .emacs.  So it isn't quite so dangerous as you make it sound.

But it seems appropriate to make this ask for confirmation.
Would you like to install your fix, with that change too?

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-19 23:26   ` Richard M. Stallman
@ 2005-11-19 23:42     ` David Kastrup
  2005-11-20 23:22       ` Richard M. Stallman
  2005-11-22  4:03     ` Luc Teirlinck
  2005-11-22  4:24     ` Luc Teirlinck
  2 siblings, 1 reply; 14+ messages in thread
From: David Kastrup @ 2005-11-19 23:42 UTC (permalink / raw)
  Cc: Luc Teirlinck, emacs-devel

"Richard M. Stallman" <rms@gnu.org> writes:

>       The problem is that I believe that this is a dangerous button,
>     that could make people loose a lot of customizations carefully
>     built up over the years, by inadvertently clicking mouse-1 on it
>     (just to give focus to the frame).
>
> If you delete customizations this way, they will remain in the
> backup file of .emacs.  So it isn't quite so dangerous as you make
> it sound.

The first impulse of an average user when confronted with a
catastrophe is to try salvaging it.  In a panic, this will likely
result in an attempt of putting together the old .emacs from memory or
other sources.  In this case, the backup file will be gone with the
next save.

I have witnessed enough scenarios where I had to tell people "if you
had just called me right after the damage instead of trying to fix it,
it would have been easy to restore".

So in particular in this case, I'd not consider the existence of the
backup file (and some people turn of backup files, anyway) enough for
dismissing the case as harmless.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-19 23:42     ` David Kastrup
@ 2005-11-20 23:22       ` Richard M. Stallman
  0 siblings, 0 replies; 14+ messages in thread
From: Richard M. Stallman @ 2005-11-20 23:22 UTC (permalink / raw)
  Cc: teirllm, emacs-devel

    So in particular in this case, I'd not consider the existence of the
    backup file (and some people turn of backup files, anyway) enough for
    dismissing the case as harmless.

People who turn off backups are asking for trouble.
Emacs gives people enough rope to hang themselves, and we're not
going to change that.  My decision is that adding an extra query
is enough protection against this kind of mistake.

Luc, would you please install that change?

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-19 23:26   ` Richard M. Stallman
  2005-11-19 23:42     ` David Kastrup
@ 2005-11-22  4:03     ` Luc Teirlinck
  2005-11-22 20:33       ` Richard M. Stallman
  2005-11-22  4:24     ` Luc Teirlinck
  2 siblings, 1 reply; 14+ messages in thread
From: Luc Teirlinck @ 2005-11-22  4:03 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:

   But it seems appropriate to make this ask for confirmation.
   Would you like to install your fix, with that change too?

That would be inconvenient in Custom buffers with only one option to
Customize, where the button is not that dangerous (as in say the
buffer you get from customize-saved, where it would wipe out _all_ the
user's saved options).  These are the only buffers where this button
is actually used by people, so these buffers are by far the most
important ones.

I propose to only ask the question if the Custom buffer contains more
than one option.  I am mainly concerned about the buffers you get with
customize-option or customize-face, but the question would be omitted
in any single-option buffer.  (These are not easy to distinguish from
customize-{option,frame} buffers.)  I could document this behavior in
the Emacs manual, if desired.

The patch below implements the above and also, unlike my original one,
still checks for the existence of a standard value whenever this is
(probably) necessary.  I will install it if my proposal looks OK.

===File ~/cus-edit-diff=====================================
*** cus-edit.el	17 Nov 2005 10:24:20 -0600	1.241
--- cus-edit.el	21 Nov 2005 21:19:46 -0600	
***************
*** 800,812 ****
  making them as if they had never been customized at all."
    (interactive)
    (let ((children custom-options))
      (mapc (lambda (widget)
! 	    (and (widget-get widget :custom-standard-value)
! 		 (widget-apply widget :custom-standard-value)
! 		 (if (memq (widget-get widget :custom-state)
! 			   '(modified set changed saved rogue))
! 		     (widget-apply widget :custom-reset-standard))))
! 	    children)))
  
  ;;; The Customize Commands
  
--- 800,816 ----
  making them as if they had never been customized at all."
    (interactive)
    (let ((children custom-options))
+     (unless (and (= 1 (length children))
+ 		 (widget-get (car children) :custom-standard-value))
+       (yes-or-no-p "Really erase all customizations in this buffer? "))
      (mapc (lambda (widget)
! 	    (and (if (widget-get widget :custom-standard-value)
! 		     (widget-apply widget :custom-standard-value)
! 		   t)
! 		 (memq (widget-get widget :custom-state)
! 		       '(modified set changed saved rogue))
! 		 (widget-apply widget :custom-reset-standard)))
! 	  children)))
  
  ;;; The Customize Commands
  
============================================================

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-19 23:26   ` Richard M. Stallman
  2005-11-19 23:42     ` David Kastrup
  2005-11-22  4:03     ` Luc Teirlinck
@ 2005-11-22  4:24     ` Luc Teirlinck
  2005-11-22  4:32       ` Luc Teirlinck
  2 siblings, 1 reply; 14+ messages in thread
From: Luc Teirlinck @ 2005-11-22  4:24 UTC (permalink / raw)
  Cc: emacs-devel

There was a mistake in my previous patch.  Below is a corrected version.

Also, unlike what I told before, the question would always be asked in
group buffers, even if they contained only one item (which is rare),
but not in buffers gotten with customize-option or customize-face (my
main concern).  The question would also not be asked in non-group
buffers with only one option, say buffers gotten with
customize-apropos, where the search yielded only one result.  (These
are the ones that are difficult to distinguish from
customize-{option,face} buffers.)

Corrected patch:

===File ~/cus-edit-diff=====================================
*** cus-edit.el	17 Nov 2005 10:24:20 -0600	1.241
--- cus-edit.el	21 Nov 2005 22:15:33 -0600	
***************
*** 800,812 ****
  making them as if they had never been customized at all."
    (interactive)
    (let ((children custom-options))
!     (mapc (lambda (widget)
! 	    (and (widget-get widget :custom-standard-value)
! 		 (widget-apply widget :custom-standard-value)
! 		 (if (memq (widget-get widget :custom-state)
! 			   '(modified set changed saved rogue))
! 		     (widget-apply widget :custom-reset-standard))))
! 	    children)))
  
  ;;; The Customize Commands
  
--- 800,816 ----
  making them as if they had never been customized at all."
    (interactive)
    (let ((children custom-options))
!     (when (or (and (= 1 (length children))
! 		   (widget-get (car children) :custom-standard-value))
! 	      (yes-or-no-p "Really erase all customizations in this buffer? "))
!       (mapc (lambda (widget)
! 	      (and (if (widget-get widget :custom-standard-value)
! 		       (widget-apply widget :custom-standard-value)
! 		     t)
! 		   (memq (widget-get widget :custom-state)
! 			 '(modified set changed saved rogue))
! 		   (widget-apply widget :custom-reset-standard)))
! 	    children))))
  
  ;;; The Customize Commands
  
============================================================

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-22  4:24     ` Luc Teirlinck
@ 2005-11-22  4:32       ` Luc Teirlinck
  0 siblings, 0 replies; 14+ messages in thread
From: Luc Teirlinck @ 2005-11-22  4:32 UTC (permalink / raw)
  Cc: emacs-devel

>From my previous message:

   Also, unlike what I told before, the question would always be asked in
   group buffers, even if they contained only one item (which is rare),
   but not in buffers gotten with customize-option or customize-face (my
   main concern).

But of course the question _will_ be asked when you customize all
faces with customize-face.  (Another buffer where the button is very
dangerous.)  My code explicitly checks that there is only one option
or face to customize, otherwise it asks the question.

Sincerely,

Luc.

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

* Re: [Martin.Buchmann@uni-jena.de: Re: erase customization does not work]
  2005-11-22  4:03     ` Luc Teirlinck
@ 2005-11-22 20:33       ` Richard M. Stallman
  0 siblings, 0 replies; 14+ messages in thread
From: Richard M. Stallman @ 2005-11-22 20:33 UTC (permalink / raw)
  Cc: emacs-devel

    I propose to only ask the question if the Custom buffer contains more
    than one option.

Ok with me.

    Also, unlike what I told before, the question would always be asked in
    group buffers, even if they contained only one item (which is rare),
    but not in buffers gotten with customize-option or customize-face (my
    main concern).

Ok with me too.

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

end of thread, other threads:[~2005-11-22 20:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-16 10:47 [Martin.Buchmann@uni-jena.de: Re: erase customization does not work] Richard M. Stallman
2005-11-18  0:54 ` Luc Teirlinck
2005-11-18  1:38   ` Luc Teirlinck
2005-11-18  2:17     ` Luc Teirlinck
2005-11-18  2:24     ` Luc Teirlinck
2005-11-18  4:39   ` Luc Teirlinck
2005-11-19 23:26   ` Richard M. Stallman
2005-11-19 23:42     ` David Kastrup
2005-11-20 23:22       ` Richard M. Stallman
2005-11-22  4:03     ` Luc Teirlinck
2005-11-22 20:33       ` Richard M. Stallman
2005-11-22  4:24     ` Luc Teirlinck
2005-11-22  4:32       ` Luc Teirlinck
2005-11-18  1:04 ` Luc Teirlinck

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