diff options
| author | Lars Ingebrigtsen | 2021-10-04 12:33:53 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-10-04 12:33:53 +0200 |
| commit | 069749bed7ab1587f0cfbadb5924c80d7ee49ac9 (patch) | |
| tree | fc65579a870091bbd7efdcd18e4a71cdf1a0cbe3 /src | |
| parent | 39d9b96a606d1c605c329a6c7d1dab6afbd3b824 (diff) | |
| download | emacs-069749bed7ab1587f0cfbadb5924c80d7ee49ac9.tar.gz emacs-069749bed7ab1587f0cfbadb5924c80d7ee49ac9.zip | |
Add new user option 'translate-upper-case-key-bindings'
* doc/lispref/commands.texi (Key Sequence Input): Document it.
* lisp/cus-start.el (standard): defcustom it.
* src/keyboard.c (read_key_sequence): Use it.
(syms_of_keyboard): New variable 'translate-upper-case-key-bindings'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index bc6f97586dd..4f3232dc46c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -10168,7 +10168,8 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, | |||
| 10168 | use the corresponding lower-case letter instead. */ | 10168 | use the corresponding lower-case letter instead. */ |
| 10169 | if (NILP (current_binding) | 10169 | if (NILP (current_binding) |
| 10170 | && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t | 10170 | && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t |
| 10171 | && FIXNUMP (key)) | 10171 | && FIXNUMP (key) |
| 10172 | && translate_upper_case_key_bindings) | ||
| 10172 | { | 10173 | { |
| 10173 | Lisp_Object new_key; | 10174 | Lisp_Object new_key; |
| 10174 | EMACS_INT k = XFIXNUM (key); | 10175 | EMACS_INT k = XFIXNUM (key); |
| @@ -10220,12 +10221,14 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, | |||
| 10220 | int modifiers | 10221 | int modifiers |
| 10221 | = CONSP (breakdown) ? (XFIXNUM (XCAR (XCDR (breakdown)))) : 0; | 10222 | = CONSP (breakdown) ? (XFIXNUM (XCAR (XCDR (breakdown)))) : 0; |
| 10222 | 10223 | ||
| 10223 | if (modifiers & shift_modifier | 10224 | if (translate_upper_case_key_bindings |
| 10224 | /* Treat uppercase keys as shifted. */ | 10225 | && (modifiers & shift_modifier |
| 10225 | || (FIXNUMP (key) | 10226 | /* Treat uppercase keys as shifted. */ |
| 10226 | && (KEY_TO_CHAR (key) | 10227 | || (FIXNUMP (key) |
| 10227 | < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->header.size) | 10228 | && (KEY_TO_CHAR (key) |
| 10228 | && uppercasep (KEY_TO_CHAR (key)))) | 10229 | < XCHAR_TABLE (BVAR (current_buffer, |
| 10230 | downcase_table))->header.size) | ||
| 10231 | && uppercasep (KEY_TO_CHAR (key))))) | ||
| 10229 | { | 10232 | { |
| 10230 | Lisp_Object new_key | 10233 | Lisp_Object new_key |
| 10231 | = (modifiers & shift_modifier | 10234 | = (modifiers & shift_modifier |
| @@ -12495,6 +12498,16 @@ If nil, Emacs crashes immediately in response to fatal signals. */); | |||
| 12495 | Vwhile_no_input_ignore_events, | 12498 | Vwhile_no_input_ignore_events, |
| 12496 | doc: /* Ignored events from while-no-input. */); | 12499 | doc: /* Ignored events from while-no-input. */); |
| 12497 | 12500 | ||
| 12501 | DEFVAR_BOOL ("translate-upper-case-key-bindings", | ||
| 12502 | translate_upper_case_key_bindings, | ||
| 12503 | doc: /* If non-nil, interpret upper case keys as lower case (when applicable). | ||
| 12504 | Emacs allows binding both upper and lower case key sequences to | ||
| 12505 | commands. However, if there is a lower case key sequence bound to a | ||
| 12506 | command, and the user enters an upper case key sequence that is not | ||
| 12507 | bound to a command, Emacs will use the lower case binding. Setting | ||
| 12508 | this variable to nil inhibits this behaviour. */); | ||
| 12509 | translate_upper_case_key_bindings = true; | ||
| 12510 | |||
| 12498 | pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper); | 12511 | pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper); |
| 12499 | } | 12512 | } |
| 12500 | 12513 | ||