From: ken <gebser@mousecar.com>
To: GNU Emacs List <help-gnu-emacs@gnu.org>
Subject: Creating submenu
Date: Sun, 29 Nov 2009 18:50:10 -0500 [thread overview]
Message-ID: <4B1308B2.6090809@mousecar.com> (raw)
I'm trying to create a submenu (under Edit) for inserting non-English
characters. I'd like this submenu to show keybindings as well... to
serve as reminders so I don't have to go to the menu all the time.
Finally, I'm defining a new prefix key, "C-c g" for the items in this
submenu. I'd like this submenu to be operative in all major modes that
I'd be editing in.
Actually, after reading a few chapters in the elisp manual and examining
existing elisp code, I have come up with code that is working, but it
has some undesirable side-effects. Here's what I have:
------------------------------------------------------------------
;Make ^C-cg a key prefix for chars menu
(global-set-key [?\C-c ?g] ctl-x-map)
;;Need this definition, else the main "define-key ..." below it errors.
(defvar menu-bar-chars-menu (make-sparse-keymap "chars"))
;This puts the "European chars" item into the "Edit" menu.
;;Function definition: (define-key keymap key def)
(define-key menu-bar-edit-menu [chars]
(list 'menu-item "Insert European chars" menu-bar-chars-menu))
;Menu item: list all UTF-8 chars
(fset 'list-all-chars [?\C-x ?8 f1])
(global-set-key [?\C-c ?g ?0] 'list-all-chars)
(define-key menu-bar-chars-menu [listall]
'(menu-item "List all UTF-8 chars" list-all-chars))
------------------------------------------------------------------
The last stanza pretty much repeats for characters which are inserted.
And the above works fine except:
In the menu the keybinding displayed is not "C-x g 0", but rather "C-x
0" and...
While "C-x g 0" works as intended and does display the listing of UTF-8
characters, so does the displayed "C-x 0"... i.e., it has replaced the
former keybinding of "C-x 0"... not good. So I'm guess there's some
error in the way I've established keybindings with the new prefix.
Thanks much for your cordial assistance.
--
Without music, life would be a mistake.
--Friedrich Nietzsche
next reply other threads:[~2009-11-29 23:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-29 23:50 ken [this message]
[not found] <mailman.11799.1259538618.2239.help-gnu-emacs@gnu.org>
2009-11-30 0:05 ` Creating submenu Joost Kremers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B1308B2.6090809@mousecar.com \
--to=gebser@mousecar.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).