I have been using XEmacs for years and have completely redefined the menubar for my productivity. I would like to replace XEmacs with Emacs 28.2. I have tried several ways to redefine some menubar items, but so far, no luck. I copied menu-bar.el to my .emacs.d and load it from .emacs. I can tell that the local file is being read, as I have re-ordered the menus and they appear as desired:

File Edit Tools Options Buffers

So far, so good. However I removed the "New Tab" and "Close Tab" entries from menu-bar-file-menu definition, but they still appear in the File menu. I tried

  (define-key global-map [menu-bar] nil)
  (define-key global-map [menu-bar] (make-sparse-keymap "menu-bar"))

hoping this would re-create the keymaps. No luck. I also tried

  (define-key global-map [menu-bar file] nil)
  (define-key global-map [menu-bar edit] nil)
  (define-key global-map [menu-bar options] nil)
  (define-key global-map [menu-bar buffer] nil)
  (define-key global-map [menu-bar tools] nil)
  (define-key global-map [menu-bar help-menu] nil)

Again, hoping to get the keymap redefined, but the two tab entries still appear. I realize, I can delete and add menu entries, but to get the customization I want, this would entail more effort than re-defining menu-bar.el

Any idea what I'm doing wrong?

  • Try setting the values of global vars such as menu-bar-file-menu, which define the various menus. Looking at the code of library MenuBar+ might help; dunno.
    – Drew
    Commented Jan 2, 2023 at 23:03
  • Here is a link to the menu-bar buffer-menu component of Xemacs that I stole and converted to regular Emacs a few years ago ... I don know if it works with a more recent version of Emacs ... perhaps something in there might give you some ideas: github.com/lawlist/buffer-menu
    – lawlist
    Commented Jan 2, 2023 at 23:42

1 Answer 1


I know this is a bit late but this is actually very do'able. You just needed the car of the menu item you want to delete. There are a few ways to find it but I like to use lookup-key to just dump the entire menu out to my scratch buffer:

(lookup-key global-map [menu-bar file])

Then simply do a search for the menu text you see in the menu bar: "New Tab" and then the car of that list is make-tab so that's the key we will need to remove:

(define-key global-map [menu-bar file make-tab] nil)

Executing that will remove the "New Tab" menu item entry.

I will leave it as an exercise for the reader to do the same for the "Close Tab" menu item.

Edit: Re-reading your question, if you want to completely redefine the menu bar then you will need to construct keymaps with extended menu items as the contents (and the commands being used must be interactive). I would recommend taking a look at the documentation for that particular section since it's quite intensive and involved: https://www.gnu.org/software/emacs/manual/html_node/elisp/Extended-Menu-Items.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.