From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: popup menu code Date: Thu, 23 Oct 2003 22:01:48 GMT Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1066947371 26622 80.91.224.253 (23 Oct 2003 22:16:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 23 Oct 2003 22:16:11 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 24 00:16:09 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ACnkX-00077D-00 for ; Fri, 24 Oct 2003 00:16:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ACnk7-00020P-LU for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Oct 2003 18:15:43 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!snoopy.risq.qc.ca!charlie.risq.qc.ca!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 24 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-NNTP-Posting-Host: 132.204.24.42 Original-X-Complaints-To: abuse@umontreal.ca Original-X-Trace: charlie.risq.qc.ca 1066946508 132.204.24.42 (Thu, 23 Oct 2003 18:01:48 EDT) Original-NNTP-Posting-Date: Thu, 23 Oct 2003 18:01:48 EDT Original-Xref: shelby.stanford.edu gnu.emacs.help:117569 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13501 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13501 > (define-key menu [kill-region] > (cons "Cut" > '(when (and mark-active (not buffer-read-only) > (call-interactively 'kill-region))))) Does this work? I know it does in easy-menus, but I don't think it does in your case. But even if it does, it's a bad idea. Better use an `activate' property. Check out the elisp documentation. More specifically, look for `menu-item' in the index. > (defun right-popup () ;event > "Run the command selected from `right-popup-menu'." > (interactive) > (call-interactively (or (car (x-popup-menu t right-popup-menu)) > 'ignore))) > (global-set-key [mouse-3] 'right-popup) IIRC, you can get rid of right-popup and just do (global-set-key [mouse-3] right-popup-menu) -- Stefan