From eab211ee37decaf018117d3eec085b9d6917026b Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 22 Dec 2024 13:05:36 +0100 Subject: [PATCH] update key-chord Signed-off-by: Andreas Gerler --- elpa/key-chord-20230522.223/key-chord-pkg.el | 13 -- .../key-chord-autoloads.el | 62 +++---- elpa/key-chord-20240910.1441/key-chord-pkg.el | 10 ++ .../key-chord.el | 39 +--- elpa/key-chord-readme.txt | 166 ------------------ 5 files changed, 46 insertions(+), 244 deletions(-) delete mode 100644 elpa/key-chord-20230522.223/key-chord-pkg.el rename elpa/{key-chord-20230522.223 => key-chord-20240910.1441}/key-chord-autoloads.el (76%) create mode 100644 elpa/key-chord-20240910.1441/key-chord-pkg.el rename elpa/{key-chord-20230522.223 => key-chord-20240910.1441}/key-chord.el (86%) delete mode 100644 elpa/key-chord-readme.txt diff --git a/elpa/key-chord-20230522.223/key-chord-pkg.el b/elpa/key-chord-20230522.223/key-chord-pkg.el deleted file mode 100644 index 188c2cdd..00000000 --- a/elpa/key-chord-20230522.223/key-chord-pkg.el +++ /dev/null @@ -1,13 +0,0 @@ -(define-package "key-chord" "20230522.223" "map pairs of simultaneously pressed keys to commands" - '((emacs "24")) - :commit "e724def60fdf6473858f2962ae276cf4413473eb" :authors - '(("David Andersson ")) - :maintainers - '(("David Andersson ")) - :maintainer - '("David Andersson ") - :keywords - '("keyboard" "chord" "input")) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/key-chord-20230522.223/key-chord-autoloads.el b/elpa/key-chord-20240910.1441/key-chord-autoloads.el similarity index 76% rename from elpa/key-chord-20230522.223/key-chord-autoloads.el rename to elpa/key-chord-20240910.1441/key-chord-autoloads.el index cd4fae27..da24cb89 100644 --- a/elpa/key-chord-20230522.223/key-chord-autoloads.el +++ b/elpa/key-chord-20240910.1441/key-chord-autoloads.el @@ -1,12 +1,14 @@ -;;; key-chord-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- -;; +;;; key-chord-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + ;;; Code: -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + -;;;### (autoloads nil "key-chord" "key-chord.el" (0 0 0 0)) ;;; Generated autoloads from key-chord.el (defvar key-chord-mode nil "\ @@ -16,32 +18,29 @@ for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `key-chord-mode'.") - (custom-autoload 'key-chord-mode "key-chord" nil) - (autoload 'key-chord-mode "key-chord" "\ Map pairs of simultaneously pressed keys to commands. -This is a minor mode. If called interactively, toggle the -`Key-Chord mode' mode. If the prefix argument is positive, -enable the mode, and if it is zero or negative, disable the mode. +See functions `key-chord-define-global', `key-chord-define-local', +and `key-chord-define' and variables `key-chord-two-keys-delay' +and `key-chord-one-key-delay'. + +This is a global minor mode. If called interactively, toggle the +`Key-Chord mode' mode. If the prefix argument is positive, enable the +mode, and if it is zero or negative, disable the mode. -If called from Lisp, toggle the mode if ARG is `toggle'. Enable -the mode if ARG is nil, omitted, or is a positive number. -Disable the mode if ARG is a negative number. +If called from Lisp, toggle the mode if ARG is `toggle'. Enable the +mode if ARG is nil, omitted, or is a positive number. Disable the mode +if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `(default-value \\='key-chord-mode)'. -The mode's hook is called both when the mode is enabled and when -it is disabled. - -See functions `key-chord-define-global', `key-chord-define-local', -and `key-chord-define' and variables `key-chord-two-keys-delay' -and `key-chord-one-key-delay'. - -\(fn &optional ARG)" t nil) +The mode's hook is called both when the mode is enabled and when it is +disabled. +(fn &optional ARG)" t) (autoload 'key-chord-define-global "key-chord" "\ Define a key-chord of the two keys in KEYS starting a COMMAND. @@ -55,8 +54,7 @@ If COMMAND is nil, the key-chord is removed. Note that KEYS defined locally in the current buffer will have precedence. -\(fn KEYS COMMAND)" t nil) - +(fn KEYS COMMAND)" t) (autoload 'key-chord-define-local "key-chord" "\ Locally define a key-chord of the two keys in KEYS starting a COMMAND. @@ -70,8 +68,7 @@ If COMMAND is nil, the key-chord is removed. The binding goes in the current buffer's local map, which in most cases is shared with all other buffers in the same major mode. -\(fn KEYS COMMAND)" t nil) - +(fn KEYS COMMAND)" t) (autoload 'key-chord-define "key-chord" "\ Define in KEYMAP, a key-chord of the two keys in KEYS starting a COMMAND. @@ -82,20 +79,19 @@ can be used. COMMAND can be an interactive function, a string, or nil. If COMMAND is nil, the key-chord is removed. -\(fn KEYMAP KEYS COMMAND)" nil nil) - +(fn KEYMAP KEYS COMMAND)") (register-definition-prefixes "key-chord" '("key-chord-")) - -;;;*** -;;;### (autoloads nil nil ("key-chord-pkg.el") (0 0 0 0)) +;;; End of scraped data + +(provide 'key-chord-autoloads) -;;;*** - ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 +;; no-native-compile: t +;; coding: utf-8-emacs-unix ;; End: + ;;; key-chord-autoloads.el ends here diff --git a/elpa/key-chord-20240910.1441/key-chord-pkg.el b/elpa/key-chord-20240910.1441/key-chord-pkg.el new file mode 100644 index 00000000..754b0883 --- /dev/null +++ b/elpa/key-chord-20240910.1441/key-chord-pkg.el @@ -0,0 +1,10 @@ +;; -*- no-byte-compile: t; lexical-binding: nil -*- +(define-package "key-chord" "20240910.1441" + "Map pairs of simultaneously pressed keys to commands." + '((emacs "24")) + :url "https://github.com/emacsorphanage/key-chord" + :commit "fc75b1451759121601110da8ddfadcf5156318af" + :revdesc "fc75b1451759" + :keywords '("keyboard" "chord" "input") + :authors '(("David Andersson" . "l.david.anderssonsverige.nu")) + :maintainers '(("David Andersson" . "l.david.anderssonsverige.nu"))) diff --git a/elpa/key-chord-20230522.223/key-chord.el b/elpa/key-chord-20240910.1441/key-chord.el similarity index 86% rename from elpa/key-chord-20230522.223/key-chord.el rename to elpa/key-chord-20240910.1441/key-chord.el index 0dcf1642..f849da4a 100644 --- a/elpa/key-chord-20230522.223/key-chord.el +++ b/elpa/key-chord-20240910.1441/key-chord.el @@ -3,6 +3,8 @@ ;; Copyright (C) 2003, 2005, 2008, 2012 David Andersson ;; Author: David Andersson +;; Package-Version: 20240910.1441 +;; Package-Revision: fc75b1451759 ;; Package-Requires: ((emacs "24")) ;; Keywords: keyboard chord input @@ -43,14 +45,6 @@ This should normally be a little longer than `key-chord-two-keys-delay'." :type 'float) -(defcustom key-chord-safety-interval-backward 0.1 - "Min time to distinguish a key chord and preceding inputs." - :type 'float) - -(defcustom key-chord-safety-interval-forward 0.35 - "Min time delay to distinguish a key chord and following inputs." - :type 'float) - (defcustom key-chord-in-macros t "If nil, don't expand key chords when executing keyboard macros. @@ -74,13 +68,6 @@ when recorded.)" (defvar key-chord-in-last-kbd-macro nil) (defvar key-chord-defining-kbd-macro nil) -;; Internal vars for -;; `key-chord-safety-interval-backward'. `key-chord-idle-state' is -;; non-nil iff at least `key-chord-safety-interval-backward' past -;; after the last (non-keychord) input. -(defvar key-chord-idle-state t) -(defvar key-chord-timer-object nil) - ;;;###autoload (define-minor-mode key-chord-mode "Map pairs of simultaneously pressed keys to commands. @@ -89,16 +76,9 @@ See functions `key-chord-define-global', `key-chord-define-local', and `key-chord-define' and variables `key-chord-two-keys-delay' and `key-chord-one-key-delay'." :global t - (if key-chord-mode - (progn - (setq input-method-function 'key-chord-input-method) - (setq key-chord-timer-object - (run-with-idle-timer - key-chord-safety-interval-backward 'repeat - (lambda () (setq key-chord-idle-state t))))) - (cancel-timer key-chord-timer-object) - (setq input-method-function nil) - (setq key-chord-timer-object nil))) + (setq input-method-function + (and key-chord-mode + 'key-chord-input-method))) ;;;###autoload (defun key-chord-define-global (keys command) @@ -192,8 +172,7 @@ Commands. Please ignore that." (defun key-chord-input-method (first-char) "Input method controlled by key bindings with the prefix `key-chord'." (cond - ((and key-chord-idle-state - (not (eq first-char key-chord-last-unmatched)) + ((and (not (eq first-char key-chord-last-unmatched)) (key-chord-lookup-key (vector 'key-chord first-char))) (let ((delay (if (key-chord-lookup-key (vector 'key-chord first-char first-char)) @@ -205,14 +184,12 @@ Commands. Please ignore that." (eldoc-pre-command-refresh-echo-area)) (sit-for delay 'no-redisplay)) (setq key-chord-last-unmatched nil) - (setq key-chord-idle-state nil) (list first-char)) (t ; input-pending-p (let* ((input-method-function nil) (next-char (read-event)) (res (vector 'key-chord first-char next-char))) - (cond ((and (key-chord-lookup-key res) - (sit-for key-chord-safety-interval-forward 'no-redisplay)) + (cond ((key-chord-lookup-key res) (setq key-chord-defining-kbd-macro (cons first-char key-chord-defining-kbd-macro)) (list 'key-chord first-char next-char)) @@ -221,11 +198,9 @@ Commands. Please ignore that." (cons next-char unread-command-events)) (when (eq first-char next-char) (setq key-chord-last-unmatched first-char)) - (setq key-chord-idle-state nil) (list first-char)))))))) (t ; no key-chord keymap (setq key-chord-last-unmatched first-char) - (setq key-chord-idle-state nil) (list first-char)))) (defun key-chord--start-kbd-macro (_append &optional _no-exec) diff --git a/elpa/key-chord-readme.txt b/elpa/key-chord-readme.txt deleted file mode 100644 index b032396c..00000000 --- a/elpa/key-chord-readme.txt +++ /dev/null @@ -1,166 +0,0 @@ -######## Compatibility ######################################## - -Works with Emacs-20.3, 20.6, 20.7, 21.2, 21.4, 22.1 and 23.1 -Does not work with Emacs-19.31 nor XEmacs-20.4 and 21.4. - -######## Quick start ######################################## - -Add to your ~/.emacs - - (require 'key-chord) - (key-chord-mode 1) - -and some chords, for example - - (key-chord-define-global "hj" 'undo) - (key-chord-define-global ",." "<>\C-b") - -######## Terminology ######################################## - -In this package, a "key chord" is two keys pressed simultaneously, -or a single key quickly pressed twice. - -(Sometimes pressing SHIFT and/or META plus another key is call a chord, -but not here. However SHIFT plus two normal keys can be a "key chord".) - -######## Description ######################################## - -Key chord mode acts like a global minor mode controlled by the function -`key-chord-mode'. - -Key chord definitions are stored in ordinary key-maps. -The function `key-chord-define-global' defines a chord in the global -key-map and `key-chord-define' defines a chord in a specified key-map, -for example for a specific mode. - -A TWO-key chord is two distinct keys pressed simultaneously (within -one tenth of a second, or so). - -Examples: - - (key-chord-define-global ",." "<>\C-b") - (key-chord-define-global "hj" 'undo) - (key-chord-define-global [?h ?j] 'undo) ; the same - (key-chord-define-global "jk" 'dabbrev-expand) - (key-chord-define-global "cv" 'reindent-then-newline-and-indent) - (key-chord-define-global "4r" "$") - -Comma and dot pressed together insert a pair of angle brackets. -`h' and `j' pressed together invoke the undo command. -`j' and `k' pressed together invoke the dabbrev-expand command. -'c' and 'v' pressed together insert a newline. -`4' and `r' pressed together insert a dollar sign. - -A ONE-key chord is a single key quickly pressed twice (within one third -of a second or so). - -Examples: - - (key-chord-define-global "''" "`'\C-b") - (key-chord-define-global ",," 'indent-for-comment) - (key-chord-define-global "qq" "the ") - (key-chord-define-global "QQ" "The ") - -Tick (') pressed twice inserts a back-tick and a tick (`'). -Comma (,) pressed twice indents for and/or inserts a comment. -`q' pressed twice inserts the word "the ". - -Examples: Mode specific chords - - (key-chord-define c++-mode-map ";;" "\C-e;") - (key-chord-define c++-mode-map "{}" "{\n\n}\C-p\t") - -The command `key-chord-describe' lists currently defined key chords. -The standard command `describe-bindings' (C-h b) will also show key chords. - -The standard command `describe-key' (C-h k) will accept a key chord and -show its definition. (Isn't that amazing. There is no explicit code to -carry out this functionality.) - -######## Tips ######################################## - -Don't chord key combinations that exists in the languages you typically -write. Otherwise, if you are typing fast, two key intended to be separate -letters might instead trig a chord. -E.g. "uu" would be a good chord in spanish but not in finnish, and -"hj" would be a good chord in english but not in swedish. - -Don't rely solely on /usr/dict/words to find unusual combination. -For example "cv" or "fg" can be quite common in certain kinds of -programming. Grep your own texts to verify that a combination is unusual. -And don't forget to check both permutations: "fg" and "gf". - -Choose two keys that are close to each other on the keyboard, so they -can be quickly typed without effort. Chords involving two hands (as -opposed to two fingers on one hand) are harder to type (quickly). -The idea is that key chords are to replace function keys for functions -that are frequently performed while the hands are in writing position. - -Key chords might not work well over a slow network. - -######## Limitations ######################################## - -When recording keyboard macros, the time between keyboard inputs are not -recorded. Thus, the key-chord-input-method cannot know for sure if two keys -in a macro was a chord or not. The current solution remembers the first key -of the chords typed during macro recording, and keys that match those (and -are defined as chords) are considered key-chords during macro execution. -This knowledge is not saved with `name-last-kbd-macro', so they may -execute wrong if they contain pair of keys that match defined chords. - -Emacs will not call input-method-function for keys that have non numeric -codes or whos code is outside the range 32..126. Thus you cannot define -key chords involving function keys, control keys, or even your non-english -letters (on national keyboards) that otherwise are well positioned for -chording on your keyboard. -(I think chording left and right arrow keys would be useful, but cannot do. -I consider this a bug in Emacs. Input methods could happily return -unmodified *any* key they don't know about.) - -Key chords longer that 2 keys are not supported. It could be done, but I -don't think it is worth the trubbel since most keyboards will not reliably -send all key codes when 3 or more keys are pressed simultaneously. -It might also be a bit trickier to maintain performance. - -Key chord mode uses input-method-function. And so do internationalisation -packages (mule, quail, etc). Do not expect them to work well together. -The last one that gets the input-method-function rules. - -######## Implementation ######################################## - -Key chords piggy back in ordinary key maps, so they can be defined -per mode without having to add hooks to all modes. - -Key chord key codes are vectors beginning with the atom `key-chord'. -A two key chord, e.g. "hj", will add two entries in the key-map. -E.g. [key-chord ?h ?j] and [key-chord ?j ?h]. - -When key-chord-mode is enabled input-method-function is set to -key-chord-input-method. - -######## To do ######################################## - -* Find a way to save key-chord info in keyboard macros. - -* Save previous value of input-method-function? And call it? - -* input-method-function is reset in *info* buffers! What to do? - -* How to enter interactively command OR string in key-chord-define-global? - -* Customize public vars (defcustom). - -######## History ######################################## - -0.6 (2012-10-23) l.david.andersson(at)sverige.nu - Add key-chord-define-local, key-chord-unset-local, key-chord-unset-global -0.5 (2008-09-15) david(at)symsoft.se - Bugfix sit-for; Improved examples; New E-mail in comment -0.4 (2005-05-07) david(at)symsoft.se - Slightly better macro heuristics; Added option key-chord-in-macros -0.3 (2005-04-14) david(at)symsoft.se - Require advice; More examples -0.2 (2003-09-13) david(at)symsoft.se - Quick and dirty fix for keyboard macros -0.1 (2003-04-27) david(at)symsoft.se - First release -- 2.47.3