* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103075: * lisp/simple.el (special-mode-map): Bind "h" to `describe-mode';
[not found] <E1PkOY4-0004kL-CR@internal.in.savannah.gnu.org>
@ 2011-02-05 19:24 ` Stefan Monnier
2011-02-06 0:22 ` Sam Steingold
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-02-05 19:24 UTC (permalink / raw)
To: Sam Steingold; +Cc: emacs-devel
> -(defvar bookmark-bmenu-mode-map
> - (let ((map (make-keymap)))
[...]
> +(define-key bookmark-bmenu-mode-map "q" 'quit-window)
> +(define-key bookmark-bmenu-mode-map "v" 'bookmark-bmenu-select)
This change, along with other similar ones you made in the above commit
is wrong. Keymaps need to be defined within their `defvar'.
The use of define-derived-mode makes no difference to it.
You'll see various "move initialization into declaration" messages in
the ChangeLog showing that we have been working to move things into the
defvars rather than out of it.
Can you please fix those changes (don't just revert it, of course: the
use special-mode is right, but leave the various "defvar foo-mode-map"
and keep the define-key calls within those defvars)?
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103075: * lisp/simple.el (special-mode-map): Bind "h" to `describe-mode';
2011-02-05 19:24 ` [Emacs-diffs] /srv/bzr/emacs/trunk r103075: * lisp/simple.el (special-mode-map): Bind "h" to `describe-mode'; Stefan Monnier
@ 2011-02-06 0:22 ` Sam Steingold
2011-02-07 15:15 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Sam Steingold @ 2011-02-06 0:22 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
> * Stefan Monnier <zbaavre@veb.hzbagerny.pn> [2011-02-05 14:24:57 -0500]:
>
>> -(defvar bookmark-bmenu-mode-map
>> - (let ((map (make-keymap)))
> [...]
>> +(define-key bookmark-bmenu-mode-map "q" 'quit-window)
>> +(define-key bookmark-bmenu-mode-map "v" 'bookmark-bmenu-select)
>
> This change, along with other similar ones you made in the above commit
> is wrong. Keymaps need to be defined within their `defvar'.
> The use of define-derived-mode makes no difference to it.
I am confused.
(macroexpand '(define-derived-mode child-mode parent-mode "mode name"))
clearly shows
(defvar child-mode-map (make-sparse-keymap))
why do I need a separate defvar?
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 10.04 (lucid)
http://mideasttruth.com http://www.PetitionOnline.com/tap12009/
http://openvotingconsortium.org http://memri.org http://thereligionofpeace.com
Live Lisp and prosper.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103075: * lisp/simple.el (special-mode-map): Bind "h" to `describe-mode';
2011-02-06 0:22 ` Sam Steingold
@ 2011-02-07 15:15 ` Stefan Monnier
2011-02-20 1:50 ` Sam Steingold
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-02-07 15:15 UTC (permalink / raw)
To: emacs-devel
>> This change, along with other similar ones you made in the above commit
>> is wrong. Keymaps need to be defined within their `defvar'.
>> The use of define-derived-mode makes no difference to it.
> I am confused.
> (macroexpand '(define-derived-mode child-mode parent-mode "mode name"))
> clearly shows
> (defvar child-mode-map (make-sparse-keymap))
> why do I need a separate defvar?
Because this (defvar child-mode-map (make-sparse-keymap)) is only there
for those rare derived modes that don't bother to define their own
mode map. In 99% of the cases, this defvar will be a no-op.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103075: * lisp/simple.el (special-mode-map): Bind "h" to `describe-mode';
2011-02-07 15:15 ` Stefan Monnier
@ 2011-02-20 1:50 ` Sam Steingold
0 siblings, 0 replies; 4+ messages in thread
From: Sam Steingold @ 2011-02-20 1:50 UTC (permalink / raw)
To: emacs-devel
> * Stefan Monnier <zbaavre@veb.hzbagerny.pn> [2011-02-07 10:15:21 -0500]:
>
>>> This change, along with other similar ones you made in the above commit
>>> is wrong. Keymaps need to be defined within their `defvar'.
>>> The use of define-derived-mode makes no difference to it.
>
>> I am confused.
>> (macroexpand '(define-derived-mode child-mode parent-mode "mode name"))
>> clearly shows
>> (defvar child-mode-map (make-sparse-keymap))
>> why do I need a separate defvar?
>
> Because this (defvar child-mode-map (make-sparse-keymap)) is only there
> for those rare derived modes that don't bother to define their own
> mode map. In 99% of the cases, this defvar will be a no-op.
you probably mean "modify the mode map", not "define".
however, this still does not explain why there should be two (defvar
child-mode-map) forms in the same file.
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 10.04 (lucid)
http://jihadwatch.org http://openvotingconsortium.org
http://camera.org http://dhimmi.com http://thereligionofpeace.com
Beliefs divide, doubts unite.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-20 1:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <E1PkOY4-0004kL-CR@internal.in.savannah.gnu.org>
2011-02-05 19:24 ` [Emacs-diffs] /srv/bzr/emacs/trunk r103075: * lisp/simple.el (special-mode-map): Bind "h" to `describe-mode'; Stefan Monnier
2011-02-06 0:22 ` Sam Steingold
2011-02-07 15:15 ` Stefan Monnier
2011-02-20 1:50 ` Sam Steingold
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).