[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trapping Quit from x-popup-menu
From: |
Michael Heerdegen |
Subject: |
Re: Trapping Quit from x-popup-menu |
Date: |
Sun, 29 Jun 2014 22:56:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (gnu/linux) |
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))
Michael