From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Re: creating a sub-menu Date: Tue, 12 Mar 2013 19:09:18 -0400 Message-ID: <513FB59E.5070906@mousecar.com> References: <51367405.8080403@mousecar.com> <876213paa7.fsf@rosalinde.fritz.box> <513EDB61.9050100@mousecar.com> <87d2v4uukp.fsf@rosalinde.fritz.box> Reply-To: gebser@mousecar.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1363129779 14784 80.91.229.3 (12 Mar 2013 23:09:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Mar 2013 23:09:39 +0000 (UTC) To: GNU Emacs List Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 13 00:10:04 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UFYKX-0003fA-VY for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Mar 2013 00:10:02 +0100 Original-Received: from localhost ([::1]:52531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFYKB-00051d-HG for geh-help-gnu-emacs@m.gmane.org; Tue, 12 Mar 2013 19:09:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFYJz-00051X-EU for help-gnu-emacs@gnu.org; Tue, 12 Mar 2013 19:09:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFYJx-0005eT-Dy for help-gnu-emacs@gnu.org; Tue, 12 Mar 2013 19:09:27 -0400 Original-Received: from mout.perfora.net ([74.208.4.195]:55264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFYJx-0005eN-8K for help-gnu-emacs@gnu.org; Tue, 12 Mar 2013 19:09:25 -0400 Original-Received: from dellap.mousecar.net (dsl093-011-016.cle1.dsl.speakeasy.net [66.93.11.16]) by mrelay.perfora.net (node=mrus1) with ESMTP (Nemesis) id 0LdGzR-1UfVCd00Zd-00iSGO; Tue, 12 Mar 2013 19:09:23 -0400 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130219 Thunderbird/17.0.3 In-Reply-To: <87d2v4uukp.fsf@rosalinde.fritz.box> X-Provags-ID: V02:K0:X3MdnBtWalelWgsia5jgE7htjyHV7uG8FrGeQTkJZM9 A6lsBoKM9aaYiW23E/Nuqr+vcZRySAwYRtAU9qhmLiiKS5c2Fc 3lQ6sLOFuSRqhdzJOk6WSSzCK9pQetNn/CpN0k1XvxMGSitn7E eWLpUR60lpc3XdKE43d9w0pgkv0/1pbBTgc5jzubxxj/xibKNJ vQFmUA1MMZQX+sysNJuiB6zDuqxcGyJCNYgxTBEDYhGO5sBeQL 7p+XdPzCT6IynOWq7es+S0MmYqLT2NnRxG4VcLFb3wP56snDng SCzRyWl9Fvj9Ee2KNmWxameQaAM1PdpUTKdesvjC59yDlpthVO te01hSeMD8hkuvg7xFcCUg8dMqvbX7LCDoikClYCf X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 74.208.4.195 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:89500 Archived-At: n 03/12/2013 06:22 PM Stephen Berman wrote: > On Tue, 12 Mar 2013 03:38:09 -0400 ken wrote: > >> On 03/07/2013 09:14 AM Stephen Berman wrote: >> >>> [...] 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 >> >> Thanks, Steve, >> >> I tried this code and it is definitely progress over mine in that it displays >> menu items under the "Insert non-ASCII characters" heading. However, those >> non-ASCII characters (e.g., `Ä' and `ä') don't display in the menu under that >> heading properly; probably owing to the menu subsystem of the emacs frame not >> handling utf-8... or 8-bit characters of any kind. > > They display fine in the menu in my Emacs. If you're using a > Unicode-capable Emacs (23 or later), they should display for you too, > unless some setting in your system, or maybe some X setting, is > preventing it. Good to know. I'll have to remember that when I eventually get around to upgrading. Until then I can use the '\xxx' (decimal) representations of them. > >> Secondly, the key combos >> (e.g., C-xaA and C-xaa) remain undefined. > > The use of :keys in a menu item is only for displaying in the menu the > string corresponding to a key binding that you have defined elsewhere, > either using global-set-key, local-set-key, or, if you only want them to > be used in a specific key map, using define-key. Alright! Didn't know that was needed, but cool, done already a lot... that's cake. > >> But you've advanced the code over what I had and I appreciate that very much. >> The bit of explanation you provide is also helpful. Together with the bits in >> the Elisp Manual and other sources on the web, the total picture on adding a >> sub-menu into an existing menu heading is starting to come together, though >> still I'm far from being able to articulate it the way I want and would need >> in order to be helpful to anyone else. So I'll work on it more in whatever >> spare moments I have. I'm sure I'll get it eventually. > > Good luck! > > Steve Berman Thanks again, Steve. Luck be with you too.