From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: Format av menu keymaps Date: Tue, 10 Jan 2006 18:00:13 +0100 Message-ID: <43C3E81D.8010207@student.lu.se> References: <43C191E2.6030206@student.lu.se> <87r77ikuia.fsf-monnier+emacs@gnu.org> <43C2D976.5050302@student.lu.se> <43C2F87B.1030401@student.lu.se> <87k6d8k98r.fsf-monnier+emacs@gnu.org> <43C36D10.1050003@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1136916684 26058 80.91.229.2 (10 Jan 2006 18:11:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 Jan 2006 18:11:24 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 10 19:11:14 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EwNwh-0008O2-3Y for ged-emacs-devel@m.gmane.org; Tue, 10 Jan 2006 19:10:15 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EwNye-00042d-GH for ged-emacs-devel@m.gmane.org; Tue, 10 Jan 2006 13:12:12 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EwMtC-0007ct-5g for emacs-devel@gnu.org; Tue, 10 Jan 2006 12:02:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EwMt6-0007as-Jo for emacs-devel@gnu.org; Tue, 10 Jan 2006 12:02:27 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EwMt5-0007aF-UE for emacs-devel@gnu.org; Tue, 10 Jan 2006 12:02:24 -0500 Original-Received: from [81.228.8.83] (helo=pne-smtpout1-sn2.hy.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EwMvY-0007BE-SL for emacs-devel@gnu.org; Tue, 10 Jan 2006 12:04:57 -0500 Original-Received: from [192.168.123.121] (83.249.218.244) by pne-smtpout1-sn2.hy.skanova.net (7.2.069.1) id 43C290FB0005897A; Tue, 10 Jan 2006 18:00:14 +0100 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: Stefan Monnier , Emacs Devel In-Reply-To: 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:48910 Archived-At: Stefan Monnier wrote: > >>Do you mean something like this should work: >> >> > > > >> (let ((menu-bar-entry (lookup-key emacs-lisp-mode-map >> [menu-bar]))) >> (when menu-bar-entry >> (setq some-major t) >> (define-key map [appmenu-major] menu-bar-entry))) >> >> > >No, I men something like what I sent before: > > (map-keymap > (lambda (key command) > (define-key map > (vector (intern (concat "nxhtml-" (symbol-name key)))) > command)) > menu-bar-entry) > >Note how the `command' is left untouched rather than go through >appmenu-get-submenu and then be rebuilt with menu-item. > > Thanks very much, this works perfectly, using the value returned from lookup-key for menu-bar-entry. I thought I tried something very similar, but obviously I did not. And now the code also handles the keys with several entries in menu-bar which I just overlooked. Lesson one is that I have learned to use lookup-key (instead of fumbling with assoc). This gives less complexity and less opportunities for mistakes. And doing it the way above (without using appmenu-get-submenu) I obviously do not have to know the internal format of the submenu. So there was really no reason to ask here on this list. Sorry for disturbing here then. But I wonder why you prefer to use (vector (intern (concat "appmenu-major-" (symbol-name key)))) instead of (read (concat "[appmenu-major-" (symbol-name key) "]")) Just a matter of taste or? You mentioned some time ago that it normally was a mistake to use (read ...).