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

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

Re: emacs forms input


From: Teemu Likonen
Subject: Re: emacs forms input
Date: Wed, 04 Aug 2010 14:55:59 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.50 (gnu/linux)

* 2010-08-04 11:53 (+0300), Teemu Likonen wrote:

> Now, if you want to abstract the implementation between graphical and
> text interface it could be a function like this:
>
>     (defun my-dialog (title item-alist)
>       (if (display-popup-menus-p)
>           (x-popup-dialog t (cons title item-alist) nil)
>         (let ((tmm-completion-prompt (concat title "\n\n")))
>           (tmm-prompt (list "" (cons "" item-alist))))))

Perhaps I should add that if you use C-g (keyboard-quit) or close the
dialog box using window's close button that causes a quit signal and the
function nor its callers won't return. Here's a new version which will
catch the quit signal and, if that happens, return nil:

    (defun my-dialog (title item-alist)
      (condition-case nil
          (if (display-popup-menus-p)
              (x-popup-dialog t (cons title item-alist) nil)
            (let ((tmm-completion-prompt (concat title "\n\n")))
              (tmm-prompt (list "" (cons "" item-alist)))))
        (quit nil)))



reply via email to

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