From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.devel Subject: Creating submenu Date: Wed, 02 Dec 2009 08:02:43 -0500 Message-ID: <4B166573.4030609@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 1259777075 5088 80.91.229.12 (2 Dec 2009 18:04:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Dec 2009 18:04:35 +0000 (UTC) To: emacs-bug Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 02 19:04:29 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NFtYz-00055L-5B for ged-emacs-devel@m.gmane.org; Wed, 02 Dec 2009 19:04:29 +0100 Original-Received: from localhost ([127.0.0.1]:43043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFtYy-0000Rq-To for ged-emacs-devel@m.gmane.org; Wed, 02 Dec 2009 13:04:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFor7-0006o2-3P for emacs-devel@gnu.org; Wed, 02 Dec 2009 08:02:53 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFor5-0006nC-7u for emacs-devel@gnu.org; Wed, 02 Dec 2009 08:02:52 -0500 Original-Received: from [199.232.76.173] (port=51168 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFor4-0006n0-PY for emacs-devel@gnu.org; Wed, 02 Dec 2009 08:02:50 -0500 Original-Received: from mout.perfora.net ([74.208.4.195]:55799) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFor4-0000gm-Eb for emacs-devel@gnu.org; Wed, 02 Dec 2009 08:02:50 -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 0MDRHZ-1NLa0G1aRh-00GpPj; Wed, 02 Dec 2009 08:02:46 -0500 User-Agent: Thunderbird 2.0.0.22 (X11/20090625) X-Enigmail-Version: 0.96.0 OpenPGP: id=5AD091E7 X-Provags-ID: V01U2FsdGVkX1/UisGfwvM7g6SL+4tuEhS6H3nb8hiiV88nIIp 23s/f1bZ3eoY67vdDMftvYJyqagBFe0WiWoTn4tG1YVz7KLB4W n8AKYlOAwZSn943Pj0U82qjew2yjaJN X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-Mailman-Approved-At: Wed, 02 Dec 2009 12:31:36 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118139 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