[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: popup menu code

From: Stefan Monnier
Subject: Re: popup menu code
Date: Thu, 23 Oct 2003 22:01:48 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>      (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]