all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org
Subject: Re: widget-choice-action
Date: Wed, 3 Aug 2005 09:59:03 -0500 (CDT)	[thread overview]
Message-ID: <200508031459.j73Ex3B10837@raven.dms.auburn.edu> (raw)
In-Reply-To: <rjfytrguqr.fsf@sheridan.dina.kvl.dk> (message from Per Abrahamsen on Wed, 03 Aug 2005 12:50:04 +0200)

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

      reply	other threads:[~2005-08-03 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-02 13:49 widget-choice-action Luc Teirlinck
2005-08-02 15:31 ` widget-choice-action Per Abrahamsen
2005-08-02 16:25   ` widget-choice-action Luc Teirlinck
2005-08-02 20:20   ` widget-choice-action Luc Teirlinck
2005-08-02 21:44   ` widget-choice-action Luc Teirlinck
2005-08-03 10:50     ` widget-choice-action Per Abrahamsen
2005-08-03 14:59       ` Luc Teirlinck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200508031459.j73Ex3B10837@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.