From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: creating a sub-menu Date: Tue, 12 Mar 2013 23:22:46 +0100 Message-ID: <87d2v4uukp.fsf@rosalinde.fritz.box> References: <51367405.8080403@mousecar.com> <876213paa7.fsf@rosalinde.fritz.box> <513EDB61.9050100@mousecar.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1363127419 26195 80.91.229.3 (12 Mar 2013 22:30:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Mar 2013 22:30:19 +0000 (UTC) Cc: GNU Emacs List To: ken Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 12 23:30:43 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 1UFXiV-0006ij-DH for geh-help-gnu-emacs@m.gmane.org; Tue, 12 Mar 2013 23:30:43 +0100 Original-Received: from localhost ([::1]:39599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFXi9-0008Fs-33 for geh-help-gnu-emacs@m.gmane.org; Tue, 12 Mar 2013 18:30:21 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFXeM-0006np-Gk for help-gnu-emacs@gnu.org; Tue, 12 Mar 2013 18:30:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFXat-0008KA-Ki for help-gnu-emacs@gnu.org; Tue, 12 Mar 2013 18:26:26 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:57280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFXat-0008I2-9T for help-gnu-emacs@gnu.org; Tue, 12 Mar 2013 18:22:51 -0400 Original-Received: from mailout-de.gmx.net ([10.1.76.20]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0MEYeV-1TzqG93bNh-00FgdX for ; Tue, 12 Mar 2013 23:22:48 +0100 Original-Received: (qmail invoked by alias); 12 Mar 2013 22:22:48 -0000 Original-Received: from i59F541E2.versanet.de (EHLO rosalinde.fritz.box) [89.245.65.226] by mail.gmx.net (mp020) with SMTP; 12 Mar 2013 23:22:48 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX18+bvAG9/s+Nnw/yHIk/h0TV/4so7nbSn3rouykrC LwT3PFf23m6B5y In-Reply-To: <513EDB61.9050100@mousecar.com> (ken's message of "Tue, 12 Mar 2013 03:38:09 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.22 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:89498 Archived-At: 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-=C3=A4 () >> (interactive) >> (insert "=C3=A4")) >> >> (defun kg-insert-=C3=84 () >> (interactive) >> (insert "=C3=84")) >> >> (defvar xascii-menu >> (let ((menu (make-sparse-keymap "Insert non-ASCII characters"))) >> (define-key menu [kg-insert-=C3=84] >> '(menu-item "Insert `=C3=84'" kg-insert-=C3=84 :keys "C-x a A")) >> (define-key menu [kg-insert-=C3=A4] >> '(menu-item "Insert `=C3=A4'" kg-insert-=C3=A4 :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 disp= lays > menu items under the "Insert non-ASCII characters" heading. However, those > non-ASCII characters (e.g., `=C3=84' and `=C3=A4') don't display in the m= enu 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.=20=20 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. > Secondly, the key com= bos > (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. > But you've advanced the code over what I had and I appreciate that very m= uch. > The bit of explanation you provide is also helpful. Together with the bi= ts in > the Elisp Manual and other sources on the web, the total picture on addin= g a > sub-menu into an existing menu heading is starting to come together, thou= gh > still I'm far from being able to articulate it the way I want and would n= eed > in order to be helpful to anyone else. So I'll work on it more in whatev= er > spare moments I have. I'm sure I'll get it eventually. Good luck! Steve Berman