From: Marcin Borkowski <mbork@mbork.pl>
To: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: How to define a prefixed map for a minor mode?
Date: Sun, 07 Jun 2020 08:50:48 +0200 [thread overview]
Message-ID: <87h7vnmks7.fsf@mbork.pl> (raw)
Hi all,
continuing my work on a (simplistic) Emacs CAT, I want to define a minor
mode. However, I'm stuck on defining its keymap. I want all the
commands prefixed by e.g. `C-c .', and here's what I have:
--8<---------------cut here---------------start------------->8---
(setq ecat-basic-map (make-sparse-keymap))
(define-key ecat-basic-map (kbd "p") #'ecat-highlight-previous-sentence)
(define-key ecat-basic-map (kbd "n") #'ecat-highlight-next-sentence)
(define-key ecat-basic-map (kbd ".") #'ecat-highlight-this-sentence)
(easy-mmode-defmap ecat-mode-map
`(((kbd "C-c .") . ecat-basic-map))
"Keymap for `ecat-mode'.")
(define-minor-mode ecat-mode
"Toggle Emacs CAT mode."
:lighter " CAT"
:keymap ecat-mode-map
(if ecat-mode
(ecat-highlight-this-sentence)
(delete-overlay ecat-sentence-overlay)))
--8<---------------cut here---------------end--------------->8---
Alas, this does not seem to work - after pressing `C-c .' (when the mode
is one!) I get "C-c . is undefined".
What am I doing wrong? Is there a "canonical" method of defining
a minor mode whose bindings start with some prefix?
TIA,
--
Marcin Borkowski
http://mbork.pl
next reply other threads:[~2020-06-07 6:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-07 6:50 Marcin Borkowski [this message]
2020-06-07 7:54 ` How to define a prefixed map for a minor mode? Jamie Beardslee
2020-06-07 20:45 ` Marcin Borkowski
2020-06-07 7:59 ` Michael Heerdegen
2020-06-07 8:16 ` Michael Heerdegen
2020-06-07 20:45 ` Marcin Borkowski
2020-06-08 11:23 ` Michael Heerdegen
2020-06-07 20:44 ` Marcin Borkowski
2020-06-07 10:18 ` Joost Kremers
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=87h7vnmks7.fsf@mbork.pl \
--to=mbork@mbork.pl \
--cc=help-gnu-emacs@gnu.org \
/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.
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).