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: Thu, 07 Mar 2013 15:14:08 +0100 Message-ID: <876213paa7.fsf@rosalinde.fritz.box> References: <51367405.8080403@mousecar.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1362665721 16820 80.91.229.3 (7 Mar 2013 14:15:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Mar 2013 14:15:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 07 15:15:46 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 1UDbbl-0006vc-8C for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Mar 2013 15:15:45 +0100 Original-Received: from localhost ([::1]:46183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDbbP-0002ow-D1 for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Mar 2013 09:15:23 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDbaX-00020t-1K for help-gnu-emacs@gnu.org; Thu, 07 Mar 2013 09:14:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDbaT-0005o6-JP for help-gnu-emacs@gnu.org; Thu, 07 Mar 2013 09:14:28 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:51972) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDbaT-0005nu-CZ for help-gnu-emacs@gnu.org; Thu, 07 Mar 2013 09:14:25 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UDbak-0005gP-PD for help-gnu-emacs@gnu.org; Thu, 07 Mar 2013 15:14:42 +0100 Original-Received: from i59f575f5.versanet.de ([89.245.117.245]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 07 Mar 2013 15:14:42 +0100 Original-Received: from stephen.berman by i59f575f5.versanet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 07 Mar 2013 15:14:42 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 50 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: i59f575f5.versanet.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:89409 Archived-At: On Tue, 05 Mar 2013 17:39:01 -0500 ken wrote: > Trying to create a sub-menu under "Edit". Got part of the way there, but > still missing something. > > (define-key menu-bar-edit-menu [insert-xascii-chars] > '(menu-item "Insert non-ASCII characters" xascii > > (xascii "\C-xaa" "ä" "ä` (ä)" ("ä")) > (xascii "\C-xaA" "Ä" "Ä` (Ä)" ("Ä")) > (xascii "\C-xao" "ö" "ö` (ö)" ("ö")) > (xascii "\C-xaO" "Ö" "Ö` (Ö)" ("Ö")) > (xascii "\C-xau" "ü" "ü` (ü)" ("ü")) > (xascii "\C-xaU" "Ü" "Ü` (Ü)" ("Ü")) > (xascii "\C-xas" "ß" "ß` (ß)" ("ß")) > (xascii "\C-xa<" "«" "«` («)" ("«")) > (xascii "\C-xa>" "»" "»` (»)" ("»")))) > > Above yields error: > Debugger entered--Lisp error: (wrong-type-argument arrayp xascii) When I evaluate it in a recent Emacs build from the bzr trunk, I get no error. But instead of adding a submenu to the Edit menu, it just adds the entry "Insert non-ASCII characters" (when I click on that entry, it tries to execute the xascii command, and since I have that, I get "Lisp error: (void-function xascii)"). 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