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

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

Re: Trapping Quit from x-popup-menu


From: Tim Johnson
Subject: Re: Trapping Quit from x-popup-menu
Date: Sun, 29 Jun 2014 16:07:39 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

* Michael Heerdegen <address@hidden> [140629 12:58]:
> Tim Johnson <address@hidden> writes:
> 
> > ;; ---------------------------------------------------------
> > (let ((menu (tj-dir-menu curdir get-hidden))
> >     choice nextdir
> >     (default curdir))
> >     (setq choice
> >       (x-popup-menu (list '(0 0) (selected-window)) menu))
> >     (message (concat "choice: " choice))
> > ;; ---------------------------------------------------------
> >
> > If I quit x-popup-menu without making a selection, than the rest of
> > the code in the defun - beginning with 
> >
> >   (message (concat "choice: " choice)
> >
> > is not executed. 
> >
> > What is the proper way to trap the call to x-popup-menu so that I
> > can have some sort of a default value for 'choice?
> 
> If you cannot/don't want to use a mouse button event as position
> argument of `x-popup-menu` (as it is described in the docstring and
> prevents the function from signaling quit), catch the quit signal
> with condition-case:
> 
>     (condition-case nil
>         (x-popup-menu ...)
>       ((quit) a-default-value))
  Thanks Michael. That is exactly what I was looking for.
  On a related note, can you tell me how to use help to get a list
  of standard errors?

  I can see documentation at
  http://www.chemie.fu-berlin.de/chemnet/use/info/elisp/elisp_40.html#SEC592
  But don't know how to invoke it from emacs itself.

  Thanks again
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com



reply via email to

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