From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Creating submenu Date: Sun, 29 Nov 2009 18:50:10 -0500 Message-ID: <4B1308B2.6090809@mousecar.com> Reply-To: gebser@mousecar.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1259538647 560 80.91.229.12 (29 Nov 2009 23:50:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 29 Nov 2009 23:50:47 +0000 (UTC) To: GNU Emacs List Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 30 00:50:41 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NEtXK-00041p-Q9 for geh-help-gnu-emacs@m.gmane.org; Mon, 30 Nov 2009 00:50:39 +0100 Original-Received: from localhost ([127.0.0.1]:55466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NEtXK-0003xz-HP for geh-help-gnu-emacs@m.gmane.org; Sun, 29 Nov 2009 18:50:38 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NEtWz-0003xu-Hn for help-gnu-emacs@gnu.org; Sun, 29 Nov 2009 18:50:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NEtWx-0003xS-0c for help-gnu-emacs@gnu.org; Sun, 29 Nov 2009 18:50:16 -0500 Original-Received: from [199.232.76.173] (port=42918 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NEtWw-0003xP-S2 for help-gnu-emacs@gnu.org; Sun, 29 Nov 2009 18:50:14 -0500 Original-Received: from mout.perfora.net ([74.208.4.195]:55911) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NEtWw-0008Fm-Gb for help-gnu-emacs@gnu.org; Sun, 29 Nov 2009 18:50:14 -0500 Original-Received: from dellap.mousecar.net (dsl093-011-017.cle1.dsl.speakeasy.net [66.93.11.17]) by mrelay.perfora.net (node=mrus0) with ESMTP (Nemesis) id 0MYyJH-1NaBxQ2gvD-00Vkmq; Sun, 29 Nov 2009 18:50:13 -0500 User-Agent: Thunderbird 2.0.0.22 (X11/20090625) X-Enigmail-Version: 0.96.0 OpenPGP: id=5AD091E7 X-Provags-ID: V01U2FsdGVkX1+IHF659yqOuLk7z6xt59nBXeGl5NEZ7BbW+Dj 2kuoeeTVL0JULlqeMTDr05Za8dTcOfmWDQRbel8G2bTVZJeAh5 +PTf54tAsqJo+bM0AM3WVFkUdlM1M43 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70239 Archived-At: 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