emacs-devel
[Top][All Lists]
Advanced

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

widget-choice-action


From: Luc Teirlinck
Subject: widget-choice-action
Date: Tue, 2 Aug 2005 08:49:26 -0500 (CDT)

Is there a reason for the "as long as the value is the same" in the
following comment in widget-choice-action?

      ;; If this was an explicit user choice,
      ;; record the choice, and the record the value it was made for.
      ;; widget-choice-value-create will respect this choice,
      ;; as long as the value is the same.

In other words, is there a reason not to make the changes to
`widget-choice-action and `widget-choice-value-create' in the patch
below?  Why should the user's explicit choice _not_ be respected if
the value changes?  This seems very counterintuitive and I had to struggle
with this in the new indicate-buffer-boundaries defcustom, although I
finally found an acceptable workaround (but that was a coincidence and
I would rather not have used the workaround, although it is not too
bad).  If the user selects a choice from a value menu, he expects to
get that choice, regardless of whether the default :value of that
choice is identical with the previous value or not.

===File ~/wid-edit-diff=====================================
*** wid-edit.el 21 Jul 2005 06:54:49 -0500      1.143
--- wid-edit.el 01 Aug 2005 23:00:23 -0500      
***************
*** 1955,1964 ****
        (args (widget-get widget :args))
        (explicit (widget-get widget :explicit-choice))
        current)
!     (if (and explicit (equal value (widget-get widget 
:explicit-choice-value)))
        (progn
          ;; If the user specified the choice for this value,
!         ;; respect that choice as long as the value is the same.
          (widget-put widget :children (list (widget-create-child-value
                                              widget explicit value)))
          (widget-put widget :choice explicit))
--- 1955,1964 ----
        (args (widget-get widget :args))
        (explicit (widget-get widget :explicit-choice))
        current)
!     (if explicit
        (progn
          ;; If the user specified the choice for this value,
!         ;; respect that choice.
          (widget-put widget :children (list (widget-create-child-value
                                              widget explicit value)))
          (widget-put widget :choice explicit))
***************
*** 2047,2059 ****
                 (setq this-explicit t)
                 (widget-choose tag (reverse choices) event))))
      (when current
!       ;; If this was an explicit user choice,
!       ;; record the choice, and the record the value it was made for.
!       ;; widget-choice-value-create will respect this choice,
!       ;; as long as the value is the same.
        (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)))
--- 2047,2056 ----
                 (setq this-explicit t)
                 (widget-choose tag (reverse choices) event))))
      (when current
!       ;; If this was an explicit user choice, record the choice,
!       ;; so that widget-choice-value-create will respect it.
        (when this-explicit
!       (widget-put widget :explicit-choice current))
        (widget-value-set widget (widget-default-get current))
        (widget-setup)
        (widget-apply widget :notify widget event)))
============================================================




reply via email to

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