GNU bug report logs - #3394
23.0.94; define-derived-mode keymap inheritance

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Tue, 26 May 2009 22:20:03 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3394 in the body.
You can then email your comments to 3394 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3394; Package emacs. (Tue, 26 May 2009 22:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 26 May 2009 22:20:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <emacs-pretest-bug <at> gnu.org>
Subject: 23.0.94; define-derived-mode keymap inheritance
Date: Tue, 26 May 2009 15:11:04 -0700
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)'
 




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Wed, 27 May 2009 02:55:06 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Wed, 27 May 2009 02:55:06 GMT) Full text and rfc822 format available.

Message #10 received at 3394-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 3394-done <at> debbugs.gnu.org
Subject: Re: bug#3394: 23.0.94; define-derived-mode keymap inheritance
Date: Tue, 26 May 2009 22:47:33 -0400
> 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



Message #11 received at 3394-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: <3394-done <at> debbugs.gnu.org>
Subject: RE: bug#3394: 23.0.94; define-derived-mode keymap inheritance
Date: Tue, 26 May 2009 23:13:07 -0700
> > 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.
> 
> 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.

OK, I see. I was thinking that define-derived-mode wasn't defined in Emacs 20
(should have checked), and that it was just byte-compiled as an unknown
function. Sorry for the noise.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Wed, 24 Jun 2009 14:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 363 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.