From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Example using x-popup-menu needed
Date: Fri, 17 Oct 2003 20:14:50 GMT [thread overview]
Message-ID: <jwv7k33pr1s.fsf-monnier+gnu.emacs.help@vor.iro.umontreal.ca> (raw)
In-Reply-To: EwUjb.65175$pv6.1917@twister.nyc.rr.com
> (let ((item)
> (item-list))
> (while menu-items
> (setq item (car menu-items))
> (if (consp item)
> (setq item-list (cons (cons (car item) (cdr item) ) item-list))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
why do such unnecessary copying ?
> (setq item-list (cons (cons item item) item-list)))
> (setq menu-items (cdr menu-items))
> )
> (x-popup-menu t (list menu-title (cons menu-title (nreverse
> item-list))))))
You mean (x-popup-menu
t (list menu-title
(cons menu-title
(mapcar (lambda (item)
(if (consp item) item
(cons item item)))
item-list))))
> (eval-expression
> (car
> (read-from-string
> (choose-from-menu
> "Commands"
> (list
> (cons "Copy C-insert" "(call-interactively
> 'copy-region-as-kill)")
> (cons "Goto Line" "(call-interactively 'goto-line)")
> (cons "Paste/yank S-insert" "(yank)")
> (cons "Redo" "(redo)")
> (cons "Search files" "(call-interactively 'grep)")
> (cons "Undo C-_" "(undo)")
> (cons "Word completion M-/" "(call-interactively 'dabbrev-expand)")
> ))))))
You mean
(call-interactively
(choose-from-menu "Commands"
'(("Copy C-insert" . copy-region-as-kill)
("Goto Line" . goto-line)
("Paste/Yank S-insert" . yank)
("Redo" . redo)
("Search Files" . grep)
("Undo C-_" . undo)
("Word Completion M-/" . dabbrev-expand))))
> (global-set-key [mouse-3] 'right-popup)
If you define `right-popup' as a menu keymap, you'll save yourself
the trouble of calling the commands and you'll get the hotkeys for free.
Stefan
next prev parent reply other threads:[~2003-10-17 20:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-17 5:38 Example using x-popup-menu needed Dave Neubart
2003-10-17 13:41 ` Barman Brakjoller
2003-10-17 16:11 ` Bruce Ingalls
2003-10-17 16:32 ` Martin Stemplinger
2003-10-17 18:14 ` Bruce Ingalls
2003-10-17 16:50 ` Ian Zimmerman
2003-10-17 18:11 ` Bruce Ingalls
2003-10-17 20:07 ` Stefan Monnier
2003-10-17 20:07 ` Kevin Rodgers
2003-10-17 21:26 ` Kevin Rodgers
2003-10-17 20:14 ` Stefan Monnier [this message]
2003-10-18 13:45 ` Martin Stemplinger
2003-12-02 20:50 ` Kai Grossjohann
2003-12-03 18:29 ` Kevin Rodgers
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=jwv7k33pr1s.fsf-monnier+gnu.emacs.help@vor.iro.umontreal.ca \
--to=monnier@iro.umontreal.ca \
/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.