all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: Ilya Shlyakhter <ilya_shl@alum.mit.edu>
Cc: help-gnu-emacs@gnu.org
Subject: Re: emacs forms input
Date: Wed, 04 Aug 2010 14:55:59 +0300	[thread overview]
Message-ID: <877hk6vbg0.fsf@mithlond.arda> (raw)
In-Reply-To: <87sk2uzrlr.fsf@mithlond.arda> (Teemu Likonen's message of "Wed,  04 Aug 2010 11:53:20 +0300")

* 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	other threads:[~2010-08-04 11:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.10.1280910238.19279.help-gnu-emacs@gnu.org>
2010-08-04  8:53 ` emacs forms input Teemu Likonen
2010-08-04 11:55   ` Teemu Likonen [this message]
2010-08-04 16:24     ` Ilya Shlyakhter
2010-08-04 16:29       ` Lennart Borgman
2010-08-04 16:53         ` Ilya Shlyakhter
     [not found]       ` <mailman.3.1280939390.6287.help-gnu-emacs@gnu.org>
2010-08-05 14:39         ` Ted Zlatanov
     [not found]     ` <mailman.1.1280939096.6287.help-gnu-emacs@gnu.org>
2010-08-04 22:23       ` Tim X
2010-08-03 22:51 Ilya Shlyakhter

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=877hk6vbg0.fsf@mithlond.arda \
    --to=tlikonen@iki.fi \
    --cc=help-gnu-emacs@gnu.org \
    --cc=ilya_shl@alum.mit.edu \
    /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.