Skip to content

Commit 59774e3

Browse files
authored
Added clarification to evil-define-key for escaping modifier keys (#1856)
* Added clarification to evil-define-key for escaping modifier keys It is useful to have clarification in the doc string for evil-define-key that it is necessary to escape modifiers keys for users that are accustomed to using functions like global-set-key or keymap-global-set where this is not necessary. This is also not made particularly clear in the define-key function itself, which is a legacy function. * Fixed poor wording and used kdb in place of escape sequence
1 parent 6ca32ca commit 59774e3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

evil-core.el

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,14 @@ the following lead to identical bindings:
958958
The symbol `local' may also be used, which corresponds to using
959959
`evil-local-set-key'. If a quoted symbol is used that is not
960960
`global' or `local', it is assumed to be the name of a minor
961-
mode, in which case `evil-define-minor-mode-key' is used."
961+
mode, in which case `evil-define-minor-mode-key' is used.
962+
963+
KEY is an internal Emacs representation of a key, as for
964+
`define-key'. To bind key sequences that use modifier keys such
965+
as \"C-a\" or \"M-a\", convert the key sequences using `kbd'.
966+
For example:
967+
968+
(evil-define-key \\='normal foo-map (kbd \"C-a\") \\='bar)"
962969
(declare (indent defun))
963970
(cond
964971
((member keymap '('global 'local))

0 commit comments

Comments
 (0)