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

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

RE: [h-e-w] Current dir & customizing menu


From: Rosbach, Hans A.
Subject: RE: [h-e-w] Current dir & customizing menu
Date: Wed, 14 Nov 2001 17:25:17 +0100

Heribert Maier wrote:
> Do you know how to make submenus with the tiny arrow?

Sorry not to be able to respond earlier.

No, I did not.  The modes I had written and where the example code
was adapted from, had no use for them.

But I know where to find the information, and as expected, it is easy.

Here is the example expanded

(defun define-my-favorites-menu ()
  "Redefine menubar"
  (cond (t
        (or (lookup-key global-map [menu-bar])
            (define-key global-map [menu-bar] (make-sparse-keymap
"menu-bar")))
;; Submenu first
        (defvar menu-bar-my-favorites-submenu1 (make-sparse-keymap
"movement"))
        (define-key menu-bar-my-favorites-submenu1 [goto-line]
          '("goto-line" . goto-line))
        (define-key menu-bar-my-favorites-submenu1 [goto-mark]
          '(menu-item "goto mark" exchange-point-and-mark
                      :enable mark-active))

;; The main menu itself
        (defvar menu-bar-my-favorites-menu (make-sparse-keymap "Favorites"))
        (setq menu-bar-final-items (cons 'menu-bar-my-favorites-menu
menu-bar-final-items))
;; Put the submenu at the end
        (define-key global-map [menu-bar menu-bar-my-favorites-menu]
          (cons "Favorites" menu-bar-my-favorites-menu))
;; 
        (define-key menu-bar-my-favorites-menu [submenu1]
          (cons "movement" menu-bar-my-favorites-submenu1))
         (define-key menu-bar-my-favorites-menu [separator-favorites]
           '("--"))
        (define-key menu-bar-my-favorites-menu [gnus]
          '("gnus" . gnus))
        )))

(define-my-favorites-menu)

And finally - where can the information be found?

Look in the source of emacs itself.  All the menus you can see are there,
just do a search.  But it is also worth taking a look in the manual, e.g. at
http://baxter.aroy.net/yesod//manuals/elisp_annotated/elisp_343.php#SEC343

Hans Rosbach



**********************************************************************
Neither the confidentiality nor the integrity of this message 
can be guaranteed following transmission on the Internet. 
This message has been swept by MAILsweeper at DNV for 
the presence of computer viruses.
**********************************************************************



reply via email to

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