From: Mike Ballard <dont_w@nt_spam.org>
Subject: Re: Creating a menu/pop-up?
Date: Wed, 02 Jul 2003 02:33:48 GMT [thread overview]
Message-ID: <m2znjxodtq.fsf@west_f1.net> (raw)
In-Reply-To: 3F0069D6.8030804@yahoo.com
On Mon Jun 30, Kevin Rodgers disturbed my nap when he said:
> Mike Ballard wrote:
>
> > Anyone have an idea or two for an elisp neophyte so that I can create a
> > pop-up showing my list of text files such that clicking on one of the
> > files runs it under steno?
>
> How's this for a start:
>
> (defun mouse-steno-popup (e)
> "Pop up a menu of *.txt files in the ~ directory. E is a mouse event."
> (interactive "e")
> (let ((steno-menu (steno-popup-menu))) ; keymap
> (call-interactively (lookup-key steno-menu
> (vector (x-popup-menu e steno-menu))))))
>
> (global-set-key [S-down-mouse-3] 'mouse-steno-popup)
>
> (defun steno-popup-menu ()
> "Return a menu keymap mapping each ~/*.txt file to \\[steno-command]."
> (let ((menu (make-sparse-keymap "Steno Files"))
> (files (nreverse (directory-files "~" nil "\\.txt\\'"))))
> (while files
> (define-key menu (vector (intern (car files)))
> (cons (car files)
> `(lambda ()
> ,(format "Run \\[steno-command] on \"%s\"." (car files))
> (interactive)
> (steno-command ,(car files)))))
> (setq files (cdr files)))
> menu))
>
Outstanding! Thanks so much - it gives me exactly what I was looking for.
I got the steno cmd in, and my text files have no ext and using nil
w/dir-files includes . and .. in pop-up, but I'll get it.
What's the escaped ' for in dir-files regexp - I don't see it (Info)?
Thanks again - much appreciated!
Mike
--
mike.ballard--at--earthlink.net
"Play an accordion, go to jail. It's the law!"
prev parent reply other threads:[~2003-07-02 2:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-29 0:38 Creating a menu/pop-up? Mike Ballard
2003-06-29 22:24 ` Sandip Chitale
2003-06-30 16:48 ` Kevin Rodgers
2003-07-02 2:33 ` Mike Ballard [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2znjxodtq.fsf@west_f1.net \
--to=dont_w@nt_spam.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).