[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: invoke a keyboard menu map from lisp?
From: |
Stephen Leake |
Subject: |
Re: invoke a keyboard menu map from lisp? |
Date: |
Wed, 26 Aug 2015 21:30:48 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) |
Stephen Leake <address@hidden> writes:
> I'm trying to build a keyboard menu keymap on the fly, and then invoke
> it. I've gotten this far:
>
> (defun dvc-offer-choices (comment choices)
> "Present user with a choice of actions, labeled by COMMENT. CHOICES is a
> list of pairs
> containing (function description)."
> ;; Build a keyboard menu keymap
> (let ((i 0)
> (map (make-sparse-keymap "actions"))
> choice)
> (unless (< (length choices) 10)
> (error "‘dvc-offer-choices’ only supports up to 10 choices"))
>
> (while choices
> (setq choice (pop choices))
> (define-key map (int-to-string i)
> (list menu-item
> (format "%d) %s" i (cadr choice))
> (car choice))))
> ;; FIXME: invoke the map
> ))
>
> But I can't find the function that executes the keymap.
>
> Can anyone help?
I can do (popup-menu map), but that pops up a GUI window; I'd rather
have the plain keyboard menu.
--
-- Stephe