* Where do you add key bindings for a mode made with define-derived-mode
@ 2010-12-29 13:28 Lennart Borgman
2010-12-29 13:41 ` Leo
2010-12-29 15:43 ` Stefan Monnier
0 siblings, 2 replies; 4+ messages in thread
From: Lennart Borgman @ 2010-12-29 13:28 UTC (permalink / raw)
To: Emacs-Devel devel
Do you do that after the defining the major mode (i.e. when loading
the library where it is defined) or is there another way?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Where do you add key bindings for a mode made with define-derived-mode
2010-12-29 13:28 Where do you add key bindings for a mode made with define-derived-mode Lennart Borgman
@ 2010-12-29 13:41 ` Leo
2010-12-29 15:43 ` Stefan Monnier
1 sibling, 0 replies; 4+ messages in thread
From: Leo @ 2010-12-29 13:41 UTC (permalink / raw)
To: emacs-devel
On 2010-12-29 13:28 +0000, Lennart Borgman wrote:
> Do you do that after the defining the major mode (i.e. when loading
> the library where it is defined) or is there another way?
It think it is up to you.
define-derived-mode uses
(defvar some-major-mode-map (make-sparse-keymap))
Leo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Where do you add key bindings for a mode made with define-derived-mode
2010-12-29 13:28 Where do you add key bindings for a mode made with define-derived-mode Lennart Borgman
2010-12-29 13:41 ` Leo
@ 2010-12-29 15:43 ` Stefan Monnier
2010-12-29 18:38 ` Lennart Borgman
1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2010-12-29 15:43 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Emacs-Devel devel
> Do you do that after the defining the major mode (i.e. when loading
> the library where it is defined) or is there another way?
The usual way:
(defvar foo-mode-map
(let ((map (make-sparse-keymap)))
(define-key map foo bar)
map))
(define-derived-mode foo-mode ...)
Tho, maybe I simply misunderstood your question.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Where do you add key bindings for a mode made with define-derived-mode
2010-12-29 15:43 ` Stefan Monnier
@ 2010-12-29 18:38 ` Lennart Borgman
0 siblings, 0 replies; 4+ messages in thread
From: Lennart Borgman @ 2010-12-29 18:38 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs-Devel devel
On Wed, Dec 29, 2010 at 4:43 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> Do you do that after the defining the major mode (i.e. when loading
>> the library where it is defined) or is there another way?
>
> The usual way:
>
> (defvar foo-mode-map
> (let ((map (make-sparse-keymap)))
> (define-key map foo bar)
> map))
>
> (define-derived-mode foo-mode ...)
>
> Tho, maybe I simply misunderstood your question.
No, you did not but I seem to misunderstand something. Why does that
work? In the code for define-derived-mode there is:
(defvar ,map (make-sparse-keymap))
Oh, wait! That is what always has surprised me. This statement does
not do anything when the variable is defined...
Hm, thanks, back to the code I wrote long ago. Now I have one thing
less to look at. But I still can't see how (provide 'nxml-mode) can be
passed without nxml-mode-map being defined. I will have to dig a bit.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-29 18:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-29 13:28 Where do you add key bindings for a mode made with define-derived-mode Lennart Borgman
2010-12-29 13:41 ` Leo
2010-12-29 15:43 ` Stefan Monnier
2010-12-29 18:38 ` Lennart Borgman
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).