From: "Drew Adams" <drew.adams@oracle.com>
To: 13269@debbugs.gnu.org
Subject: bug#13269: 24.3.50; modifying bindings in `visual-line-mode-map' has no effect
Date: Mon, 24 Dec 2012 09:35:56 -0800 [thread overview]
Message-ID: <D9FD8184767B43D389BCCA8D11D35DB8@us.oracle.com> (raw)
OK, I assume I must be doing something wrong, but I don't know what, and
the doc does not seem to help.
`visual-line-mode' is a non-global minor mode defined using
`define-minor-mode' with a :keymap parameter.
If I redefine the keymap using `C-M-x' on a (defvar
visual-line-mode-map...), or using setq, the keymap is modified as
I would expect. C-h v shows this clearly.
But that has no effect on the key bindings in `visual-line-mode'. It
seems like variable `visual-line-mode-map' is being ignored.
Same thing if I evaluate the defvar in the same buffer as the mode
(though I don't really expect it would be a local variable, and C-h v
does not say it is local).
And toggling the mode does not change anything. When I check the keymap
itself, it is defined exactly according to my modification. But those
keys are not available in the mode itself; instead, the original key
bindings for the mode are still active.
Likewise, if instead of evaluating the defvar I use this:
(add-hook 'visual-line-mode-hook
(lambda ()
(define-key "\C-e" 'foobar)
...))
That too modifies the value of variable `visual-line-mode-map' just as I
expect, but it does not change the actual bindings available in in
visual-line mode. What am I missing?
The only thing I have found to work is to re-evaluate the
`define-minor-mode' sexp after redefining the keymap, so that the
redefinition picks up the new defvar. Obviously, that is not a reasonable
solution, e.g., for a library or user who wants to modify the key bindings.
It's as if the mode were defined once and for all using the value of the
keymap at the time of `define-minor-mode', and not defined to point to
the _variable_ `visual-line-mode-map'.
Do I have to fiddle with `minor-mode-map-alist' or something? I do not
see this problem with other minor modes, even though the value of that
alist shows that the modes are associated with actual keymaps and not
keymap variables.
BTW, the doc in (elisp) Keymaps and Minor Modes seems incomplete.
It says: "To set up a keymap for a minor mode, add an element to the
alist `minor-mode-map-alist'." That does not seem right, or at least
not complete. Using `define-minor-mode' with KEYMAP or :keymap should
also be sufficient to set up a keymap for a minor mode. For a node
that purports to cover the topic of keymaps and minor modes, this doc
seems insufficient.
(And `minor-mode-overriding-map-alist' is nil.)
Please tell me what I am missing. I doubt that there is an Emacs bug
here, but I don't know. Seems like one should be able to change a key
binding in `visual-line-mode-map' and have that take effect.
In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600)
of 2012-12-18 on MS-W7-DANI
Bzr revision: 111265 eliz@gnu.org-20121218190556-x9wmq083vwecgu0f
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
`configure --with-gcc (4.7) --no-opt --enable-checking --cflags
-Ic:/emacs/libs/libXpm-3.5.10/include -Ic:/emacs/libs/libXpm-3.5.10/src
-Ic:/emacs/libs/libpng-dev_1.4.3-1_win32/include
-Ic:/emacs/libs/zlib-dev_1.2.5-2_win32/include
-Ic:/emacs/libs/giflib-4.1.4-1-lib/include
-Ic:/emacs/libs/jpeg-6b-4-lib/include
-Ic:/emacs/libs/tiff-3.8.2-1-lib/include
-Ic:/emacs/libs/libxml2-2.7.8-w32-bin/include/libxml2
-Ic:/emacs/libs/gnutls-3.0.9-w32-bin/include
-Ic:/emacs/libs/libiconv-1.9.2-1-lib/include'
next reply other threads:[~2012-12-24 17:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-24 17:35 Drew Adams [this message]
2012-12-24 19:24 ` bug#13269: 24.3.50; modifying bindings in `visual-line-mode-map' has no effect Drew Adams
2014-02-08 13:22 ` Lars Ingebrigtsen
2014-02-10 23:56 ` Drew Adams
2016-04-28 17:42 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D9FD8184767B43D389BCCA8D11D35DB8@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=13269@debbugs.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.