From unknown Sun Jun 22 08:08:00 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#3394: 23.0.94; define-derived-mode keymap inheritance Reply-To: "Drew Adams" , 3394@debbugs.gnu.org Resent-From: "Drew Adams" Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 26 May 2009 22:20:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: report 3394 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.124337585215574 (code B ref -1); Tue, 26 May 2009 22:20:03 +0000 Received: (at submit) by emacsbugs.donarmstrong.com; 26 May 2009 22:10:52 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.3 required=4.0 tests=AWL,FOURLA autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n4QMAlFA015569 for ; Tue, 26 May 2009 15:10:48 -0700 Received: from mail.gnu.org ([199.232.76.166]:57316 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1M94r8-0002AP-QK for emacs-pretest-bug@gnu.org; Tue, 26 May 2009 18:10:46 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1M94r7-0001M9-6E for emacs-pretest-bug@gnu.org; Tue, 26 May 2009 18:10:46 -0400 Received: from rcsinet12.oracle.com ([148.87.113.124]:50821 helo=rgminet12.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M94r6-0001M1-P0 for emacs-pretest-bug@gnu.org; Tue, 26 May 2009 18:10:45 -0400 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rgminet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n4QMAV7h014856 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 26 May 2009 22:10:33 GMT Received: from abhmt002.oracle.com (abhmt002.oracle.com [141.146.116.11]) by acsinet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n4QMBS6x032274 for ; Tue, 26 May 2009 22:11:28 GMT Received: from dradamslap1 (/141.144.90.50) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 26 May 2009 15:10:39 -0700 From: "Drew Adams" To: Date: Tue, 26 May 2009 15:11:04 -0700 Message-ID: <8F6FFAD957084AFF895F4896DA0D124C@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: AcneTtytWXeZPjJOTJiuj96/x6wgGg== X-Source-IP: abhmt002.oracle.com [141.146.116.11] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090204.4A1C68E0.00A4:SCFSTAT5015188,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) Reporting this as a bug just in case it is. I don't know. I have a file that requires `buff-menu.el', then does this, to redefine `Buffer-menu-mode'. (when (> emacs-major-version 22) (put 'Buffer-menu-mode 'mode-class 'special) (define-derived-mode Buffer-menu-mode special-mode "Buffer Menu" "..." (set (make-local-variable 'revert-buffer-function) 'Buffer-menu-revert-function) (set (make-local-variable 'buffer-stale-function) #'(lambda (&optional noconfirm) 'fast)) (setq truncate-lines t) (setq buffer-read-only t))) That definition is actually identical to the original definition in buff-menu.el. (In reality, my code adds a bit to the original definition, but the problem occurs also with just the code above. If I byte-compile the file in Emacs 22 or 23, which have `define-derived-mode', then there is no problem. (Likewise, if I load the *.el file instead of the *.elc.) If I byte-compile in Emacs 20 (which does not have `define-derived-mode'), then everything still works as usual, except for one thing: The keymap for `special-mode' is apparently not inherited. So for example, `q' and `g' have no key bindings in the *Buffer List*. By eyeballing it, the *.elc file would seem to be picking up the `define-derived-mode' code as if it were a top-level function call, which is what I would expect. I assume that the macro is defined when the *.elc is loaded, so I would expect that `define-derived-mode' would do its thing normally when the *.elc is loaded. I know that there is no guarantee (quite the opposite) that code byte-compiled in Emacs 20 will work in Emacs 23. But I wonder if there might be a bug here anyway, wrt the keymap inheritance. If not, OK. In that case, I'm just a bit curious what's happening - why everything else seems to work fine, but the `special-mode' keymap doesn't seem to be inherited. In GNU Emacs 23.0.94.1 (i386-mingw-nt5.1.2600) of 2009-05-24 on SOFT-MJASON Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (3.4)' From unknown Sun Jun 22 08:08:00 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: owner@emacsbugs.donarmstrong.com From: help-debbugs@gnu.org (Emacs bug Tracking System) To: "Drew Adams" Subject: bug#3394 closed by Stefan Monnier (Re: bug#3394: 23.0.94; define-derived-mode keymap inheritance) Message-ID: References: <8F6FFAD957084AFF895F4896DA0D124C@us.oracle.com> X-Emacs-PR-Message: they-closed 3394 X-Emacs-PR-Package: emacs Reply-To: 3394@debbugs.gnu.org Date: Wed, 27 May 2009 02:55:06 +0000 Content-Type: multipart/mixed; boundary="----------=_1243392906-22751-1" This is a multi-part message in MIME format... ------------=_1243392906-22751-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is an automatic notification regarding your bug report which was filed against the emacs package: #3394: 23.0.94; define-derived-mode keymap inheritance It has been closed by Stefan Monnier . Their explanation is attached below along with your original report. If this explanation is unsatisfactory and you have not received a better one in a separate message then please contact Stefan Monnier by replying to this email. --=20 3394: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D3394 Emacs Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1243392906-22751-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 3394-done) by emacsbugs.donarmstrong.com; 27 May 2009 02:47:45 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.7 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.teksavvy.com (ironport2-out.teksavvy.com [206.248.154.182]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n4R2ld5A022022 for <3394-done@emacsbugs.donarmstrong.com>; Tue, 26 May 2009 19:47:40 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AokFAL9GHErO+JxR/2dsb2JhbACBT8xPhAsFhX0 X-IronPort-AV: E=Sophos;i="4.41,256,1241409600"; d="scan'208";a="39153362" Received: from 206-248-156-81.dsl.teksavvy.com (HELO pastel.home) ([206.248.156.81]) by ironport2-out.teksavvy.com with ESMTP; 26 May 2009 22:47:33 -0400 Received: by pastel.home (Postfix, from userid 20848) id 50BC884B6; Tue, 26 May 2009 22:47:33 -0400 (EDT) From: Stefan Monnier To: Drew Adams Cc: 3394-done@debbugs.gnu.org Subject: Re: bug#3394: 23.0.94; define-derived-mode keymap inheritance Message-ID: References: <8F6FFAD957084AFF895F4896DA0D124C@us.oracle.com> Date: Tue, 26 May 2009 22:47:33 -0400 In-Reply-To: <8F6FFAD957084AFF895F4896DA0D124C@us.oracle.com> (Drew Adams's message of "Tue, 26 May 2009 15:11:04 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > I know that there is no guarantee (quite the opposite) that code > byte-compiled in Emacs 20 will work in Emacs 23. But I wonder if there > might be a bug here anyway, wrt the keymap inheritance. If not, OK. In Well, yes, there was a bug in Emacs-20's implementation of define-derived-mode. Not much we can do about it, I'm afraid. Stefan ------------=_1243392906-22751-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by emacsbugs.donarmstrong.com; 26 May 2009 22:10:52 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.3 required=4.0 tests=AWL,FOURLA autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n4QMAlFA015569 for ; Tue, 26 May 2009 15:10:48 -0700 Received: from mail.gnu.org ([199.232.76.166]:57316 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1M94r8-0002AP-QK for emacs-pretest-bug@gnu.org; Tue, 26 May 2009 18:10:46 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1M94r7-0001M9-6E for emacs-pretest-bug@gnu.org; Tue, 26 May 2009 18:10:46 -0400 Received: from rcsinet12.oracle.com ([148.87.113.124]:50821 helo=rgminet12.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M94r6-0001M1-P0 for emacs-pretest-bug@gnu.org; Tue, 26 May 2009 18:10:45 -0400 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rgminet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n4QMAV7h014856 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 26 May 2009 22:10:33 GMT Received: from abhmt002.oracle.com (abhmt002.oracle.com [141.146.116.11]) by acsinet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n4QMBS6x032274 for ; Tue, 26 May 2009 22:11:28 GMT Received: from dradamslap1 (/141.144.90.50) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 26 May 2009 15:10:39 -0700 From: "Drew Adams" To: Subject: 23.0.94; define-derived-mode keymap inheritance Date: Tue, 26 May 2009 15:11:04 -0700 Message-ID: <8F6FFAD957084AFF895F4896DA0D124C@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: AcneTtytWXeZPjJOTJiuj96/x6wgGg== X-Source-IP: abhmt002.oracle.com [141.146.116.11] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090204.4A1C68E0.00A4:SCFSTAT5015188,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) Reporting this as a bug just in case it is. I don't know. I have a file that requires `buff-menu.el', then does this, to redefine `Buffer-menu-mode'. (when (> emacs-major-version 22) (put 'Buffer-menu-mode 'mode-class 'special) (define-derived-mode Buffer-menu-mode special-mode "Buffer Menu" "..." (set (make-local-variable 'revert-buffer-function) 'Buffer-menu-revert-function) (set (make-local-variable 'buffer-stale-function) #'(lambda (&optional noconfirm) 'fast)) (setq truncate-lines t) (setq buffer-read-only t))) That definition is actually identical to the original definition in buff-menu.el. (In reality, my code adds a bit to the original definition, but the problem occurs also with just the code above. If I byte-compile the file in Emacs 22 or 23, which have `define-derived-mode', then there is no problem. (Likewise, if I load the *.el file instead of the *.elc.) If I byte-compile in Emacs 20 (which does not have `define-derived-mode'), then everything still works as usual, except for one thing: The keymap for `special-mode' is apparently not inherited. So for example, `q' and `g' have no key bindings in the *Buffer List*. By eyeballing it, the *.elc file would seem to be picking up the `define-derived-mode' code as if it were a top-level function call, which is what I would expect. I assume that the macro is defined when the *.elc is loaded, so I would expect that `define-derived-mode' would do its thing normally when the *.elc is loaded. I know that there is no guarantee (quite the opposite) that code byte-compiled in Emacs 20 will work in Emacs 23. But I wonder if there might be a bug here anyway, wrt the keymap inheritance. If not, OK. In that case, I'm just a bit curious what's happening - why everything else seems to work fine, but the `special-mode' keymap doesn't seem to be inherited. In GNU Emacs 23.0.94.1 (i386-mingw-nt5.1.2600) of 2009-05-24 on SOFT-MJASON Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (3.4)' ------------=_1243392906-22751-1--