emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: Re: erase customization does not work]


From: Luc Teirlinck
Subject: Re: address@hidden: Re: erase customization does not work]
Date: Mon, 21 Nov 2005 22:03:36 -0600 (CST)

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
  
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]