help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Emacs LISP Question


From: Klaus Zeitler
Subject: Re: Emacs LISP Question
Date: 22 Aug 2003 13:17:52 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

>>>>> "Yakov" == Yakov Nekritch <yasha@theory.cs.uni-bonn.de> writes:
    Yakov> 
    Yakov> How can I implement a  mouse pop-up menu, for a menu defined with 
    Yakov> easy-menu-define?
    Yakov> 
    Yakov> (defun mouse-popup-cscopemenu ( )
    Yakov>  "Popup a cscope menu."
    Yakov>  (popup-menu  cscope:menu ) )
    Yakov> 
    Yakov> (define-key c-mode-base-map [S-down-mouse-3] 'mouse-popup-cscopemenu)

close, but I think the parameter is missing. Here's what I use:

(defun cscope-popup-menu-prompt (event)
  "Handle `mouse' events for cscope. EVENT is the mouse event."
  (interactive "e")
  (popup-menu cscope:menu event))

(defun cscope-popup-menu-no-prompt (event)
  "Handle `mouse' events for cscope. EVENT is the mouse event."
  (interactive "e")
  (let ((cscope-no-mouse-prompts t))
    (popup-menu cscope:menu event)))

(define-key c-mode-map   [H-mouse-1]   'cscope-popup-menu-prompt)
(define-key c-mode-map   [S-H-mouse-1] 'cscope-popup-menu-no-prompt)
(define-key c++-mode-map [H-mouse-1]   'cscope-popup-menu-prompt)
(define-key c++-mode-map [S-H-mouse-1] 'cscope-popup-menu-no-prompt)))


Cheers

Klaus

-- 
 ------------------------------------------
|  Klaus Zeitler      Lucent Technologies  |
 ------------------------------------------
---
The trouble with doing something right the first time
is that nobody appreciates how difficult it was.


reply via email to

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