[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: widget-choice-action
From: |
Luc Teirlinck |
Subject: |
Re: widget-choice-action |
Date: |
Wed, 3 Aug 2005 09:59:03 -0500 (CDT) |
Per Abrahamsen wrote:
However, if this is the only reason for :explicit-choice-value, it
seems it would be much cleaner to simply erase the :explicit-choice
attribute after use.
I believe that it should be erased. It seems very bad to leave a
property hanging around forever when it is no longer valid. If I
understood correctly, the patch below which erases the
:explicit-choice after use, should take care of the problems you
mentioned.
===File ~/wid-edit-diff=====================================
*** wid-edit.el 21 Jul 2005 06:54:49 -0500 1.143
--- wid-edit.el 03 Aug 2005 07:56:36 -0500
***************
*** 1955,1967 ****
(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))
(while args
(setq current (car args)
args (cdr args))
--- 1955,1968 ----
(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)
! (widget-put widget :explicit-choice nil))
(while args
(setq current (car args)
args (cdr args))
***************
*** 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)))
--- 2048,2057 ----
(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)))
============================================================