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

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

Re: Derived Mode 102 Keybindings and Menu


From: Tim Johnson
Subject: Re: Derived Mode 102 Keybindings and Menu
Date: Wed, 22 Mar 2006 01:55:40 -0000
User-agent: slrn/0.9.8.0 (Linux)

On 2006-03-21, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>> (easy-menu-define foo-menu foo-mode-map "Foo mode menu."
>>> '("Foo"
>>> [...]
>>> [...]
>>> ...))
>>> 
>>> and then in foo-mode you do
>
>>>   (easy-menu-add foo-menu)
>
>>  For cross-compatibility XEmacs needs a more verbose approach, including
>>  passing the keymap as an argument.
>
> I've used the above code in sml-mode and AFAIK it worked both in Emacs and
> XEmacs.  So, I don't think you need "a more verbose approach" for XEmacs.

Here's what I have done:
;; toplevel, called from derive-mode form
(defun newlisp-menu ()
  "Create Newlisp Menu for emacs/XEmacs"
  (defvar newlisp-menu-var nil "Newlisp Menu Definition")
  (easy-menu-define
   newlisp-menu-var newlisp-keymap "Newlisp Mode Menu"
     '("Newlisp"
     ["Test" test-fun]))
  (easy-menu-add-item nil nil newlisp-menu-var))
;; Works on both forks.
;; Tried changing
  (easy-menu-add-item nil nil newlisp-menu-var)
  to:
  (easy-menu-add-item newlisp-menu-var)
  ;; worked on Xemacs not on gnu emacs
-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com


reply via email to

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