In The Armchair

Adding An Emacs Menu

Posted in Computers by Armchair Guy on August 9, 2008

Here’s some template code for adding a menu item to the main emacs menu bar. I don’t know hos this works; I just use it as a template!

;;;;;;; Add items to menu bar(modify-frame-parameters (selected-frame) '((menu-bar-lines . 2)));; Make a menu keymap (with a prompt string);; and make it the menu bar item's definition.(define-key global-map [menu-bar MyMenu] (cons "MyMenu" (make-sparse-keymap "MyMenu")));; Define specific subcommands in this menu.(defun MyMenu-linkify() (interactive) (replace-regexp "^\\(.*\\)$" "\\1"))(define-key global-map  [menu-bar MyMenu linkify]  '("Linkify" . MyMenu-linkify))(define-key global-map  [menu-bar MyMenu truncate]  '("Truncate em" . toggle-truncate-lines))
Tagged with:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: