summaryrefslogtreecommitdiff
path: root/lisp/keymap.el
Commit message (Collapse)AuthorAgeFilesLines
* ; * lisp/keymap.el (key-parse): Fix processing of "[TAB]". (Bug#69893)Eli Zaretskii2024-03-211-1/+1
|
* ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
|
* Make key-translate actually workShynur2023-09-181-3/+5
| | | | | * lisp/keymap.el (key-translate): Use the first element of the parsed keys rather than the whole vector. (Bug#65735)
* Add missing builtin package declarationsStefan Kangas2023-09-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * lisp/finder.el (finder--builtins-alist): Add new package directories 'leim' and 'obsolete' as part of the 'emacs' package. Add new package directory 'use-package' as part of the 'use-package' package. * lisp/net/eudc-capf.el: * lisp/net/eudcb-ecomplete.el: * lisp/net/eudcb-macos-contacts.el: * lisp/net/eudcb-mailabbrev.el: Declare library as part of the 'eudc' package. * lisp/mail/ietf-drums-date.el: Declare library as part of the 'ietf-drums' package. * lisp/image/image-dired-dired.el: * lisp/image/image-dired-external.el: * lisp/image/image-dired-tags.el: * lisp/image/image-dired-util.el: Declare library as part of the 'image-dired' package. * lisp/emacs-lisp/oclosure.el: * lisp/keymap.el: * lisp/progmodes/c-ts-common.el: Declare library as part of the 'emacs' package. (Bug#62751) (cherry picked from commit 94b1de2774b5c1fa3c28285229900657638f5c3f)
* ; Fix typos in lisp/keymap.el doc strings (bug#65329).Thomas Voss2023-08-161-2/+2
| | | | Copyright-paper-exempt: yes
* ; Improve documentation of key-binding commandsEli Zaretskii2023-07-061-20/+38
| | | | | | | | | * doc/lispref/keymaps.texi (Key Binding Commands): Improve the documentation of arguments expected by key binding commands. * lisp/keymap.el (keymap-set, keymap-global-set) (keymap-local-set, keymap-global-unset, keymap-local-unset) (keymap-unset, key-parse): Doc fixes.
* Improve defvar-keymap docstring.Robert Pluim2023-03-201-8/+11
| | | | | * lisp/keymap.el (defvar-keymap): Improve description of ':enter' and ':exit' usage for ':repeat' keyword.
* Improve keymap-global-set and keymap-local-set interactive use fixRobert Pluim2023-02-031-8/+10
| | | | | | | * lisp/keymap.el (keymap-global-set, keymap-local-set): Add optional `interactive' arg and use it to decide when to convert the key specification to a string. Add `advertised-calling-convention' declarations. (Bug#61149)
* ; Doc fixes in keymap.elEli Zaretskii2023-02-021-19/+19
| | | | | * lisp/keymap.el (key-valid-p, key-translate, keymap-lookup) (define-keymap): Doc fixes.
* * lisp/keymap.el (keymap-global-unset): Correct promptRobert Pluim2023-01-311-1/+1
|
* Fix interactive use of `keymap-local-set' and `keymap-global-set'Robert Pluim2023-01-301-7/+6
| | | | | | * lisp/keymap.el (keymap-global-set, keymap-local-set): Convert the read key sequence to a string when called interactively. Based on a patch from Stephen Berman <stephen.berman@gmx.net>. (Bug#61149)
* Make `keymap-set-after' work for menusRobert Pluim2023-01-201-3/+9
| | | | | | | | | | | | It still doesn't work for an AFTER that's a key, though, since `key-parse' produces vectors, and keymaps contain integers. * lisp/keymap.el (keymap-set-after): Only parse AFTER as a key if it's a string. For consistency, use `key-parse' on the definition if it's a string, just like `keymap-set'. * test/src/keymap-tests.el (keymap-tests--command-3): New dummy command. (keymap-set-after-menus): New test. Check that we can insert a menu item after a specific entry.
* Use `key-parse' in `keymap-lookup'Robert Pluim2023-01-201-1/+1
| | | | | | | | | It's stricter than `kbd', and doesn't try to do anything with key sequences that look like macros. * lisp/keymap.el (keymap-lookup): Use `key-parse' instead of `kbd'. * test/src/keymap-tests.el (keymap-set-after-menus): Test the `keymap-set-after' API.
* Handle after arg correctly in `keymap-set-after'Robert Pluim2023-01-201-0/+1
| | | | | * lisp/keymap.el (keymap-set-after): AFTER: t means the same as nil, so just change it to nil. (Bug#60867)
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* Use the new keyword ':repeat' in repeatable keymaps.Juri Linkov2022-12-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * lisp/bindings.el (undo-repeat-map) (buffer-navigation-repeat-map, next-error-repeat-map) (page-navigation-repeat-map): * lisp/comint.el (comint-repeat-map): * lisp/dired.el (dired-jump-map): * lisp/outline.el (outline-navigation-repeat-map) (outline-editing-repeat-map): * lisp/shell.el (shell-repeat-map): * lisp/tab-bar.el (tab-bar-switch-repeat-map) (tab-bar-move-repeat-map): * lisp/window.el (other-window-repeat-map) (resize-window-repeat-map): * lisp/winner.el (winner-repeat-map): * lisp/eshell/em-prompt.el (eshell-prompt-repeat-map): * lisp/eshell/esh-mode.el (eshell-command-repeat-map): Add the keyword ':repeat' to 'defvar-keymap' instead of setting the symbol property 'repeat-map' explicitly. * lisp/keymap.el (defvar-keymap): Check for 'props' that is used in 'defvar-form'.
* ; * lisp/keymap.el (keymap-substitute): Doc fix. (Bug#60059)Stefan Kangas2022-12-141-1/+1
| | | | (cherry picked from commit 1568123196cd8b57ed64e284b7deb058026be713)
* Improve 'defvar-keymap' docstringRobert Pluim2022-11-181-12/+20
| | | | | | * etc/NEWS: Improve ':repeat' entry for 'defvar-keymap'. * lisp/keymap.el (defvar-keymap): Improve description of ':repeat' keyword.
* * lisp/keymap.el (defvar-keymap): Don't use pcase.Juri Linkov2022-11-171-5/+5
|
* * lisp/keymap.el (defvar-keymap): Add support for repeat-mode.Juri Linkov2022-11-171-9/+43
| | | | | | | Put symbol properties 'repeat-map' on commands from the keymap when a ':repeat' keyword is non-nil. Also include/exclude commands according to ':repeat (:enter (commands ...) :exit (commands ...))'. https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg00968.html
* Revert "keymap.el: Ease up support for non-`kbd` formats."Lars Ingebrigtsen2022-10-031-16/+3
| | | | | | | | | This reverts commit 570a11052be6178954956a1c59c8ebcbdb77d38e. We do not want to support several keymap formats in `keymap-set' and friends -- the point is to have an interface with easy-to-understand semantics that give good feedback on valid/invalid key sequences.
* keymap.el: Ease up support for non-`kbd` formats.Stefan Monnier2022-10-021-3/+16
| | | | | | | | | | | | | | While we want to standardize on the `kbd` syntax for user-facing code, the internal vector representation of key sequences is not going away, so let's not impose silly `key-description + key-parse` roundtrips. Also, provide some support for packages stuck with user configs defined to hold old-style key formats. * lisp/keymap.el (keymap-set): Allow vectors as `key`. (key-parse-old-format): New function, which stands out better than `key-description` when searching for uses of the old syntax. * list/outline.el (outline-minor-mode): Use it.
* Signal error on duplicate key definitionsRobert Pluim2022-08-021-1/+15
| | | | | | | | | | | * lisp/keymap.el (define-keymap, defvar-keymap): Signal error if the same key is specified twice. (Bug#56873) * doc/lispref/keymaps.texi (Creating Keymaps): Document error signaling behaviour. * test/src/keymap-tests.el (keymap-test-duplicate-definitions): Test duplicate definition detection.
* Declare `key-valid-p` and `readablep` as error-freeMattias Engdegård2022-07-311-1/+1
| | | | | | | * lisp/keymap.el (key-valid-p): * lisp/subr.el (readablep): These functions are effect-free; declare them correspondingly. Note that readablep is not pure since its return value depends on ambient state.
* Filter out NS non-key events from `where-is-internal'Lars Ingebrigtsen2022-06-181-0/+5
| | | | | | | | | | | * doc/lispref/keymaps.texi (Scanning Keymaps): Document it. * lisp/keymap.el (make-non-key-event): New function. * lisp/term/common-win.el (x-setup-function-keys): Mark ns events as not being keys (bug#55940). * src/keymap.c (Fwhere_is_internal): Filter out key sequences that are marked as being non-keys.
* Avoid "control-control-KEY" (bug#55738)Mattias Engdegård2022-06-181-7/+7
| | | | | | | | | | | | | | Constructs such as ?\C-^@ or ?\C-\C-m literally apply a Control modifier twice which doesn't make sense at all. What is really meant is a C0 base character with the Control modifier bit set. This change is only stylistic in nature. * lisp/edmacro.el (edmacro-format-keys): * lisp/keymap.el (key-parse): * lisp/subr.el (event-modifiers, event-basic-type): * test/lisp/subr-tests.el (subr-test-kbd): Use \0 and \r instead of ^@ and \C-m to represent NUL and RET when combined with other modifiers.
* Fix key-parse problem with C-x ( ... sequencesLars Ingebrigtsen2022-05-031-12/+1
| | | | | | | | * lisp/keymap.el (key-parse): Move the read-kbd-macro compat code from here... * lisp/subr.el (kbd): ... to here. (And fix the logic, too.) This allows `key-parse' to have a less puzzling result while maintaining backwards compatibility (bug#38775).
* Audit quoting the quote character in doc stringsLars Ingebrigtsen2022-04-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/src/regex-emacs-tests.el (regex-tests-compare): (regex-tests-compare): (regex-tests-match): * test/lisp/xml-tests.el (xml-parse-tests--qnames): * test/lisp/mh-e/mh-thread-tests.el (mh-thread-tests-before-from): * test/lisp/cedet/srecode-utest-template.el (srecode-utest-map-reset): * test/lisp/calc/calc-tests.el (calc-tests-equal): * lisp/window.el (get-lru-window): (get-mru-window): (get-largest-window): (quit-restore-window): (display-buffer): * lisp/vc/vc-rcs.el (vc-rcs-consult-headers): * lisp/url/url-auth.el (url-digest-auth-build-response): * lisp/tutorial.el (tutorial--find-changed-keys): * lisp/transient.el (transient-suffix-object): * lisp/textmodes/rst.el (rst-insert-list-new-item): * lisp/textmodes/bibtex.el (bibtex-clean-entry): * lisp/tab-bar.el (tab-bar--key-to-number): (toggle-frame-tab-bar): * lisp/ses.el (ses-recalculate-cell): (ses-define-local-printer): (ses-prin1): * lisp/progmodes/xref.el (xref--find-ignores-arguments): * lisp/progmodes/verilog-mode.el (verilog-single-declaration-end): * lisp/progmodes/tcl.el (tcl-mode-hook): * lisp/progmodes/gdb-mi.el (gdb-get-buffer-create): * lisp/progmodes/elisp-mode.el (elisp--xref-make-xref): * lisp/play/dunnet.el (dun-room-objects): * lisp/outline.el (outline--cycle-state): * lisp/org/ox-publish.el (org-publish-find-property): * lisp/org/ox-html.el (org-html--unlabel-latex-environment): * lisp/org/org-table.el (org-table-collapse-header): * lisp/org/org-plot.el (org--plot/prime-factors): * lisp/org/org-agenda.el (org-agenda--mark-blocked-entry): (org-agenda-set-restriction-lock): * lisp/org/ob-lua.el (org-babel-lua-read-string): * lisp/org/ob-julia.el (org-babel-julia-evaluate-external-process): (org-babel-julia-evaluate-session): * lisp/org/ob-core.el (org-babel-default-header-args): * lisp/obsolete/mouse-sel.el (mouse-select): (mouse-select-secondary): * lisp/net/tramp.el (tramp-methods): * lisp/net/eww.el (eww-accept-content-types): * lisp/net/dictionary-connection.el (dictionary-connection-status): * lisp/minibuffer.el (completion-flex--make-flex-pattern): * lisp/mh-e/mh-mime.el (mh-have-file-command): * lisp/mh-e/mh-limit.el (mh-subject-to-sequence): (mh-subject-to-sequence-threaded): (mh-subject-to-sequence-unthreaded): * lisp/mail/feedmail.el (feedmail-queue-buffer-file-name): (feedmail-vm-mail-mode): * lisp/ls-lisp.el (ls-lisp--sanitize-switches): * lisp/keymap.el (key-valid-p): * lisp/international/ccl.el (ccl-compile-branch-blocks): * lisp/image/image-converter.el (image-convert): * lisp/gnus/spam.el (spam-backend-check): * lisp/gnus/nnselect.el (nnselect-generate-artlist): * lisp/gnus/nnmairix.el (nnmairix-widget-other): * lisp/gnus/message.el (message-mailto): * lisp/gnus/gnus-sum.el (gnus-collect-urls-from-article): * lisp/gnus/gnus-search.el (gnus-search-prepare-query): * lisp/frame.el (frame-size-history): * lisp/eshell/esh-var.el (eshell-parse-variable-ref): * lisp/eshell/em-dirs.el (eshell-expand-multiple-dots): * lisp/erc/erc-backend.el (erc-bounds-of-word-at-point): * lisp/emulation/cua-rect.el (cua--rectangle-operation): * lisp/emacs-lisp/text-property-search.el (text-property-search-forward): * lisp/emacs-lisp/package.el (package-desc-suffix): * lisp/emacs-lisp/faceup.el (faceup-test-explain): * lisp/emacs-lisp/comp.el (comp-curr-allocation-class): (comp-alloc-class-to-container): (comp-add-cstrs): (comp-remove-type-hints-func): (batch-byte+native-compile): * lisp/emacs-lisp/cl-macs.el (cl--optimize): * lisp/elec-pair.el (electric-pair--syntax-ppss): * lisp/doc-view.el (doc-view-doc-type): * lisp/cedet/semantic/symref.el (semantic-symref-tool-alist): (semantic-symref-hit-to-tag-via-db): (semantic-symref-hit-to-tag-via-buffer): * lisp/cedet/semantic/lex-spp.el (semantic-lex-spp-get-overlay): * lisp/cedet/semantic/java.el (semantic-java-doc-keywords-map): * lisp/cedet/semantic/find.el (semantic-brute-find-tag-by-function): * lisp/cedet/semantic/db.el (semanticdb-project-predicate-functions): * lisp/cedet/semantic.el (semantic-working-type): * lisp/cedet/ede/files.el (ede-flush-directory-hash): * lisp/calc/calc.el (calc--header-line): * lisp/auth-source.el (auth-source-pick-first-password): (auth-source--decode-octal-string): * etc/themes/modus-themes.el (modus-themes--paren): (modus-themes--agenda-habit): * admin/cus-test.el (cus-test-vars-with-changed-state): Fix quoting in doc strings. In code examples, the ' character is quoted with \\=, and regularize 'foo to `foo', and quote strings like "foo" instead of 'foo'.
* Merge branch 'master' into scratch/correct-warning-posAlan Mackenzie2022-01-221-32/+32
|\
| * Make key-valid-p work in TurkeyLars Ingebrigtsen2022-01-201-32/+32
| | | | | | | | | | * lisp/keymap.el (key-valid-p): Inhibit case folding, otherwise (key-valid-p "I") would return nil in tr_TR environments.
* | Miscellaneous amendments to the scratch/correct-warning-pos branchAlan Mackenzie2022-01-221-5/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/cedet/semantic/fw.el (semantic-alias-obsolete) (semantic-varalias-obsolete): Replace calls to byte-compile-warn with calls to byte-compile-warn-x (when it exists). * lisp/emacs-lisp/bytecomp.el (byte-compile-log-warning-function) (byte-compile--log-warning-for-byte-compile): Make the POSITION parameter no longer &optional (for the benefit of flymake on *.el). (byte-compile-log-warning): Replace a nil POSITION argument with an actual position. (byte-compile-file-form-require): Push the required symbol onto byte-compile-form-stack, for the benefit of `do-after-load-evaluation'. * lisp/keymap.el (define-keymap--compile): Replace four calls to byte-compile-warn with byte-compile-warn-x. * doc/lispref/elisp.texi (master menu): Add entries for Shorthands and Symbols with position. * doc/lispref/streams.texi (Input Functions): Document read-positioning-symbols. * doc/lispref/symbols.texi (Symbols): Add new menu entry. (Symbols with Position): New @section.
* Remove ambiguity from key-valid-p docstringRobert Pluim2022-01-041-1/+1
| | | | | * lisp/keymap.el (key-valid-p): Be explicit about the separator being one and only one space.
* Move define-keymap and defvar-keymap to keymap.elStefan Kangas2022-01-021-0/+133
| | | | | | | | | These functions deal with the "new" keymap binding interface, so they belong in keymap.el rather than in subr.el. * lisp/subr.el (define-keymap--compile, define-keymap) (defvar-keymap): Move from here ... * lisp/keymap.el (define-keymap--compile, define-keymap) (defvar-keymap): ... to here.
* ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
|
* ; * lisp/keymap.el (key-valid-p): Fix wording of doc string.Eli Zaretskii2021-12-281-1/+1
|
* Doc fix; fix terminology in key binding functionsStefan Kangas2021-12-271-4/+4
| | | | | * lisp/keymap.el (keymap-set, key-valid-p): * lisp/subr.el (define-keymap): Doc fix; improve terminology.
* Make keymap-lookup work for keymap results, tooLars Ingebrigtsen2021-12-101-2/+3
| | | | | * lisp/keymap.el (keymap-lookup): Make this function work for non-symbol lookups, too (bug#52374).
* Fix keymap-lookup implementationLars Ingebrigtsen2021-12-041-2/+2
| | | | | * lisp/keymap.el (keymap-lookup): Make this actually work for looking up keys.
* Fix some of the argument handling in keymap-set and keymap-substituteLars Ingebrigtsen2021-11-301-6/+5
| | | | | | | * lisp/keymap.el (keymap-set): Fix handling of binding one key to another key. (keymap-substitute): Fix confusion in implementation -- the args are definitions, not keys.
* Use compiler macros for the key syntax checksMattias Engdegård2021-11-281-1/+21
| | | | | | | | | | | | | | | | | | Compile-time key string syntax checks are better written using compiler macros than with byte-hunk-handlers inside the compiler proper. * lisp/emacs-lisp/bytecomp.el (byte-compile-define-keymap) (byte-compile-define-keymap--define): Remove. * lisp/keymap.el (keymap--compile-check): New. (keymap-set, keymap-global-set, keymap-local-set, keymap-global-unset) (keymap-local-unset, keymap-unset, keymap-substitute) (keymap-set-after, key-translate, keymap-lookup, keymap-local-lookup) (keymap-global-lookup): Use compiler-macro for argument checks. * lisp/subr.el (define-keymap--compile): New. (define-keymap--define): Fold into define-keymap. (define-keymap): Use compiler-macro. (defvar-keymap): Use define-keymap.
* Change the call signature to keymap-substituteLars Ingebrigtsen2021-11-171-1/+1
| | | | | | | * lisp/keymap.el (keymap-substitute): Make the keymap the first parameter for symmetry with the other functions. * lisp/emacs-lisp/shortdoc.el (keymaps): * lisp/emacs-lisp/bytecomp.el (lambda): Adjust.
* Make keymap-unset workLars Ingebrigtsen2021-11-161-1/+1
| | | | * lisp/keymap.el (keymap-unset): Fix key syntax (bug#51897).
* Add new 'keymap-*' functionsLars Ingebrigtsen2021-11-161-0/+437
* lisp/keymap.el: New file with all the new keymap-* functions. * lisp/loadup.el ("keymap"): Load. * lisp/subr.el (kbd): Refactor out all the code to key-parse. (define-key-after, keyboard-translate, global-set-key) (local-set-key, global-unset-key, local-unset-key) (local-key-binding, global-key-binding) (substitute-key-definition): Note in doc strings that these are legacy functions. (define-keymap--define): Use keymap-set. * lisp/emacs-lisp/byte-opt.el: Remove the optimizations for defvar-keymap and define-keymap since the macros now only understand the kbd syntax. * lisp/emacs-lisp/bytecomp.el (byte-compile-define-keymap) (byte-compile-define-keymap--define): Warn about invalid key definitions in all keymap-* functions. * lisp/emacs-lisp/shortdoc.el (keymaps): Add shortdocs form keymap* functions. * src/keymap.c (possibly_translate_key_sequence): Adjust callers to key-valid-p and key-parse. (syms_of_keymap): Adjust defs.