From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mike Ballard Newsgroups: gmane.emacs.help Subject: Re: Creating a menu/pop-up? Date: Wed, 02 Jul 2003 02:33:48 GMT Organization: EarthLink Inc. -- http://www.EarthLink.net Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <3F0069D6.8030804@yahoo.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1057113875 12571 80.91.224.249 (2 Jul 2003 02:44:35 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 2 Jul 2003 02:44:35 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 02 04:44:32 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19XXb8-0003Ef-00 for ; Wed, 02 Jul 2003 04:43:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19XXYQ-0003Np-Pi for gnu-help-gnu-emacs@m.gmane.org; Tue, 01 Jul 2003 22:41:06 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newshub.sdsu.edu!elnk-pas-nf2!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help X-Newsreader: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Original-Lines: 50 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Original-NNTP-Posting-Host: 67.75.7.139 Original-X-Complaints-To: abuse@earthlink.net Original-X-Trace: newsread1.prod.itd.earthlink.net 1057113228 67.75.7.139 (Tue, 01 Jul 2003 19:33:48 PDT) Original-NNTP-Posting-Date: Tue, 01 Jul 2003 19:33:48 PDT Original-Xref: shelby.stanford.edu gnu.emacs.help:114888 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11380 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11380 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!"