From: Tim Johnson <tim@akwebsoft.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Trapping Quit from x-popup-menu
Date: Sun, 29 Jun 2014 16:07:39 -0800 [thread overview]
Message-ID: <20140630000739.GI3163@mail.akwebsoft.com> (raw)
In-Reply-To: <871tu7toy2.fsf@web.de>
* Michael Heerdegen <michael_heerdegen@web.de> [140629 12:58]:
> Tim Johnson <tim@akwebsoft.com> 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
next prev parent reply other threads:[~2014-06-30 0:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-27 22:44 Trapping Quit from x-popup-menu Tim Johnson
2014-06-29 20:56 ` Michael Heerdegen
2014-06-30 0:07 ` Tim Johnson [this message]
2014-06-30 2:15 ` Drew Adams
2014-06-30 15:33 ` Michael Heerdegen
2014-06-30 15:43 ` Eli Zaretskii
2014-06-30 19:18 ` Tim Johnson
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140630000739.GI3163@mail.akwebsoft.com \
--to=tim@akwebsoft.com \
--cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).