[Top][All Lists]

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

RE: [h-e-w] easymenu question

From: Drew Adams
Subject: RE: [h-e-w] easymenu question
Date: Sat, 14 Aug 2010 11:50:36 -0700

> I am using easymenu.el to create major-mode-specific menus. 
> The following code in my .emacs does create the desired
> "XQuery" menu. However, it positions the XQuery menu as
> the first (i.e. left-most) menu.  I would like
> to be able to position it as the right-most, or, better yet, 
> to place it in any arbitrary position relative to the other
> menus. Can anyone help?
>    (easy-menu-define my-menu global-map "XQUERY"
>                     '("XQuery"
>                   :visible (string= major-mode
>                                     "xquery-mode")
>                       ["xquery decl" insert-decl t]
>                       ("Sub Menu"
>                        ["My subentry" my-obscure-function t])))

FYI - Your question is not Windows-specific.  This list is.  You might get more
help for general questions like this by using the list address@hidden


You can use variable `menu-bar-final-items' to set the order of the rightmost
menus.  You can make that set include all of the existing menus, but new menus -
in particular any current mode menus, are added at the left.

Here, for example, is what I do with this variable in `menu-bar+.el':

(setq menu-bar-final-items
      (append '(divider file edit options buffer tools search)
              (and (boundp 'menu-bar-frames-menu) '(frames))
              (and (boundp 'menu-bar-doremi-menu) '(doremi))
              (and (fboundp 'show-tool-bar-for-one-command)

That ensures this order for the ongoing menu-bar menus:

|| Files Edit Options Buffer Tools Search Frames Doremi Help Button

When a new menu is added, it is added at the left.  For example, with Icicle
minor mode turned on and in a buffer in Emacs-Lisp mode (splitting the line here
just for mail purposes), the menu changes to this:

Emacs-Lisp Icicle || Files Edit Options Buffer Tools
                     Search Frames Doremi Help Button

If you want a newly added menu to be placed somewhere other than on the left,
then you need to change the value of `menu-bar-final-items' dynamically after it
has been added (at the left).

FWIW - `divider' above is a simple pseudo-menu named `||', that just serves as a
visual divider between the ongoing menus (at the right) and the current mode
menus (at the left):

(defvar menu-bar-divider-menu (make-sparse-keymap "Divider"))
(define-key global-map [menu-bar divider] (cons "||" menu-bar-divider-menu))
(define-key menu-bar-divider-menu [menu-bar-divider-hint]
  '("<-- Current mode menus to left.   ||   Common menus to right -->"
    . describe-menubar))


[On another subject, I would be interested in hearing more about your XQuery
menu and commands, off list.]

reply via email to

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