bug-gnu-emacs
[Top][All Lists]
Advanced

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

Bug in Customize-group?


From: UUnet
Subject: Bug in Customize-group?
Date: Fri, 14 Sep 2001 09:23:34 +0200

Hi.

When you press Reset, Reset to Saved or Reset to Standard in a *group*
customization buffer then nothing happens when you did make a change in 1 of
the options.

Reset won't work since in the function Custom-reset-current there is a test:
"(default-boundp (widget-value widget))"
For a group that's always nil so it will never do anything for it's
children?

I fixed it like this:
(defun Custom-reset-current (&rest ignore)
  "Reset all modified group members to their current value."
  (interactive)
  (let ((children custom-options))
    (mapcar (lambda (widget)
       (and (or (eq (widget-type widget) 'custom-group) ;; extra test, if
group always go to its children
         (default-boundp (widget-value widget))
         )
     (if (memq (widget-get widget :custom-state)
        '(modified changed))
         (widget-apply widget :custom-reset-current))))
     children)))

Reset to Saved won't work since in the function Custom-reset-saved there is
a test: "(get (widget-value widget) 'saved-value)"
For a group that's always nil so it will never do anything for it's
children?

I fixed it like this (also custom-group-reset-saved needed a change):
(defun Custom-reset-saved (&rest ignore)
  "Reset all modified or set group members to their saved value."
  (interactive)
  (let ((children custom-options))
    (mapcar (lambda (widget)
       (and (or (eq (widget-type widget) 'custom-group) ;; in case of
custom-group go to the children!
         (get (widget-value widget) 'saved-value)
         )
     (if (memq (widget-get widget :custom-state)
        '(modified set changed rogue))
         (widget-apply widget :custom-reset-saved))))
     children)))

(defun custom-group-reset-saved (widget)
  "Reset all modified or set group members."
  (backtrace)
  (let ((children (widget-get widget :children)))
    (mapcar (lambda (child)
       (when (and
       (memq (widget-get child :custom-state) '(modified set))
       (get (widget-value child) 'saved-value) ;; only call reset saved if
there is a saved value!
       )
  (widget-apply child :custom-reset-saved)))
     children )))


Reset to Standard won't work since in the function Custom-reset-saved there
is a test: "(get (widget-value widget) 'saved-value)"
For a group that's always nil so it will never do anything for it's
children?

I fixed it like this (also custom-group-reset-standard needed a change):
(defun Custom-reset-standard (&rest ignore)
  "Reset all modified, set, or saved group members to their standard
settings."
  (interactive)
  (let ((children custom-options))
    (mapcar (lambda (widget)
       (and (or (eq (widget-type widget) 'custom-group) ;; in case of
custom-group go to the children!
         (get (widget-value widget) 'standard-value)
         )
     (if (memq (widget-get widget :custom-state)
        '(modified set changed saved rogue))
         (widget-apply widget :custom-reset-standard))))
     children)))

(defun custom-group-reset-standard (widget)
  "Reset all modified, set, or saved group members."
  (let ((children (widget-get widget :children)))
    (mapcar (lambda (child)
       (when (and
       (memq (widget-get child :custom-state)
     '(modified set saved))
       (get (widget-value child) 'standard-value) ;; only call reset saved
if there is a standard value!
       )
  (widget-apply child :custom-reset-standard)))
     children )))

Am I right here?

Thanks, Geert Ribbers







reply via email to

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