From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#12744: 24.1; key-binding and local-key-binding return invalid keymap Date: Sun, 28 Oct 2012 10:58:23 -0400 Message-ID: References: <87ip9vzwkv.fsf@tee.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1351436328 29445 80.91.229.3 (28 Oct 2012 14:58:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Oct 2012 14:58:48 +0000 (UTC) Cc: 12744-done@debbugs.gnu.org To: lennart.fricke@kabelmail.de Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 28 15:58:55 2012 Return-path: Envelope-to: geb-bug-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 1TSUKE-0006BO-Hd for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Oct 2012 15:58:54 +0100 Original-Received: from localhost ([::1]:38183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSUK6-0008QK-GX for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Oct 2012 10:58:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSUK3-0008PN-CR for bug-gnu-emacs@gnu.org; Sun, 28 Oct 2012 10:58:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TSUK2-0003Ku-3a for bug-gnu-emacs@gnu.org; Sun, 28 Oct 2012 10:58:43 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TSUK1-0003Kn-Vl for bug-gnu-emacs@gnu.org; Sun, 28 Oct 2012 10:58:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TSUMI-0007Ih-4w for bug-gnu-emacs@gnu.org; Sun, 28 Oct 2012 11:01:02 -0400 Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Oct 2012 15:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 12744 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 12744@debbugs.gnu.org, monnier@iro.umontreal.ca Original-Received: via spool by 12744-done@debbugs.gnu.org id=D12744.135143645028043 (code D ref 12744); Sun, 28 Oct 2012 15:01:01 +0000 Original-Received: (at 12744-done) by debbugs.gnu.org; 28 Oct 2012 15:00:50 +0000 Original-Received: from localhost ([127.0.0.1]:36723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TSUM5-0007IF-VB for submit@debbugs.gnu.org; Sun, 28 Oct 2012 11:00:50 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:25243) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TSUM2-0007I7-Km for 12744-done@debbugs.gnu.org; Sun, 28 Oct 2012 11:00:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu0/O+LET/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA03iAADBgW6CYoahioDkHCSQ4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="203019715" Original-Received: from 206-248-177-19.dsl.teksavvy.com (HELO pastel.home) ([206.248.177.19]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 Oct 2012 10:58:24 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 4DCAE59415; Sun, 28 Oct 2012 10:58:23 -0400 (EDT) In-Reply-To: <87ip9vzwkv.fsf@tee.lan> (lennart fricke's message of "Sat, 27 Oct 2012 18:52:32 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:66131 Archived-At: > It seems to me. That (key-binding [menu-bar]) returns a wrong keymap. > It starts with a nested keymap: > (keymap (keymap (keymap (show . undefined) (hide . undefined) (headings > .. undefined) (Org menu-item "Org" ...) (Tbl menu-item "Tbl" ...)) keymap > (headings... > But there's nothing about that nesting in the docs. Indeed, it's missing from the docs. This is a new format added in Emacs-24 (used in `make-composed-keymap'). Any keymap that appears as above within a keymap is treated as a kind of additional parent, as if it were "inlined" where it appears. > When the buffer is in org-mode and i trigger tmm-menubar neither the Org > nor the Tbl menu are in the list. Indeed, it looks like the tmm-menubar needs some updating as well, thanks for spotting this. I've installed the patch below which should fix those problems. Stefan === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-27 09:54:04 +0000 +++ lisp/ChangeLog 2012-10-28 14:54:26 +0000 @@ -1,3 +1,7 @@ +2012-10-28 Stefan Monnier + + * tmm.el (tmm-prompt): Use map-keymap (bug#12744). + 2012-10-27 Eli Zaretskii * profiler.el (profiler-report-make-entry-part): Fix help-echo === modified file 'lisp/tmm.el' --- lisp/tmm.el 2012-06-07 16:35:00 +0000 +++ lisp/tmm.el 2012-10-28 14:38:38 +0000 @@ -165,13 +165,15 @@ ;; tmm-km-list is an alist of (STRING . MEANING). ;; It has no other elements. ;; The order of elements in tmm-km-list is the order of the menu bar. + (if (not not-menu) + (map-keymap (lambda (k v) (tmm-get-keymap (cons k v))) menu) (dolist (elt menu) (cond ((stringp elt) (setq gl-str elt)) ((listp elt) (tmm-get-keymap elt not-menu)) ((vectorp elt) (dotimes (i (length elt)) - (tmm-get-keymap (cons i (aref elt i)) not-menu))))) + (tmm-get-keymap (cons i (aref elt i)) not-menu)))))) ;; Choose an element of tmm-km-list; put it in choice. (if (and not-menu (= 1 (length tmm-km-list))) ;; If this is the top-level of an x-popup-menu menu, @@ -463,9 +465,10 @@ (and (stringp (car elt)) (setq str (car elt)))) ((stringp event) ; x-popup or x-popup element - (if (or in-x-menu (stringp (car-safe elt))) - (setq str event event nil km elt) - (setq str event event nil km (cons 'keymap elt))))) + (setq str event) + (setq event nil) + (setq km (if (or in-x-menu (stringp (car-safe elt))) + elt (cons 'keymap elt))))) (unless (or (eq km 'ignore) (null str)) (let ((binding (where-is-internal km nil t))) (when binding === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-10-28 12:56:15 +0000 +++ doc/lispref/ChangeLog 2012-10-28 14:54:03 +0000 @@ -1,3 +1,8 @@ +2012-10-28 Stefan Monnier + + * keymaps.texi (Format of Keymaps): Document the multiple + inheritance format. + 2012-10-28 Martin Rudalics * windows.texi (Basic Windows): Reformulate description of live, === modified file 'doc/lispref/keymaps.texi' --- doc/lispref/keymaps.texi 2012-10-24 03:48:50 +0000 +++ doc/lispref/keymaps.texi 2012-10-28 14:55:42 +0000 @@ -210,6 +210,11 @@ have a string as an element. This is called the @dfn{overall prompt string} and makes it possible to use the keymap as a menu. @xref{Defining Menus}. + +@item (keymap @dots{}) +If an element of a keymap is itself a keymap, it counts as if this inner keymap +were inlined in the outer keymap. This is used for multiple-inheritance, such +as in @code{make-composed-keymap}. @end table When the binding is @code{nil}, it doesn't constitute a definition