From: Lennart Borgman <lennart.borgman@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: Where do you add key bindings for a mode made with define-derived-mode
Date: Wed, 29 Dec 2010 19:38:13 +0100 [thread overview]
Message-ID: <AANLkTimVTV6WR+5fsVYBTNYs208q2SwuqvX+cRCAsHO4@mail.gmail.com> (raw)
In-Reply-To: <jwvk4isio13.fsf-monnier+emacs@gnu.org>
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.
prev parent reply other threads:[~2010-12-29 18:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTimVTV6WR+5fsVYBTNYs208q2SwuqvX+cRCAsHO4@mail.gmail.com \
--to=lennart.borgman@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).