[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: creating a sub-menu
From: |
Stephen Berman |
Subject: |
Re: creating a sub-menu |
Date: |
Thu, 07 Mar 2013 15:14:08 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
On Tue, 05 Mar 2013 17:39:01 -0500 ken <gebser@mousecar.com> wrote:
> Trying to create a sub-menu under "Edit". Got part of the way there, but
> still missing something.
>
> (define-key menu-bar-edit-menu [insert-xascii-chars]
> '(menu-item "Insert non-ASCII characters" xascii
>
> (xascii "\C-xaa" "ä" "ä` (ä)" ("ä"))
> (xascii "\C-xaA" "Ä" "Ä` (Ä)" ("Ä"))
> (xascii "\C-xao" "ö" "ö` (ö)" ("ö"))
> (xascii "\C-xaO" "Ö" "Ö` (Ö)" ("Ö"))
> (xascii "\C-xau" "ü" "ü` (ü)" ("ü"))
> (xascii "\C-xaU" "Ü" "Ü` (Ü)" ("Ü"))
> (xascii "\C-xas" "ß" "ß` (ß)" ("ß"))
> (xascii "\C-xa<" "«" "«` («)" ("«"))
> (xascii "\C-xa>" "»" "»` (»)" ("»"))))
>
> Above yields error:
> Debugger entered--Lisp error: (wrong-type-argument arrayp xascii)
When I evaluate it in a recent Emacs build from the bzr trunk, I get no
error. But instead of adding a submenu to the Edit menu, it just adds
the entry "Insert non-ASCII characters" (when I click on that entry, it
tries to execute the xascii command, and since I have that, I get "Lisp
error: (void-function xascii)"). If you want a submenu, then instead of
a command name, the third item in your menu-item list should be a
(variable whose value is a) keymap defining the menu items of the
submenu, e.g., something like the following:
(defun kg-insert-ä ()
(interactive)
(insert "ä"))
(defun kg-insert-Ä ()
(interactive)
(insert "Ä"))
(defvar xascii-menu
(let ((menu (make-sparse-keymap "Insert non-ASCII characters")))
(define-key menu [kg-insert-Ä]
'(menu-item "Insert `Ä'" kg-insert-Ä :keys "C-x a A"))
(define-key menu [kg-insert-ä]
'(menu-item "Insert `ä'" kg-insert-ä :keys "C-x a a"))
menu))
(define-key menu-bar-edit-menu [xascii-menu]
`(menu-item "Insert non-ASCII characters" ,xascii-menu))
Steve Berman
- Re: creating a sub-menu, Joost Kremers, 2013/03/05
- Re: creating a sub-menu, ken, 2013/03/06
- Message not available
- Re: creating a sub-menu, Joost Kremers, 2013/03/06
- OT w/ misunderstanding Re: creating a sub-menu, ken, 2013/03/07
- Message not available
- Re: OT w/ misunderstanding Re: creating a sub-menu, Joost Kremers, 2013/03/11
- Re: OT w/ misunderstanding Re: creating a sub-menu, ken, 2013/03/12
- Message not available
- Re: OT w/ misunderstanding Re: creating a sub-menu, Joost Kremers, 2013/03/13