[elpa] externals/vertico d74393a: Update readme
branch: externals/vertico commit d74393ae0107d0aa1244f62cacbdaf1b21af48fa Author: Daniel Mendler Commit: Daniel Mendler Update readme --- README.org | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.org b/README.org index bccff63..69f2fc0 100644 --- a/README.org +++ b/README.org @@ -13,13 +13,13 @@ * Introduction Vertico provides a performant and minimalistic vertical completion UI, which is -based on the default completion system. By reusing the built-in facilities -system, Vertico achieves /full compatibility/ with built-in Emacs completion -commands and completion tables. Vertico only provides the completion UI and -comes with a minimal set of commands. The code base is small and maintainable -(~600 lines of code without whitespace and comments). - -Additional enhancements can be installed separately via complementary packages. +based on the default completion system. The main focus of Vertico is to provide +a UI which behaves /correctly/ under all circumstances. By reusing the built-in +facilities system, Vertico achieves /full compatibility/ with built-in Emacs +completion commands and completion tables. Vertico only provides the completion +UI. Additional enhancements can be installed separately via complementary +packages. The code base is small and maintainable (~600 lines of code without +whitespace and comments). * Features
[elpa] externals/vertico c915775: Add vertico-resize instead of reusing resize-mini-windows
branch: externals/vertico commit c9157759a015ac32cb299c18c84c6d5fb34e0aa1 Author: Daniel Mendler Commit: Daniel Mendler Add vertico-resize instead of reusing resize-mini-windows This allows to configure the plain minibuffer (read-from-minibuffer) separately from the Vertico minibuffer (completing-read). --- README.org | 6 +++--- vertico.el | 12 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.org b/README.org index 69f2fc0..8f5b4dd 100644 --- a/README.org +++ b/README.org @@ -50,6 +50,9 @@ Here is an example configuration: :init (vertico-mode) +;; Grow and shrink the Vertico minibuffer +;; (setq vertico-resize t) + ;; Optionally enable cycling for `vertico-next' and `vertico-previous'. ;; (setq vertico-cycle t) ) @@ -76,9 +79,6 @@ Here is an example configuration: (cons (concat "[CRM] " (car args)) (cdr args))) (advice-add #'completing-read-multiple :filter-args #'crm-indicator) -;; Grow and shrink minibuffer -;;(setq resize-mini-windows t) - ;; Do not allow the cursor in the minibuffer prompt (setq minibuffer-prompt-properties '(read-only t cursor-intangible t face minibuffer-prompt)) diff --git a/vertico.el b/vertico.el index 83e3e48..2b402df 100644 --- a/vertico.el +++ b/vertico.el @@ -58,6 +58,11 @@ "Maximal number of candidates to show." :type 'integer) +(defcustom vertico-resize resize-mini-windows + "How to resize the Vertico minibuffer window. +See `resize-mini-windows' for documentation." + :type '(choice (const nil) (const t) (const grow-only))) + (defcustom vertico-cycle nil "Enable cycling for `vertico-next' and `vertico-previous'." :type 'boolean) @@ -463,13 +468,12 @@ (defun vertico--resize-window (height) "Resize active minibuffer window to HEIGHT." (unless (frame-root-window-p (active-minibuffer-window)) -(let* ((resize (default-value 'resize-mini-windows)) - (window-resize-pixelwise t) +(let* ((window-resize-pixelwise t) (dp (- (max (cdr (window-text-pixel-size)) - (* (default-line-height) (1+ (if resize height vertico-count + (* (default-line-height) (1+ (if vertico-resize height vertico-count (window-pixel-height (when (and (or (/= height 0) (< dp 0)) - (or (> dp 0) (eq resize t))) + (or (> dp 0) (eq vertico-resize t))) (window-resize nil dp nil nil 'pixelwise) (defun vertico--display-count ()
[elpa] externals/ssh-deploy 574d3a9 1/4: Fixed issue with remote shell not starting if explicit executable is not set
branch: externals/ssh-deploy commit 574d3a94ffc649a06a225709d0f6df4d7f65644c Author: Christian Johansson Commit: Christian Johansson Fixed issue with remote shell not starting if explicit executable is not set --- ssh-deploy.el | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ssh-deploy.el b/ssh-deploy.el index a299239..795a1ea 100644 --- a/ssh-deploy.el +++ b/ssh-deploy.el @@ -129,7 +129,7 @@ ;; * `ssh-deploy-script' - Our custom lambda function that will be called using (funcall) when running deploy script *(function)* ;; * `ssh-deploy-async-with-threads' - Whether to use threads (make threads) instead of processes (async-start) for asynchronous operations *(integer)* ;; -;; When integers are used as booleans, above zero means true, zero means false and nil means unset and fallback to global settings. +;; When integers are used as booleans, above zero means true, zero means false and nil means unset and indicates to fallback to global settings. ;; ;; Please see README.md from the same repository for more extended documentation. @@ -983,11 +983,15 @@ (when (and (ssh-deploy--file-is-in-path-p path-local root-local) (ssh-deploy--file-is-included-p path-local exclude-list)) (let ((path-remote (expand-file-name (ssh-deploy--get-relative-path root-local path-local) root-remote))) -(message "Opening eshell on '%s'.." path-remote) +(message "Opening shell on '%s'.." path-remote) (let ((default-directory path-remote) (explicit-shell-file-name ssh-deploy-remote-shell-executable)) - (when explicit-shell-file-name ;; NOTE This is only to trick flycheck to ignore unused error -(shell path-remote))) + (when explicit-shell-file-name +;; NOTE This is only to trick flycheck to ignore unused error +) + (let ((buffer (generate-new-buffer (format "*Shell %s*" path-remote +(switch-to-buffer buffer) +(shell buffer))) ;;;###autoload (defun ssh-deploy-store-revision (path &optional root) @@ -1222,7 +1226,7 @@ ;;;###autoload (defun ssh-deploy-remote-terminal-shell-handler () - "Open current relative path on remote host in `eshell' but only if it's configured for deployment." + "Open current relative path on remote host in `shell' but only if it's configured for deployment." (interactive) (when (and (ssh-deploy--is-not-empty-string-p ssh-deploy-root-local) (ssh-deploy--is-not-empty-string-p ssh-deploy-root-remote) @@ -1233,7 +1237,7 @@ ;;;###autoload (defun ssh-deploy-remote-terminal-shell-base-handler () - "Open base path on remote host in `eshell' but only if it's configured for deployment." + "Open base path on remote host in `shell' but only if it's configured for deployment." (interactive) (when (and (ssh-deploy--is-not-empty-string-p ssh-deploy-root-local) (ssh-deploy--is-not-empty-string-p ssh-deploy-root-remote))
[elpa] externals/ssh-deploy updated (908de0b -> 7c5fe8a)
cjohansson pushed a change to branch externals/ssh-deploy. from 908de0b Fixed bug with remote shell terminals not opening, updated copyright years new 574d3a9 Fixed issue with remote shell not starting if explicit executable is not set new 660df97 Updated version and change-date and copyright years new 7c68d80 Updated copyright years in README new 7c5fe8a Merge remote-tracking branch 'elpa/externals/ssh-deploy' Summary of changes: README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[elpa] externals/ssh-deploy 660df97 2/4: Updated version and change-date and copyright years
branch: externals/ssh-deploy commit 660df97a150e54283da30cfe714732b317f6b84b Author: Christian Johansson Commit: Christian Johansson Updated version and change-date and copyright years --- ssh-deploy-diff-mode.el | 2 +- ssh-deploy-hydra.el | 2 +- ssh-deploy-test.el | 2 +- ssh-deploy.el | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ssh-deploy-diff-mode.el b/ssh-deploy-diff-mode.el index debed5d..335ff1f 100644 --- a/ssh-deploy-diff-mode.el +++ b/ssh-deploy-diff-mode.el @@ -1,6 +1,6 @@ ;;; ssh-deploy-diff-mode.el --- Mode for interactive directory differences -*- lexical-binding:t -*- -;; Copyright (C) 2017-2018 Free Software Foundation, Inc. +;; Copyright (C) 2017-2021 Free Software Foundation, Inc. ;; This file is not part of GNU Emacs. diff --git a/ssh-deploy-hydra.el b/ssh-deploy-hydra.el index b3b21e3..c7ef45c 100644 --- a/ssh-deploy-hydra.el +++ b/ssh-deploy-hydra.el @@ -1,6 +1,6 @@ ;;; ssh-deploy-hydra.el --- Deployment via Tramp, global or per directory. -*- lexical-binding:t -*- -;; Copyright (C) 2017-2019 Free Software Foundation, Inc. +;; Copyright (C) 2017-2021 Free Software Foundation, Inc. ;; Package-Requires: ((emacs "25")) diff --git a/ssh-deploy-test.el b/ssh-deploy-test.el index 4536c2a..4604deb 100644 --- a/ssh-deploy-test.el +++ b/ssh-deploy-test.el @@ -1,6 +1,6 @@ ;;; ssh-deploy-test.el --- Unit and integration tests for ssh-deploy. -*- lexical-binding:t -*- -;; Copyright (C) 2017-2019 Free Software Foundation, Inc. +;; Copyright (C) 2017-2021 Free Software Foundation, Inc. ;; This file is not part of GNU Emacs. diff --git a/ssh-deploy.el b/ssh-deploy.el index 795a1ea..25cb375 100644 --- a/ssh-deploy.el +++ b/ssh-deploy.el @@ -1,12 +1,12 @@ ;;; ssh-deploy.el --- Deployment via Tramp, global or per directory. -*- lexical-binding:t -*- -;; Copyright (C) 2017-2019 Free Software Foundation, Inc. +;; Copyright (C) 2017-2021 Free Software Foundation, Inc. ;; Author: Christian Johansson ;; Maintainer: Christian Johansson ;; Created: 5 Jul 2016 -;; Modified: 10 Oct 2020 -;; Version: 3.1.12 +;; Modified: 27 Jun 2021 +;; Version: 3.1.13 ;; Keywords: tools, convenience ;; URL: https://github.com/cjohansson/emacs-ssh-deploy
[elpa] externals/ssh-deploy 7c68d80 3/4: Updated copyright years in README
branch: externals/ssh-deploy commit 7c68d80422037cc9fdbd1e8b66142c9314dca193 Author: Christian Johansson Commit: Christian Johansson Updated copyright years in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b9fb515..1d54283 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The `ssh-deploy` plug-in for Emacs makes it possible to effortlessly deploy loca The idea for this plug-in was to mimic the behavior of **PhpStorm** deployment functionality. -This application is made by Christian Johansson 2016-2018 and is licensed under GNU General Public License 3 (GNU GPL 3). +This application is made by Christian Johansson 2016-2021 and is licensed under GNU General Public License 3 (GNU GPL 3). ## Configuration
[elpa] externals/ssh-deploy 7c5fe8a 4/4: Merge remote-tracking branch 'elpa/externals/ssh-deploy'
branch: externals/ssh-deploy commit 7c5fe8af2d62d8f6d32ebe2d3bfc53051a9432d1 Merge: 7c68d80 908de0b Author: Christian Johansson Commit: Christian Johansson Merge remote-tracking branch 'elpa/externals/ssh-deploy'
[elpa] externals-release/org 8037464: agenda: Fix timestamp agenda setting global agenda name
branch: externals-release/org commit 80374642e25f22c890a389716818b9a5b16d3c8c Author: Ingo Lohmar Commit: Nicolas Goaziou agenda: Fix timestamp agenda setting global agenda name * lisp/org.el (org-follow-timestamp-link): Do not set global agenda name. The tmp value for the agenda buffer name is used in `org-agenda-list' to set `org-agenda-buffer-name'. Wrap the call in a let-binding for this symbol (like the agenda dispatcher does), since otherwise it inadvertently sets the global value. --- lisp/org.el | 36 +++- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index a8b584e..467485b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9098,24 +9098,26 @@ or to another Org file, automatically push the old position onto the ring." (defvar org-agenda-start-on-weekday) (defun org-follow-timestamp-link () "Open an agenda view for the time-stamp date/range at point." - (cond - ((org-at-date-range-p t) -(let ((org-agenda-start-on-weekday) - (t1 (match-string 1)) - (t2 (match-string 2)) tt1 tt2) - (setq tt1 (time-to-days (org-time-string-to-time t1)) - tt2 (time-to-days (org-time-string-to-time t2))) + ;; Avoid changing the global value. + (let ((org-agenda-buffer-name org-agenda-buffer-name)) +(cond + ((org-at-date-range-p t) + (let ((org-agenda-start-on-weekday) + (t1 (match-string 1)) + (t2 (match-string 2)) tt1 tt2) + (setq tt1 (time-to-days (org-time-string-to-time t1)) + tt2 (time-to-days (org-time-string-to-time t2))) + (let ((org-agenda-buffer-tmp-name + (format "*Org Agenda(a:%s)" + (concat (substring t1 0 10) "--" (substring t2 0 10) + (org-agenda-list nil tt1 (1+ (- tt2 tt1)) + ((org-at-timestamp-p 'lax) (let ((org-agenda-buffer-tmp-name -(format "*Org Agenda(a:%s)" -(concat (substring t1 0 10) "--" (substring t2 0 10) - (org-agenda-list nil tt1 (1+ (- tt2 tt1)) - ((org-at-timestamp-p 'lax) -(let ((org-agenda-buffer-tmp-name - (format "*Org Agenda(a:%s)" (substring (match-string 1) 0 10 - (org-agenda-list nil (time-to-days (org-time-string-to-time - (substring (match-string 1) 0 10))) - 1))) - (t (error "This should not happen" +(format "*Org Agenda(a:%s)" (substring (match-string 1) 0 10 + (org-agenda-list nil (time-to-days (org-time-string-to-time + (substring (match-string 1) 0 10))) +1))) + (t (error "This should not happen") ;;; Following file links
[elpa] externals/org updated (7666d6b -> c3c89d5)
elpasync pushed a change to branch externals/org. from 7666d6b org-keys: improve the call for speed key "g" new 8037464 agenda: Fix timestamp agenda setting global agenda name new c3c89d5 Merge branch 'maint' Summary of changes: lisp/org.el | 36 +++- 1 file changed, 19 insertions(+), 17 deletions(-)
[elpa] externals/org c3c89d5: Merge branch 'maint'
branch: externals/org commit c3c89d569aede51985712bf32b84a4f9016226be Merge: 7666d6b 8037464 Author: Nicolas Goaziou Commit: Nicolas Goaziou Merge branch 'maint' --- lisp/org.el | 36 +++- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 1bd9e02..4fd8b6f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9165,24 +9165,26 @@ or to another Org file, automatically push the old position onto the ring." (defvar org-agenda-start-on-weekday) (defun org-follow-timestamp-link () "Open an agenda view for the time-stamp date/range at point." - (cond - ((org-at-date-range-p t) -(let ((org-agenda-start-on-weekday) - (t1 (match-string 1)) - (t2 (match-string 2)) tt1 tt2) - (setq tt1 (time-to-days (org-time-string-to-time t1)) - tt2 (time-to-days (org-time-string-to-time t2))) + ;; Avoid changing the global value. + (let ((org-agenda-buffer-name org-agenda-buffer-name)) +(cond + ((org-at-date-range-p t) + (let ((org-agenda-start-on-weekday) + (t1 (match-string 1)) + (t2 (match-string 2)) tt1 tt2) + (setq tt1 (time-to-days (org-time-string-to-time t1)) + tt2 (time-to-days (org-time-string-to-time t2))) + (let ((org-agenda-buffer-tmp-name + (format "*Org Agenda(a:%s)" + (concat (substring t1 0 10) "--" (substring t2 0 10) + (org-agenda-list nil tt1 (1+ (- tt2 tt1)) + ((org-at-timestamp-p 'lax) (let ((org-agenda-buffer-tmp-name -(format "*Org Agenda(a:%s)" -(concat (substring t1 0 10) "--" (substring t2 0 10) - (org-agenda-list nil tt1 (1+ (- tt2 tt1)) - ((org-at-timestamp-p 'lax) -(let ((org-agenda-buffer-tmp-name - (format "*Org Agenda(a:%s)" (substring (match-string 1) 0 10 - (org-agenda-list nil (time-to-days (org-time-string-to-time - (substring (match-string 1) 0 10))) - 1))) - (t (error "This should not happen" +(format "*Org Agenda(a:%s)" (substring (match-string 1) 0 10 + (org-agenda-list nil (time-to-days (org-time-string-to-time + (substring (match-string 1) 0 10))) +1))) + (t (error "This should not happen") ;;; Following file links
[elpa] externals/bluetooth 4c7d18c: add file-local vars to define indentation
branch: externals/bluetooth commit 4c7d18c99bc354eaebb5831bb8eccb58e3251c4f Author: Raffael Stocker Commit: Raffael Stocker add file-local vars to define indentation --- bluetooth.el | 5 + 1 file changed, 5 insertions(+) diff --git a/bluetooth.el b/bluetooth.el index 1ddc2fb..633d9c4 100644 --- a/bluetooth.el +++ b/bluetooth.el @@ -4140,3 +4140,8 @@ scanning the bus, displaying device info etc." (provide 'bluetooth) ;;; bluetooth.el ends here + +;; Local Variables: +;; indent-tabs-mode: t +;; tab-width: 4 +;; End:
[elpa] main e107b83: * elpa-packages (setup, shell-command+): Auto sync
branch: main commit e107b8347199fd4c900da71aa3f8b7b5bc4705d2 Author: Stefan Monnier Commit: Stefan Monnier * elpa-packages (setup, shell-command+): Auto sync --- elpa-packages | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/elpa-packages b/elpa-packages index 6cade69..b9ec385 100644 --- a/elpa-packages +++ b/elpa-packages @@ -331,9 +331,11 @@ ("scroll-restore" :url nil) ("sed-mode" :url nil) ("seq":url nil) - ("setup" :url "https://git.sr.ht/~pkal/setup";) + ("setup" :url "https://git.sr.ht/~pkal/setup"; + :auto-sync t) ("shelisp":url nil) - ("shell-command+" :url "https://git.sr.ht/~pkal/shell-command-plus";) + ("shell-command+" :url "https://git.sr.ht/~pkal/shell-command-plus"; + :auto-sync t) ("shell-quasiquote" :url nil) ("shen-mode" :url nil) ("sisu-mode" :url nil)
[elpa] main 48e66bb: * elpa-packages (which-key): Auto sync
branch: main commit 48e66bbb9f743715fcec273084dac6928f0804fb Author: Stefan Monnier Commit: Stefan Monnier * elpa-packages (which-key): Auto sync --- elpa-packages | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elpa-packages b/elpa-packages index b9ec385..9053ab3 100644 --- a/elpa-packages +++ b/elpa-packages @@ -405,7 +405,8 @@ ("windresize" :url nil) ("wisi" :url nil) ("wisitoken-grammar-mode" :url nil) - ("which-key" :url "https://github.com/justbur/emacs-which-key";) + ("which-key" :url "https://github.com/justbur/emacs-which-key"; + :auto-sync t) ("wpuzzle":url nil) ("xclip" :url nil) ("xelb" :url "https://github.com/ch11ng/xelb.git";)
[elpa] externals/setup updated (4a4b1c5 -> 69c3a07)
elpasync pushed a change to branch externals/setup. from 4a4b1c5 Merge :if-require into :require new b1d1efc Allow edebugging in :when-loaded body new 36021f9 Use full name in header new 69b01fb Bump version to 0.2.1 new a477360 Allow list arguments to be used for :with- macros new 8fd94ba Fix behaviour of :with-feature when passed a nil feature new 7532a8c Update public-inbox URL new 69c3a07 Refresh package archive contents if package is not known Summary of changes: README.md | 2 +- setup.el | 80 --- 2 files changed, 52 insertions(+), 30 deletions(-)
[elpa] externals/setup b1d1efc 1/7: Allow edebugging in :when-loaded body
branch: externals/setup commit b1d1efcdffbd18d69f6ab1a7de4ae00c0eb0e34f Author: Philip Kaludercic Commit: Philip Kaludercic Allow edebugging in :when-loaded body --- setup.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.el b/setup.el index f046d49..05b485f 100644 --- a/setup.el +++ b/setup.el @@ -539,7 +539,7 @@ If PATH does not exist, abort the evaluation." Avoid using this macro whenever possible, and instead choose a more specialized alternative or write one yourself." - :debug '(body) + :debug '(setup) :after-loaded t) (provide 'setup)
[elpa] externals/setup 69b01fb 3/7: Bump version to 0.2.1
branch: externals/setup commit 69b01fb5af246e173986a5e84079568a67b9fc99 Author: Philip Kaludercic Commit: Philip Kaludercic Bump version to 0.2.1 --- setup.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.el b/setup.el index 13584a7..990e96e 100644 --- a/setup.el +++ b/setup.el @@ -4,7 +4,7 @@ ;; Author: Philip Kaludercic ;; Maintainer: Philip Kaludercic -;; Version: 0.2.0 +;; Version: 0.2.1 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: lisp, local ;; URL: https://git.sr.ht/~zge/setup
[elpa] externals/setup 8fd94ba 5/7: Fix behaviour of :with-feature when passed a nil feature
branch: externals/setup commit 8fd94baa27706203f3ad13368abed8092780c150 Author: Philip Kaludercic Commit: Philip Kaludercic Fix behaviour of :with-feature when passed a nil feature --- setup.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.el b/setup.el index ce3d1e4..91ce235 100644 --- a/setup.el +++ b/setup.el @@ -227,7 +227,7 @@ If not given, it is assumed nothing is evaluated." ,@body)) (macroexp-progn body)) bodies)) - (macroexp-progn (nreverse bodies + (macroexp-progn (if features (nreverse bodies) body :documentation "Change the FEATURE that BODY is configuring. This macro also declares a current mode by appending \"-mode\" to FEATURE, unless it already ends with \"-mode\".
[elpa] externals/setup a477360 4/7: Allow list arguments to be used for :with- macros
branch: externals/setup commit a477360a22ae4609b059055fcf13674a67ba7739 Author: Philip Kaludercic Commit: Philip Kaludercic Allow list arguments to be used for :with- macros --- setup.el | 70 +--- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/setup.el b/setup.el index 990e96e..ce3d1e4 100644 --- a/setup.el +++ b/setup.el @@ -215,45 +215,65 @@ If not given, it is assumed nothing is evaluated." ;;; definitions of `setup' keywords (setup-define :with-feature - (lambda (feature &rest body) -(if feature -`(let ((setup-name ',feature)) - (ignore setup-name) - (:with-mode ,(if (string-match-p "-mode\\'" (symbol-name feature)) -feature - (intern (format "%s-mode" feature))) - ,@body)) - (macroexp-progn body))) + (lambda (features &rest body) +(let (bodies) + (dolist (feature (if (listp features) features (list features))) +(push (if feature + `(let ((setup-name ',feature)) + (ignore setup-name) + (:with-mode ,(if (string-match-p "-mode\\'" (symbol-name feature)) + feature +(intern (format "%s-mode" feature))) + ,@body)) +(macroexp-progn body)) + bodies)) + (macroexp-progn (nreverse bodies :documentation "Change the FEATURE that BODY is configuring. This macro also declares a current mode by appending \"-mode\" to -FEATURE, unless it already ends with \"-mode\"." +FEATURE, unless it already ends with \"-mode\". +If FEATURE is a list, apply BODY to all elements of FEATURE." :debug '(sexp setup) :indent 1) (setup-define :with-mode - (lambda (mode &rest body) -`(let ((setup-mode ',mode) - (setup-map ',(intern (format "%s-map" mode))) - (setup-hook ',(intern (format "%s-hook" mode - (ignore setup-mode setup-map setup-hook) - ,@body)) - :documentation "Change the MODE that BODY is configuring." + (lambda (modes &rest body) +(let (bodies) + (dolist (mode (if (listp modes) modes (list modes))) +(push `(let ((setup-mode ',mode) + (setup-map ',(intern (format "%s-map" mode))) + (setup-hook ',(intern (format "%s-hook" mode + (ignore setup-mode setup-map setup-hook) + ,@body) + bodies)) + (macroexp-progn (nreverse bodies + :documentation "Change the MODE that BODY is configuring. +If MODE is a list, apply BODY to all elements of MODE." :debug '(sexp setup) :indent 1) (setup-define :with-map - (lambda (map &rest body) -`(let ((setup-map ',map)) - ,@body)) - :documentation "Change the MAP that BODY will bind to" + (lambda (maps &rest body) +(let (bodies) + (dolist (map (if (listp maps) maps (list maps))) +(push `(let ((setup-map ',map)) + ,@body) + bodies)) + (macroexp-progn (nreverse bodies + :documentation "Change the MAP that BODY will bind to. +If MAP is a list, apply BODY to all elements of MAP." :debug '(sexp setup) :indent 1) (setup-define :with-hook - (lambda (hook &rest body) -`(let ((setup-hook ',hook)) - ,@body)) - :documentation "Change the HOOK that BODY will use." + (lambda (hooks &rest body) +(let (bodies) + (dolist (hook (if (listp hooks) hooks (list hooks))) +(push `(let ((setup-hook ',hook)) + ,@body) + bodies)) + (macroexp-progn (nreverse bodies + :documentation "Change the HOOK that BODY will use. +If HOOK is a list, apply BODY to all elements of HOOK." :debug '(sexp setup) :indent 1)
[elpa] externals/setup 7532a8c 6/7: Update public-inbox URL
branch: externals/setup commit 7532a8cb2f9020d5386001d71f7fe64d37d5846f Author: Philip Kaludercic Commit: Philip Kaludercic Update public-inbox URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ae7830..55353df 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ Copying `setup.el` is distributed under the [GPL v3][gpl3] license. [elpa]: http://elpa.gnu.org/packages/setup.html -[mail]: https://lists.sr.ht/~zge/public-inbox +[mail]: https://lists.sr.ht/~pkal/public-inbox [github]: https://github.com/phikal/setup.el [ca]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Copyright-Assignment.html#Copyright-Assignment [gpl3]: https://www.gnu.org/licenses/gpl-3.0.en.html
[elpa] externals/shell-command+ 7942428 1/2: Insert expected flags into grep command
branch: externals/shell-command+ commit 794242809672be8e78182e1d4164abc114f158c8 Author: Philip Kaludercic Commit: Philip Kaludercic Insert expected flags into grep command --- shell-command+.el | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shell-command+.el b/shell-command+.el index aaad41d..79fff81 100644 --- a/shell-command+.el +++ b/shell-command+.el @@ -156,7 +156,13 @@ If EXPAND is non-nil, expand wildcards." (defun shell-command+-cmd-grep (command) "Convert COMMAND into a `grep' call." - (grep (mapconcat #'identity (shell-command+-tokenize command t) " "))) + (grep-compute-defaults) + (pcase-let ((`(,cmd . ,args) (shell-command+-tokenize command t))) +(grep (mapconcat #'identity + (cons (replace-regexp-in-string +(concat "\\`" grep-program) cmd grep-command) + args) + " " (defun shell-command+-cmd-find (command) "Convert COMMAND into a `find-dired' call."
[elpa] externals/setup 69c3a07 7/7: Refresh package archive contents if package is not known
branch: externals/setup commit 69c3a07c2349eeb42716308e0f9629df1f1c7458 Author: Philip Kaludercic Commit: Philip Kaludercic Refresh package archive contents if package is not known --- setup.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.el b/setup.el index 91ce235..9b96637 100644 --- a/setup.el +++ b/setup.el @@ -280,6 +280,8 @@ If HOOK is a list, apply BODY to all elements of HOOK." (setup-define :package (lambda (package) `(unless (package-installed-p ',package) + (unless (memq ',package package-archive-contents) + (package-refresh-contents)) (package-install ',package))) :documentation "Install PACKAGE if it hasn't been installed yet. This macro can be used as HEAD, and it will replace itself with
[elpa] externals/shell-command+ e077867 2/2: Update public-inbox URL
branch: externals/shell-command+ commit e077867c9f3a2b472d5fd5caa5033aa523a31c35 Author: Philip Kaludercic Commit: Philip Kaludercic Update public-inbox URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d7e6add..cc9ce44 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Copying [leah]: http://leahneukirchen.org/dotfiles/.emacs [ELPA]: http://elpa.gnu.org/packages/shell-command+.html -[mail]: https://lists.sr.ht/~zge/public-inbox +[mail]: https://lists.sr.ht/~pkal/public-inbox [setup]: http://elpa.gnu.org/packages/setup.html [ca]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Copyright-Assignment.html#Copyright-Assignment [gpl3]: https://www.gnu.org/licenses/gpl-3.0.en.html
[elpa] externals/shell-command+ updated (f65aca2 -> e077867)
elpasync pushed a change to branch externals/shell-command+. from f65aca2 Bump version to 2.2.0 new 7942428 Insert expected flags into grep command new e077867 Update public-inbox URL Summary of changes: README.md | 2 +- shell-command+.el | 8 +++- 2 files changed, 8 insertions(+), 2 deletions(-)
[elpa] externals/setup 36021f9 2/7: Use full name in header
branch: externals/setup commit 36021f9331aa527368f9193195047aafec315635 Author: Philip Kaludercic Commit: Philip Kaludercic Use full name in header --- setup.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.el b/setup.el index 05b485f..13584a7 100644 --- a/setup.el +++ b/setup.el @@ -2,8 +2,8 @@ ;; Copyright (C) 2021 Free Software Foundation, Inc. -;; Author: Philip K. -;; Maintainer: Philip K. +;; Author: Philip Kaludercic +;; Maintainer: Philip Kaludercic ;; Version: 0.2.0 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: lisp, local
[elpa] externals/which-key fc88551 05/32: Remove pseudo binding stuff
branch: externals/which-key commit fc8855187f087635de4162071882405861460e05 Author: Justin Burkett Commit: Justin Burkett Remove pseudo binding stuff It's not necessary anymore with manual parsing of the keymaps --- which-key.el | 89 1 file changed, 17 insertions(+), 72 deletions(-) diff --git a/which-key.el b/which-key.el index e6ac0c4..5c2ca80 100644 --- a/which-key.el +++ b/which-key.el @@ -525,24 +525,6 @@ it." :group 'which-key :type 'boolean) -(defcustom which-key-enable-extended-define-key nil - "Advise `define-key' to make which-key aware of definitions of the form - - \(define-key KEYMAP KEY '(\"DESCRIPTION\" . DEF)) - -With the advice, this definition will have the side effect of -creating a replacement in `which-key-replacement-alist' that -replaces DEF with DESCRIPTION when the key sequence ends in -KEY. Using a cons cell like this is a valid definition for -`define-key'. All this does is to make which-key aware of it. - -Since many higher level keybinding functions use `define-key' -internally, this will affect most if not all of those as well. - -This variable must be set before loading which-key." - :group 'which-key - :type 'boolean) - ;; Hooks (defcustom which-key-init-buffer-hook '() "Hook run when which-key buffer is initialized." @@ -938,8 +920,7 @@ actually bound to write-file before performing the replacement." replacement (car-safe replacement))) (command (cdr-safe replacement))) - (define-key keymap (which-key--pseudo-key (kbd key)) -`(which-key ,(cons string command + (define-key keymap (kbd key) (cons string command))) (setq key (pop more) replacement (pop more (put 'which-key-add-keymap-based-replacements 'lisp-indent-function 'defun) @@ -1044,19 +1025,6 @@ If AT-ROOT is non-nil the binding is also placed at the root of MAP." (which-key-define-key-recursively df key def t))) map)) -(defun which-key--process-define-key-args (keymap key def) - "When DEF takes the form (\"DESCRIPTION\". DEF), make sure -which-key uses \"DESCRIPTION\" for this binding. This function is -meant to be used as :before advice for `define-key'." - (with-demoted-errors "Which-key extended define-key error: %s" -(when (and (consp def) - (stringp (car def)) - (symbolp (cdr def))) - (define-key keymap (which-key--pseudo-key key) `(which-key ,def) - -(when which-key-enable-extended-define-key - (advice-add #'define-key :before #'which-key--process-define-key-args)) - ;;; Functions for computing window sizes (defun which-key--text-width-to-total (text-width) @@ -1493,20 +1461,6 @@ local bindings coming first. Within these categories order using (string-match-p binding-regexp (cdr key-binding))) -(defun which-key--get-pseudo-binding (key-binding &optional prefix) - (let* ((key (kbd (car key-binding))) - (pseudo-binding (key-binding (which-key--pseudo-key key prefix -(when pseudo-binding - (let* ((command-replacement (cadr pseudo-binding)) - (pseudo-desc (car command-replacement)) - (pseudo-def (cdr command-replacement))) -(when (and (stringp pseudo-desc) - (or (null pseudo-def) - ;; don't verify keymaps - (keymapp pseudo-def) - (eq pseudo-def (key-binding key - (cons (car key-binding) pseudo-desc)) - (defsubst which-key--replace-in-binding (key-binding repl) (cond ((or (not (consp repl)) (null (cdr repl))) key-binding) @@ -1542,26 +1496,23 @@ local bindings coming first. Within these categories order using "Use `which-key--replacement-alist' to maybe replace KEY-BINDING. KEY-BINDING is a cons cell of the form \(KEY . BINDING\) each of which are strings. KEY is of the form produced by `key-binding'." - (let* ((pseudo-binding (which-key--get-pseudo-binding key-binding prefix))) -(if pseudo-binding -pseudo-binding - (let* ((replacer (if which-key-allow-multiple-replacements - #'which-key--replace-in-repl-list-many - #'which-key--replace-in-repl-list-once))) -(pcase -(apply replacer - (list key-binding - (cdr-safe (assq major-mode which-key-replacement-alist - (`(replaced . ,repl) - (if which-key-allow-multiple-replacements - (pcase (apply replacer (list repl which-key-replacement-alist)) - (`(replaced . ,repl) repl) - ('() repl)) - repl)) - ('() - (pcase (apply replacer (list key-binding which-key-replacement-alist)) + (let* ((replacer (if which-key-allow-multiple-replacements + #'which
[elpa] externals/which-key updated (fc29864 -> 27d9fec)
elpasync pushed a change to branch externals/which-key. from fc29864 Fix whitespace new 12f743c Fix whitespace new 0f6bda6 Improve first doc-string line in trivial cases new 1f9c37d Merge pull request #305 from tarsiiformes/first-line new a55b908 Alternative approach to retrieving bindings (WIP) new fc88551 Remove pseudo binding stuff new 8a558e6 Update tests new fffd3e5 Fix default of which-key-replacement-alist new 4e592ed Fix type usage and arglists for new functions new 8d6d81d Expand get-keymap-bindings test new 465d2fb Fix add-keymap-based-bindings and associated test new e42d946 Fix prefix sorting new 2444833 Fix menu-item bidning retrieval new d6b56f3 Fix detection of named prefix bindings new e236920 Merge branch 'alt-get-bindings' new 8b707ef Make enable-extended-define-key obsolete new 300c098 Update README new 7d344ce Fix test new 063b867 Fix github action new d621634 Try with cask again new 3f76f51 Fix which-key--group-p new 11471fb Add install python step to github action new 6ae80f5 Try without cask new 7cfbf8c Turn off fail-fast in github action new d8445fd Try again to fix tests new 28f386c Fix key sort order functions new 6290c9e Improve which-key-add-keymap-based-bindings new b83c0de Clean up which-key--maybe-replace new eb5a2e3 Clean up some docstrings new cd0c48c Clarify usage of keymap replacements in docstrings and README new 4c27fc0 Improve which-key-add-keymap-based-replacements. new 7abe54f Handle closure definition type new 27d9fec Fix compiler warnings Summary of changes: .github/workflows/test.yml | 21 +- Cask | 2 +- README.org | 55 +++--- which-key-tests.el | 53 +++-- which-key.el | 482 +++-- 5 files changed, 274 insertions(+), 339 deletions(-)
[elpa] externals/which-key 12f743c 01/32: Fix whitespace
branch: externals/which-key commit 12f743c6955c89352f8d49d292895bd45e82d26f Author: Jonas Bernoulli Commit: Jonas Bernoulli Fix whitespace --- which-key.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/which-key.el b/which-key.el index 89ab2ae..9b4005a 100644 --- a/which-key.el +++ b/which-key.el @@ -997,7 +997,7 @@ addition KEY-SEQUENCE REPLACEMENT pairs) to apply." (title-mode-alist (or (cdr-safe (assq mode which-key--prefix-title-alist)) (list (while key-sequence -;; normalize key sequences before adding + ;; normalize key sequences before adding (let ((key-seq (key-description (kbd key-sequence))) (replace (or (and (functionp replacement) replacement) (car-safe replacement) @@ -1646,7 +1646,7 @@ If KEY contains any \"special keys\" defined in (let ((beg (match-beginning 0)) (end (match-end 0))) (concat (substring key-w-face 0 beg) (which-key--propertize (substring key-w-face beg (1+ beg)) -'face 'which-key-special-key-face) + 'face 'which-key-special-key-face) (substring key-w-face end (which-key--string-width key-w-face key-w-face @@ -2711,7 +2711,7 @@ Finally, show the buffer." (bound-and-true-p god-local-mode) (eq this-command 'god-mode-self-insert)) (setq this-command-keys (when which-key--god-mode-key-string - (kbd which-key--god-mode-key-string +(kbd which-key--god-mode-key-string this-command-keys)) (defun which-key--update ()
[elpa] externals/which-key 1f9c37d 03/32: Merge pull request #305 from tarsiiformes/first-line
branch: externals/which-key commit 1f9c37d50f08995c8671822591c8babb893ccc6f Merge: 12f743c 0f6bda6 Author: Justin Burkett Commit: GitHub Merge pull request #305 from tarsiiformes/first-line Improve first doc-string line in trivial cases --- which-key.el | 62 +++- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/which-key.el b/which-key.el index 9b4005a..6d69482 100644 --- a/which-key.el +++ b/which-key.el @@ -56,8 +56,8 @@ :prefix "which-key-") (defcustom which-key-idle-delay 1.0 - "Delay (in seconds) for which-key buffer to popup. This - variable should be set before activating `which-key-mode'. + "Delay (in seconds) for which-key buffer to popup. +This variable should be set before activating `which-key-mode'. A value of zero might lead to issues, so a non-zero value is recommended @@ -276,14 +276,13 @@ and nil. Nil turns the feature off." (const :tag "Use your custom display functions" custom))) (defcustom which-key-min-display-lines 1 - "The minimum number of horizontal lines to display in the - which-key buffer." + "The minimum number of horizontal lines to display in the which-key buffer." :group 'which-key :type 'integer) (defcustom which-key-max-display-columns nil - "The maximum number of columns to display in the which-key -buffer. nil means don't impose a maximum." + "The maximum number of columns to display in the which-key buffer. +nil means don't impose a maximum." :group 'which-key :type '(choice integer (const :tag "Unbounded" nil))) @@ -500,10 +499,10 @@ The delay time is effectively added to the normal :type '(repeat function)) (defcustom which-key-allow-regexps nil - "A list of regexp strings to use to filter key sequences. When -non-nil, for a key sequence to trigger the which-key popup it -must match one of the regexps in this list. The format of the key -sequences is what is produced by `key-description'." + "A list of regexp strings to use to filter key sequences. +When non-nil, for a key sequence to trigger the which-key popup +it must match one of the regexps in this list. The format of the +key sequences is what is produced by `key-description'." :group 'which-key :type '(repeat regexp)) @@ -739,9 +738,10 @@ update.") Evil (defcustom which-key-allow-evil-operators (boundp 'evil-this-operator) - "Allow popup to show for evil operators. The popup is normally - inhibited in the middle of commands, but setting this to - non-nil will override this behavior for evil operators." + "Allow popup to show for evil operators. +The popup is normally inhibited in the middle of commands, but +setting this to non-nil will override this behavior for evil +operators." :group 'which-key :type 'boolean) @@ -772,9 +772,10 @@ problems at github.") (which-key--hide-popup (defun which-key-enable-god-mode-support (&optional disable) - "Enable support for god-mode if non-nil. This is experimental, -so you need to explicitly opt-in for now. Please report any -problems at github. If DISABLE is non-nil disable support." + "Enable support for god-mode if non-nil. +This is experimental, so you need to explicitly opt-in for +now. Please report any problems at github. If DISABLE is non-nil +disable support." (interactive "P") (setq which-key--god-mode-support-enabled (null disable)) (if disable @@ -888,8 +889,7 @@ if there is space and the bottom otherwise." ;;;###autoload (defun which-key-setup-side-window-bottom () - "Apply suggested settings for side-window that opens on -bottom." + "Apply suggested settings for side-window that opens on bottom." (interactive) (which-key--setup-echo-keystrokes) (setq which-key-popup-type 'side-window @@ -1156,8 +1156,7 @@ total height." (custom (funcall which-key-custom-hide-popup-function (defun which-key--hide-popup-on-frame-size-change (&optional _) - "Hide which-key popup if the frame is resized (to trigger a new -popup)." + "Hide which-key popup if the frame is resized (to trigger a new popup)." (when (which-key--frame-size-changed-p) (which-key--hide-popup))) @@ -2249,8 +2248,9 @@ and a page count." (_ (cons page nil) (defun which-key--show-page (&optional n) - "Show current page. N changes the current page to the Nth page -relative to the current one." + "Show current page. +N changes the current page to the Nth page relative to the +current one." (which-key--init-buffer) ;; in case it was killed (let ((prefix-keys (which-key--current-key-string)) golden-ratio-mode) @@ -2550,8 +2550,8 @@ Only if no bindings fit fallback to LOC2." ;;;###autoload (defun which-key-show-keymap (keymap &optional no-paging) - "Show the top-level bindings in KEYMAP using which-key. KEYMAP -is selected interactively from all available keymaps. + "Show the top-level bindings in KEYMAP using which-key. +KEYMAP is selecte
[elpa] externals/which-key 0f6bda6 02/32: Improve first doc-string line in trivial cases
branch: externals/which-key commit 0f6bda622e19d8b7f3d39acddbff5263c69a51de Author: Jonas Bernoulli Commit: Jonas Bernoulli Improve first doc-string line in trivial cases The first line of a doc-string should form a complete sentence. Many doc-strings in this package do not follow that convention but fixing them all would be difficult and is beyond the scope of this commit. However, in a few cases the fix is trivial and this commit tackles those instances. --- which-key.el | 62 +++- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/which-key.el b/which-key.el index 9b4005a..6d69482 100644 --- a/which-key.el +++ b/which-key.el @@ -56,8 +56,8 @@ :prefix "which-key-") (defcustom which-key-idle-delay 1.0 - "Delay (in seconds) for which-key buffer to popup. This - variable should be set before activating `which-key-mode'. + "Delay (in seconds) for which-key buffer to popup. +This variable should be set before activating `which-key-mode'. A value of zero might lead to issues, so a non-zero value is recommended @@ -276,14 +276,13 @@ and nil. Nil turns the feature off." (const :tag "Use your custom display functions" custom))) (defcustom which-key-min-display-lines 1 - "The minimum number of horizontal lines to display in the - which-key buffer." + "The minimum number of horizontal lines to display in the which-key buffer." :group 'which-key :type 'integer) (defcustom which-key-max-display-columns nil - "The maximum number of columns to display in the which-key -buffer. nil means don't impose a maximum." + "The maximum number of columns to display in the which-key buffer. +nil means don't impose a maximum." :group 'which-key :type '(choice integer (const :tag "Unbounded" nil))) @@ -500,10 +499,10 @@ The delay time is effectively added to the normal :type '(repeat function)) (defcustom which-key-allow-regexps nil - "A list of regexp strings to use to filter key sequences. When -non-nil, for a key sequence to trigger the which-key popup it -must match one of the regexps in this list. The format of the key -sequences is what is produced by `key-description'." + "A list of regexp strings to use to filter key sequences. +When non-nil, for a key sequence to trigger the which-key popup +it must match one of the regexps in this list. The format of the +key sequences is what is produced by `key-description'." :group 'which-key :type '(repeat regexp)) @@ -739,9 +738,10 @@ update.") Evil (defcustom which-key-allow-evil-operators (boundp 'evil-this-operator) - "Allow popup to show for evil operators. The popup is normally - inhibited in the middle of commands, but setting this to - non-nil will override this behavior for evil operators." + "Allow popup to show for evil operators. +The popup is normally inhibited in the middle of commands, but +setting this to non-nil will override this behavior for evil +operators." :group 'which-key :type 'boolean) @@ -772,9 +772,10 @@ problems at github.") (which-key--hide-popup (defun which-key-enable-god-mode-support (&optional disable) - "Enable support for god-mode if non-nil. This is experimental, -so you need to explicitly opt-in for now. Please report any -problems at github. If DISABLE is non-nil disable support." + "Enable support for god-mode if non-nil. +This is experimental, so you need to explicitly opt-in for +now. Please report any problems at github. If DISABLE is non-nil +disable support." (interactive "P") (setq which-key--god-mode-support-enabled (null disable)) (if disable @@ -888,8 +889,7 @@ if there is space and the bottom otherwise." ;;;###autoload (defun which-key-setup-side-window-bottom () - "Apply suggested settings for side-window that opens on -bottom." + "Apply suggested settings for side-window that opens on bottom." (interactive) (which-key--setup-echo-keystrokes) (setq which-key-popup-type 'side-window @@ -1156,8 +1156,7 @@ total height." (custom (funcall which-key-custom-hide-popup-function (defun which-key--hide-popup-on-frame-size-change (&optional _) - "Hide which-key popup if the frame is resized (to trigger a new -popup)." + "Hide which-key popup if the frame is resized (to trigger a new popup)." (when (which-key--frame-size-changed-p) (which-key--hide-popup))) @@ -2249,8 +2248,9 @@ and a page count." (_ (cons page nil) (defun which-key--show-page (&optional n) - "Show current page. N changes the current page to the Nth page -relative to the current one." + "Show current page. +N changes the current page to the Nth page relative to the +current one." (which-key--init-buffer) ;; in case it was killed (let ((prefix-keys (which-key--current-key-string)) golden-ratio-mode) @@ -2550,8 +2550,8 @@ Only if no bindings fit fallback to LOC2." ;;;###autoload (defun which-ke
[elpa] externals/which-key d6b56f3 13/32: Fix detection of named prefix bindings
branch: externals/which-key commit d6b56f3e0c0295578db9b88330f1dee38156855e Author: Justin Burkett Commit: Justin Burkett Fix detection of named prefix bindings --- which-key.el | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/which-key.el b/which-key.el index ebed572..831e7d5 100644 --- a/which-key.el +++ b/which-key.el @@ -1401,7 +1401,9 @@ Uses `string-lessp' after applying lowercase." (string-lessp (downcase (cdr acons)) (downcase (cdr bcons (defsubst which-key--group-p (description) - (or (equal description "prefix") + (or (string-equal description "prefix") + (and (length> description 6) + (string-equal (substring description 0 6) "group:")) (keymapp (intern description (defun which-key-prefix-then-key-order (acons bcons) @@ -1789,11 +1791,11 @@ Requires `which-key-compute-remaps' to be non-nil" ((keymapp def) "prefix") ((symbolp def) (which-key--compute-binding def)) ((eq 'lambda (car-safe def)) "lambda") -((eq 'menu-item (car-safe def)) - (which-key--get-menu-item-binding def)) ((stringp def) def) ((vectorp def) (key-description def)) -((consp def) (car def)) +((consp def) (concat (when (keymapp (cdr-safe def)) + "group:") + (car def))) (t "unknown") (when (or (null filter) (and (functionp filter)
[elpa] externals/which-key 7cfbf8c 23/32: Turn off fail-fast in github action
branch: externals/which-key commit 7cfbf8cee74ec92bf1a4177323bead288a8dff16 Author: Justin Burkett Commit: Justin Burkett Turn off fail-fast in github action --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 87331b7..6b4d511 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,7 @@ jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: emacs_version: - 26.1
[elpa] externals/which-key a55b908 04/32: Alternative approach to retrieving bindings (WIP)
branch: externals/which-key commit a55b90844c837e157c289ad4b10f5f2e3a4d53ff Author: Justin Burkett Commit: Justin Burkett Alternative approach to retrieving bindings (WIP) --- which-key.el | 185 +-- 1 file changed, 65 insertions(+), 120 deletions(-) diff --git a/which-key.el b/which-key.el index 9b4005a..e6ac0c4 100644 --- a/which-key.el +++ b/which-key.el @@ -1790,57 +1790,6 @@ alists. Returns a list (key separator description)." new-list (nreverse new-list))) -(defun which-key--get-keymap-bindings (keymap &optional all prefix) - "Retrieve top-level bindings from KEYMAP. -If ALL is non-nil, get all bindings, not just the top-level -ones. PREFIX is for internal use and should not be used." - (let (bindings) -(map-keymap - (lambda (ev def) - (let* ((key (append prefix (list ev))) - (key-desc (key-description key))) - (cond ((or (string-match-p - which-key--ignore-non-evil-keys-regexp key-desc) -(eq ev 'menu-bar))) - ;; extract evil keys corresponding to current state - ((and (keymapp def) - (boundp 'evil-state) - (bound-and-true-p evil-local-mode) - (string-match-p (format "<%s-state>$" evil-state) key-desc)) -(setq bindings - ;; this function keeps the latter of the two duplicates - ;; which will be the evil binding - (cl-remove-duplicates - (append bindings - (which-key--get-keymap-bindings def all prefix)) - :test (lambda (a b) (string= (car a) (car b)) - ((and (keymapp def) - (string-match-p which-key--evil-keys-regexp key-desc))) - ((and (keymapp def) - (or all - ;; event 27 is escape, so this will pick up meta - ;; bindings and hopefully not too much more - (and (numberp ev) (= ev 27 -(setq bindings - (append bindings - (which-key--get-keymap-bindings def t key - (t -(when def - (cl-pushnew - (cons key-desc - (cond - ((keymapp def) "Prefix Command") - ((symbolp def) (copy-sequence (symbol-name def))) - ((eq 'lambda (car-safe def)) "lambda") - ((eq 'menu-item (car-safe def)) "menu-item") - ((stringp def) def) - ((vectorp def) (key-description def)) - ((consp def) (car def)) - (t "unknown"))) - bindings :test (lambda (a b) (string= (car a) (car b) - keymap) -bindings)) - (defun which-key--compute-binding (binding) "Replace BINDING with remapped binding if it exists. @@ -1849,78 +1798,74 @@ Requires `which-key-compute-remaps' to be non-nil" (if (and which-key-compute-remaps (setq remap (command-remapping (intern binding (copy-sequence (symbol-name remap)) - binding))) + (copy-sequence (symbol-name binding) + +(defun which-key--get-keymap-bindings-1 +"Helper function for `which-key--get-keymap-bindings'" +(keymap start &optional prefix all ignore-commands) + (let ((bindings start) +(prefix-map (if prefix (lookup-key keymap prefix) keymap))) +(when (keymapp prefix-map) + (map-keymap + (lambda (ev def) + (let* ((key (append prefix (list ev))) +(key-desc (key-description key))) + (cond +((assoc key-desc bindings)) +((and (listp ignore-commands) (symbolp def) (memq def ignore-commands))) +((or (string-match-p + which-key--ignore-non-evil-keys-regexp key-desc) + (eq ev 'menu-bar))) +((and (keymapp def) + (string-match-p which-key--evil-keys-regexp key-desc))) +((and (keymapp def) + (or all + ;; event 27 is escape, so this will pick up meta + ;; bindings and hopefully not too much more + (and (numberp ev) (= ev 27 + (setq bindings + (which-key--get-keymap-bindings-1 +keymap bindings key all ignore-commands))) +(def + (push + (cons key-desc +(cond + ((keymapp def) "+prefix") + ((symbolp def) (which-key--compute-binding def)) + ((eq 'lambda (car-safe def)) "lambda") + ((eq 'menu-item (car-sa
[elpa] externals/which-key d8445fd 24/32: Try again to fix tests
branch: externals/which-key commit d8445fd80e81b6ad2acdb5be2e36740e6d4839d7 Author: Justin Burkett Commit: Justin Burkett Try again to fix tests --- which-key-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/which-key-tests.el b/which-key-tests.el index e2cd0ef..40566e7 100644 --- a/which-key-tests.el +++ b/which-key-tests.el @@ -26,6 +26,7 @@ (require 'which-key) (require 'ert) +(require 'evil) (ert-deftest which-key-test--keymap-based-bindings () (let ((map (make-sparse-keymap)) @@ -141,7 +142,6 @@ (evil-local-mode t) (evil-state 'normal) which-key-replacement-alist) -(require 'evil) (define-key map [which-key-a] '(which-key "blah")) (define-key map "b" 'ignore) (define-key map "c" "c")
[elpa] externals/which-key 465d2fb 10/32: Fix add-keymap-based-bindings and associated test
branch: externals/which-key commit 465d2fb2e4540257ad515f37f2cb4e419b286f8c Author: Justin Burkett Commit: Justin Burkett Fix add-keymap-based-bindings and associated test --- which-key-tests.el | 25 +++-- which-key.el | 12 +++- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/which-key-tests.el b/which-key-tests.el index eeedb55..0461737 100644 --- a/which-key-tests.el +++ b/which-key-tests.el @@ -29,20 +29,17 @@ (ert-deftest which-key-test--keymap-based-bindings () (let ((map (make-sparse-keymap)) -(emacs-lisp-mode-map (copy-keymap emacs-lisp-mode-map))) -(emacs-lisp-mode) -(define-key map "x" 'ignore) -(define-key emacs-lisp-mode-map "\C-c\C-a" 'complete) -(define-key emacs-lisp-mode-map "\C-c\C-b" map) -(which-key-add-keymap-based-replacements emacs-lisp-mode-map - "C-c C-a" '("mycomplete" . complete) - "C-c C-b" "mymap") -(should (equal - (which-key--maybe-replace '("C-c C-a" . "complete")) - '("C-c C-a" . "mycomplete"))) -(should (equal - (which-key--maybe-replace '("C-c C-b" . "")) - '("C-c C-b" . "mymap") +(prefix-map (make-sparse-keymap))) +(define-key prefix-map "x" 'ignore) +(define-key map "\C-a" 'complete) +(define-key map "\C-b" prefix-map) +(which-key-add-keymap-based-replacements map + "C-a" '("mycomplete" . complete) + "C-b" "mymap") +(should (equal + (which-key--get-keymap-bindings map) + '(("C-a" . "mycomplete") + ("C-b" . "mymap")) (ert-deftest which-key-test--prefix-declaration () "Test `which-key-declare-prefixes' and diff --git a/which-key.el b/which-key.el index d6baa70..ec3f760 100644 --- a/which-key.el +++ b/which-key.el @@ -914,11 +914,13 @@ both have the same effect for the \"C-x C-w\" key binding, but the latter causes which-key to verify that the key sequence is actually bound to write-file before performing the replacement." (while key -(let ((string (if (stringp replacement) - replacement -(car-safe replacement))) - (command (cdr-safe replacement))) - (define-key keymap (kbd key) (cons string command))) +(cond ((consp replacement) + (define-key keymap (kbd key) replacement)) + ((stringp replacement) + (define-key keymap (kbd key) (cons replacement + (lookup-key keymap (kbd key) + (t + (user-error "replacement is neither a cons cell or a string"))) (setq key (pop more) replacement (pop more (put 'which-key-add-keymap-based-replacements 'lisp-indent-function 'defun)
[elpa] externals/which-key 7abe54f 31/32: Handle closure definition type
branch: externals/which-key commit 7abe54fa1d4aa714d9414bc6877ef2124ce126fe Author: Justin Burkett Commit: Justin Burkett Handle closure definition type Fixes #311 --- which-key.el | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/which-key.el b/which-key.el index 67b185f..1213d14 100644 --- a/which-key.el +++ b/which-key.el @@ -1790,11 +1790,15 @@ Requires `which-key-compute-remaps' to be non-nil" ((keymapp def) "prefix") ((symbolp def) (which-key--compute-binding def)) ((eq 'lambda (car-safe def)) "lambda") +((eq 'closure (car-safe def)) "closure") ((stringp def) def) ((vectorp def) (key-description def)) -((consp def) (concat (when (keymapp (cdr-safe def)) - "group:") - (car def))) +((and (consp def) + ;; looking for (STRING . DEFN) + (stringp (car def))) + (concat (when (keymapp (cdr-safe def)) + "group:") + (car def))) (t "unknown") (when (or (null filter) (and (functionp filter)
[elpa] externals/which-key fffd3e5 07/32: Fix default of which-key-replacement-alist
branch: externals/which-key commit fffd3e5ebfbd5a38f1f78197452c13330762dc9a Author: Justin Burkett Commit: Justin Burkett Fix default of which-key-replacement-alist --- which-key.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/which-key.el b/which-key.el index 5c2ca80..bb1cf01 100644 --- a/which-key.el +++ b/which-key.el @@ -152,9 +152,7 @@ remapped given the currently active keymaps." (defcustom which-key-replacement-alist (delq nil -`(((nil . "Prefix Command") . (nil . "prefix")) - ((nil . "\\`\\?\\?\\'") . (nil . "lambda")) - ((nil . "which-key-show-next-page-no-cycle") . (nil . "wk next pg")) +`(((nil . "which-key-show-next-page-no-cycle") . (nil . "wk next pg")) ,@(unless which-key-dont-use-unicode '((("") . ("←")) (("") . ("→"
[elpa] externals/which-key 300c098 16/32: Update README
branch: externals/which-key commit 300c098be55d78d5d94da59da0280a8a56cc3792 Author: Justin Burkett Commit: Justin Burkett Update README --- README.org | 28 +++- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/README.org b/README.org index 3064466..2280f70 100644 --- a/README.org +++ b/README.org @@ -3,6 +3,11 @@ [[http://stable.melpa.org/#/which-key][file:http://stable.melpa.org/packages/which-key-badge.svg]] ** Recent Changes +*** 2021-06-21: Add support for menu-item bindings +=which-key= will now detect and compute the result of =menu-item= +bindings. As a consequence of reworking the internals, +=which-key-enable-extended-define-key= is now obsolete (the associated +behavior is supported by default). *** 2020-08-28: Added =which-key-add-keymap-based-replacements= This function provides an alternative interface allowing replacements to be @@ -34,6 +39,7 @@ ** Table of Contents :TOC_3: - [[#which-key][which-key]] - [[#recent-changes][Recent Changes]] +- [[#2021-06-21-add-support-for-menu-item-bindings][2021-06-21: Add support for menu-item bindings]] - [[#2020-08-28-added-which-key-add-keymap-based-replacements][2020-08-28: Added =which-key-add-keymap-based-replacements=]] - [[#2019-08-01-added-which-key-show-early-on-c-h][2019-08-01: Added =which-key-show-early-on-C-h=]] - [[#2017-12-13-added-which-key-enable-extended-define-key][2017-12-13: Added =which-key-enable-extended-define-key=]] @@ -275,30 +281,26 @@ "f" '("foo" . long-command-name-foo) ;; or ;; "f" "foo" (see the docstring) - "b" '("bar-prefix") + "b" '("bar-prefix" . (keymap)) ;; or ;; "b" "bar-prefix" (see the docstring) ) #+END_SRC uses =define-key= to add two bindings and tells which-key to use the string - "foo" in place of "command-foo" and the string "bar-prefix" for - some-prefix-map. Note that =which-key-add-keymap-based-replacements= will - not bind a command, so =define-key= must still be used. - - Alternatively, you may set =which-key-enable-extended-define-key= to =t= - before loading which-key and accomplish the same effect using only - =define-key= as follows. + "foo" in place of "command-foo" and the string "bar-prefix" for an empty + prefix map. =which-key-add-keymap-based-replacements= uses =define-key= to + bind (or rebind) the command, and you may also use =define-key= directly as + follows. #+BEGIN_SRC emacs-lisp (define-key some-map "f" '("foo" . command-foo)) - (define-key some-map "b" '("bar-prefix")) + (define-key some-map "b" '("bar-prefix" . (keymap))) #+END_SRC - The option =which-key-enable-extended-define-key= advises =define-key= to - allow which-key to use the =(NAME . COMMAND)= notation to simultaneously - define a command and give that command a name using =define-key=. Since - many key-binding utilities use =define-key= internally, this functionality + Here =define-key= uses the natively supported =(NAME . COMMAND)= notation + to simultaneously define a command and give that command a name. Since many + key-binding utilities use =define-key= internally, this functionality should be available with your favorite method of defining keys as well. There are other methods of telling which-key to replace command names,
[elpa] externals/which-key 8a558e6 06/32: Update tests
branch: externals/which-key commit 8a558e6a794da76f689f8404f9e7e8d030cfb49c Author: Justin Burkett Commit: Justin Burkett Update tests --- which-key-tests.el | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/which-key-tests.el b/which-key-tests.el index 1611d51..17d5d0d 100644 --- a/which-key-tests.el +++ b/which-key-tests.el @@ -151,16 +151,14 @@ (should (equal (sort (which-key--get-keymap-bindings map) (lambda (a b) (string-lessp (car a) (car b - '(("b" . "ignore") - ("c" . "c") - ("d" . "Prefix Command") - ("e" . "Prefix Command") + '(("c" . "c") + ("d" . "prefix") + ("e" . "prefix") ("f" . "{ - C-f" (should (equal - (sort (which-key--get-keymap-bindings map t) + (sort (which-key--get-keymap-bindings map nil nil nil t) (lambda (a b) (string-lessp (car a) (car b - '(("b" . "ignore") - ("c" . "c") + '(("c" . "c") ("d d" . "dd") ("e e e" . "eee") ("f" . "{ - C-f"))
[elpa] externals/which-key 8d6d81d 09/32: Expand get-keymap-bindings test
branch: externals/which-key commit 8d6d81da4c7be4c929e908b1737dfd6d4c2aaa63 Author: Justin Burkett Commit: Justin Burkett Expand get-keymap-bindings test --- Cask | 1 + which-key-tests.el | 21 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Cask b/Cask index 60fa07c..6ff7bbe 100644 --- a/Cask +++ b/Cask @@ -4,4 +4,5 @@ (package-file "which-key.el") (development + (depends-on "evil") (depends-on "ert")) diff --git a/which-key-tests.el b/which-key-tests.el index 17d5d0d..eeedb55 100644 --- a/which-key-tests.el +++ b/which-key-tests.el @@ -141,24 +141,41 @@ (ert-deftest which-key-test--get-keymap-bindings () (let ((map (make-sparse-keymap)) +(evil-local-mode t) +(evil-state 'normal) which-key-replacement-alist) +(require 'evil) (define-key map [which-key-a] '(which-key "blah")) (define-key map "b" 'ignore) (define-key map "c" "c") (define-key map "dd" "dd") (define-key map "eee" "eee") (define-key map "f" [123 45 6]) +(define-key map (kbd "M-g g") "M-gg") +(evil-define-key* 'normal map (kbd "C-h") "C-h-normal") +(evil-define-key* 'insert map (kbd "C-h") "C-h-insert") (should (equal (sort (which-key--get-keymap-bindings map) (lambda (a b) (string-lessp (car a) (car b - '(("c" . "c") + '(("M-g" . "prefix") + ("c" . "c") + ("d" . "prefix") + ("e" . "prefix") + ("f" . "{ - C-f" +(should (equal + (sort (which-key--get-keymap-bindings map nil nil nil nil t) + (lambda (a b) (string-lessp (car a) (car b + '(("C-h" . "C-h-normal") + ("M-g" . "prefix") + ("c" . "c") ("d" . "prefix") ("e" . "prefix") ("f" . "{ - C-f" (should (equal (sort (which-key--get-keymap-bindings map nil nil nil t) (lambda (a b) (string-lessp (car a) (car b - '(("c" . "c") + '(("M-g g" . "M-gg") + ("c" . "c") ("d d" . "dd") ("e e e" . "eee") ("f" . "{ - C-f"))
[elpa] externals/which-key 6290c9e 26/32: Improve which-key-add-keymap-based-bindings
branch: externals/which-key commit 6290c9e21710c3ebbcdec795c916994682e07c94 Author: Justin Burkett Commit: Justin Burkett Improve which-key-add-keymap-based-bindings Add a test --- which-key-tests.el | 7 +-- which-key.el | 11 +-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/which-key-tests.el b/which-key-tests.el index 40566e7..877f009 100644 --- a/which-key-tests.el +++ b/which-key-tests.el @@ -36,11 +36,14 @@ (define-key map "\C-b" prefix-map) (which-key-add-keymap-based-replacements map "C-a" '("mycomplete" . complete) - "C-b" "mymap") + "C-b" "mymap" + "C-c" "mymap2") +(define-key map "\C-ca" 'foo) (should (equal (which-key--get-keymap-bindings map) '(("C-a" . "mycomplete") - ("C-b" . "group:mymap")) + ("C-b" . "group:mymap") + ("C-c" . "group:mymap2")) (ert-deftest which-key-test--prefix-declaration () "Test `which-key-declare-prefixes' and diff --git a/which-key.el b/which-key.el index 2d81d2e..2bfbb39 100644 --- a/which-key.el +++ b/which-key.el @@ -922,8 +922,15 @@ actually bound to write-file before performing the replacement." (cond ((consp replacement) (define-key keymap (kbd key) replacement)) ((stringp replacement) - (define-key keymap (kbd key) (cons replacement - (lookup-key keymap (kbd key) + (let ((binding (lookup-key keymap (kbd key + (if (or (null binding) + (numberp binding)) + ;; using a keymap in case someone intends to make this a + ;; prefix. If they want to bind something else, they will just + ;; end up overriding the prefix map + (define-key keymap (kbd key) + (cons replacement (make-sparse-keymap))) + (define-key keymap (kbd key) (cons replacement binding) (t (user-error "replacement is neither a cons cell or a string"))) (setq key (pop more)
[elpa] externals/which-key 4e592ed 08/32: Fix type usage and arglists for new functions
branch: externals/which-key commit 4e592ed7b913aecd13ce8d4e316ca4f8e2f34d7c Author: Justin Burkett Commit: Justin Burkett Fix type usage and arglists for new functions --- which-key.el | 62 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/which-key.el b/which-key.el index bb1cf01..d6baa70 100644 --- a/which-key.el +++ b/which-key.el @@ -1399,8 +1399,7 @@ Uses `string-lessp' after applying lowercase." (string-lessp (downcase (cdr acons)) (downcase (cdr bcons (defsubst which-key--group-p (description) - (or (string-match-p "^\\(group:\\|Prefix\\)" description) - (keymapp (intern description + (keymapp (intern description))) (defun which-key-prefix-then-key-order (acons bcons) "Order first by whether A and/or B is a prefix with no prefix @@ -1739,19 +1738,19 @@ alists. Returns a list (key separator description)." Requires `which-key-compute-remaps' to be non-nil" (let (remap) (if (and which-key-compute-remaps - (setq remap (command-remapping (intern binding + (setq remap (command-remapping binding))) (copy-sequence (symbol-name remap)) (copy-sequence (symbol-name binding) (defun which-key--get-keymap-bindings-1 -"Helper function for `which-key--get-keymap-bindings'" -(keymap start &optional prefix all ignore-commands) +(keymap start &optional prefix filter all ignore-commands) + "See `which-key--get-keymap-bindings'." (let ((bindings start) (prefix-map (if prefix (lookup-key keymap prefix) keymap))) (when (keymapp prefix-map) (map-keymap (lambda (ev def) - (let* ((key (append prefix (list ev))) + (let* ((key (vconcat prefix (list ev))) (key-desc (key-description key))) (cond ((assoc key-desc bindings)) @@ -1768,25 +1767,29 @@ Requires `which-key-compute-remaps' to be non-nil" (and (numberp ev) (= ev 27 (setq bindings (which-key--get-keymap-bindings-1 -keymap bindings key all ignore-commands))) +keymap bindings key nil all ignore-commands))) (def - (push - (cons key-desc -(cond - ((keymapp def) "+prefix") - ((symbolp def) (which-key--compute-binding def)) - ((eq 'lambda (car-safe def)) "lambda") - ((eq 'menu-item (car-safe def)) - (keymap--menu-item-binding def)) - ((stringp def) def) - ((vectorp def) (key-description def)) - ((consp def) (car def)) - (t "unknown"))) - bindings) + (let ((binding + (cons key-desc + (cond +((keymapp def) "prefix") +((symbolp def) (which-key--compute-binding def)) +((eq 'lambda (car-safe def)) "lambda") +((eq 'menu-item (car-safe def)) + (keymap--menu-item-binding def)) +((stringp def) def) +((vectorp def) (key-description def)) +((consp def) (car def)) +(t "unknown") + (when (or (null filter) + (and (functionp filter) + (funcall filter binding))) + (push binding bindings))) prefix-map)) bindings)) -(defun which-key--get-keymap-bindings (keymap &optional prefix start all evil) +(defun which-key--get-keymap-bindings +(keymap &optional start prefix filter all evil) "Retrieve top-level bindings from KEYMAP. PREFIX limits bindings to those starting with this key sequence. START is a list of existing bindings to add to. If ALL @@ -1799,16 +1802,18 @@ EVIL is non-nil, extract active evil bidings." (lookup-key keymap (kbd (format "<%s-state>" evil-state)) (when (keymapp evil-map) (setq bindings (which-key--get-keymap-bindings-1 - evil-map bindings prefix all ignore))) -(which-key--get-keymap-bindings-1 keymap bindings prefix all ignore))) + evil-map bindings prefix filter all ignore))) +(which-key--get-keymap-bindings-1 + keymap bindings prefix filter all ignore))) -(defun which-key--get-current-bindings (&optional prefix) +(defun which-key--get-current-bindings (&optional prefix filter) "Generate a list of current active bindings." (let (bindings) (dolist (map (current-active-maps t) bindings) (when (cdr map) (setq bindings - (which-key--get-keymap-bindings map prefix bindings)) + (which-key--get-keymap-bindin
[elpa] externals/which-key 2444833 12/32: Fix menu-item bidning retrieval
branch: externals/which-key commit 244483334044ebd87a10608eae124111c8837823 Author: Justin Burkett Commit: Justin Burkett Fix menu-item bidning retrieval --- which-key.el | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/which-key.el b/which-key.el index 55e65b8..ebed572 100644 --- a/which-key.el +++ b/which-key.el @@ -1745,6 +1745,14 @@ Requires `which-key-compute-remaps' to be non-nil" (copy-sequence (symbol-name remap)) (copy-sequence (symbol-name binding) +(defun which-key--get-menu-item-binding (def) + "Retrieve binding for menu-item" + ;; see `keymap--menu-item-binding' + (let* ((binding (nth 2 def)) + (plist (nthcdr 3 def)) + (filter (plist-get plist :filter))) +(if filter (funcall filter binding) binding))) + (defun which-key--get-keymap-bindings-1 (keymap start &optional prefix filter all ignore-commands) "See `which-key--get-keymap-bindings'." @@ -1772,14 +1780,17 @@ Requires `which-key-compute-remaps' to be non-nil" (which-key--get-keymap-bindings-1 keymap bindings key nil all ignore-commands))) (def - (let ((binding + (let* ((def (if (eq 'menu-item (car-safe def)) + (which-key--get-menu-item-binding def) + def)) +(binding (cons key-desc (cond ((keymapp def) "prefix") ((symbolp def) (which-key--compute-binding def)) ((eq 'lambda (car-safe def)) "lambda") ((eq 'menu-item (car-safe def)) - (keymap--menu-item-binding def)) + (which-key--get-menu-item-binding def)) ((stringp def) def) ((vectorp def) (key-description def)) ((consp def) (car def))
[elpa] externals/which-key 6ae80f5 22/32: Try without cask
branch: externals/which-key commit 6ae80f50af838ff2bcf6448a55366fb37fb20682 Author: Justin Burkett Commit: Justin Burkett Try without cask --- .github/workflows/test.yml | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f764d32..87331b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,21 +20,11 @@ jobs: - 27.2 - snapshot steps: - - name: Install Python -uses: actions/setup-python@v2 -with: - python-version: '3.6' - architecture: 'x64' - uses: purcell/setup-emacs@master with: version: ${{ matrix.emacs_version }} - - uses: actions/checkout@v2 - - name: Install Cask -uses: conao3/setup-cask@master -with: - version: 'snapshot' - name: Install dependencies -run: 'cask install' +run: 'git clone https://github.com/emacs-evil/evil' - name: Run tests -run: 'cask exec emacs -Q -batch -L . -l which-key-tests.el -f ert-run-tests-batch-and-exit' +run: 'emacs -Q -batch -L . -L ./evil -l which-key-tests.el -f ert-run-tests-batch-and-exit'
[elpa] externals/which-key 063b867 18/32: Fix github action
branch: externals/which-key commit 063b8670305527f027c4ddeb7861f4ad7f6ca2a5 Author: Justin Burkett Commit: Justin Burkett Fix github action --- .github/workflows/test.yml | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ae6288..c2f1491 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,12 +13,11 @@ jobs: strategy: matrix: emacs_version: - - 25.1 - - 25.2 - - 25.3 - 26.1 - 26.2 - 26.3 + - 27.1 + - 27.2 - snapshot steps: - uses: purcell/setup-emacs@master @@ -26,5 +25,11 @@ jobs: version: ${{ matrix.emacs_version }} - uses: actions/checkout@v2 +- name: Install cask + run: | +git clone https://github.com/cask/cask ~/.cask +echo "${HOME}/.cask/bin" >> $GITHUB_PATH +- name: Install dependencies + run: 'cask install' - name: Run tests run: 'emacs -Q -batch -L . -l which-key-tests.el -f ert-run-tests-batch-and-exit'
[elpa] externals/which-key d621634 19/32: Try with cask again
branch: externals/which-key commit d621634eb606ab68b718f1eeda71bff2763733ca Author: Justin Burkett Commit: Justin Burkett Try with cask again --- .github/workflows/test.yml | 10 +- Cask | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2f1491..5b3078c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,11 +25,11 @@ jobs: version: ${{ matrix.emacs_version }} - uses: actions/checkout@v2 -- name: Install cask - run: | -git clone https://github.com/cask/cask ~/.cask -echo "${HOME}/.cask/bin" >> $GITHUB_PATH +- name: Install Cask + uses: conao3/setup-cask@master + with: +version: 'snapshot' - name: Install dependencies run: 'cask install' - name: Run tests - run: 'emacs -Q -batch -L . -l which-key-tests.el -f ert-run-tests-batch-and-exit' + run: 'cask exec emacs -Q -batch -L . -l which-key-tests.el -f ert-run-tests-batch-and-exit' diff --git a/Cask b/Cask index 6ff7bbe..31a9ca1 100644 --- a/Cask +++ b/Cask @@ -4,5 +4,4 @@ (package-file "which-key.el") (development - (depends-on "evil") - (depends-on "ert")) + (depends-on "evil"))
[elpa] externals/which-key e236920 14/32: Merge branch 'alt-get-bindings'
branch: externals/which-key commit e236920b231ee1d86ae215598f7a9d8294467310 Merge: 1f9c37d d6b56f3 Author: Justin Burkett Commit: Justin Burkett Merge branch 'alt-get-bindings' --- Cask | 1 + which-key-tests.el | 52 + which-key.el | 320 +++-- 3 files changed, 147 insertions(+), 226 deletions(-) diff --git a/Cask b/Cask index 60fa07c..6ff7bbe 100644 --- a/Cask +++ b/Cask @@ -4,4 +4,5 @@ (package-file "which-key.el") (development + (depends-on "evil") (depends-on "ert")) diff --git a/which-key-tests.el b/which-key-tests.el index 1611d51..705099b 100644 --- a/which-key-tests.el +++ b/which-key-tests.el @@ -29,20 +29,17 @@ (ert-deftest which-key-test--keymap-based-bindings () (let ((map (make-sparse-keymap)) -(emacs-lisp-mode-map (copy-keymap emacs-lisp-mode-map))) -(emacs-lisp-mode) -(define-key map "x" 'ignore) -(define-key emacs-lisp-mode-map "\C-c\C-a" 'complete) -(define-key emacs-lisp-mode-map "\C-c\C-b" map) -(which-key-add-keymap-based-replacements emacs-lisp-mode-map - "C-c C-a" '("mycomplete" . complete) - "C-c C-b" "mymap") -(should (equal - (which-key--maybe-replace '("C-c C-a" . "complete")) - '("C-c C-a" . "mycomplete"))) -(should (equal - (which-key--maybe-replace '("C-c C-b" . "")) - '("C-c C-b" . "mymap") +(prefix-map (make-sparse-keymap))) +(define-key prefix-map "x" 'ignore) +(define-key map "\C-a" 'complete) +(define-key map "\C-b" prefix-map) +(which-key-add-keymap-based-replacements map + "C-a" '("mycomplete" . complete) + "C-b" "mymap") +(should (equal + (which-key--get-keymap-bindings map) + '(("C-a" . "mycomplete") + ("C-b" . "mymap")) (ert-deftest which-key-test--prefix-declaration () "Test `which-key-declare-prefixes' and @@ -141,25 +138,40 @@ (ert-deftest which-key-test--get-keymap-bindings () (let ((map (make-sparse-keymap)) +(evil-local-mode t) +(evil-state 'normal) which-key-replacement-alist) +(require 'evil) (define-key map [which-key-a] '(which-key "blah")) (define-key map "b" 'ignore) (define-key map "c" "c") (define-key map "dd" "dd") (define-key map "eee" "eee") (define-key map "f" [123 45 6]) +(define-key map (kbd "M-g g") "M-gg") +(evil-define-key* 'normal map (kbd "C-h") "C-h-normal") +(evil-define-key* 'insert map (kbd "C-h") "C-h-insert") (should (equal (sort (which-key--get-keymap-bindings map) (lambda (a b) (string-lessp (car a) (car b - '(("b" . "ignore") + '(("M-g" . "prefix") + ("c" . "c") + ("d" . "prefix") + ("e" . "prefix") + ("f" . "{ - C-f" +(should (equal + (sort (which-key--get-keymap-bindings map nil nil nil nil t) + (lambda (a b) (string-lessp (car a) (car b + '(("C-h" . "C-h-normal") + ("M-g" . "prefix") ("c" . "c") - ("d" . "Prefix Command") - ("e" . "Prefix Command") + ("d" . "prefix") + ("e" . "prefix") ("f" . "{ - C-f" (should (equal - (sort (which-key--get-keymap-bindings map t) + (sort (which-key--get-keymap-bindings map nil nil nil t) (lambda (a b) (string-lessp (car a) (car b - '(("b" . "ignore") + '(("M-g g" . "M-gg") ("c" . "c") ("d d" . "dd") ("e e e" . "eee") @@ -177,7 +189,7 @@ ("A" . "Z") ("b" . "y") ("B" . "Y") -("p" . "Prefix") +("p" . "prefix") ("SPC" . "x") ("C-a" . "w" (let ((which-key-sort-uppercase-first t)) diff --git a/which-key.el b/which-key.el index 6d69482..c133beb 100644 --- a/which-key.el +++ b/which-key.el @@ -152,9 +152,7 @@ remapped given the currently active keymaps." (defcustom which-key-replacement-alist (delq nil -`(((nil . "Prefix Command") . (nil . "prefix")) - ((nil . "\\`\\?\\?\\'") . (nil . "lambda")) - ((nil . "which-key-show-next-page-no-cycle") . (nil . "wk next pg")) +`(((nil . "which-key-show-next-page-no-cycle") . (nil . "wk next pg")) ,@(unless which-key-dont-use-unicode '((("") . ("←")) (("") . ("→" @@ -524,24 +522,6 @@ it." :group 'which-key :type 'boolean) -(defcustom which-key-enable-extended-define-key nil - "Advise `define-key' to make which-key aware of definitions of the form - - \(define-key KEYMAP KEY '(\"DESCRIPTION\" . DEF)) - -With the advice, this definition will have the side effect of -creating a replacement in `whi
[elpa] externals/which-key 11471fb 21/32: Add install python step to github action
branch: externals/which-key commit 11471fb73804fbe6b2bc19f2a1133f4a46853e20 Author: Justin Burkett Commit: Justin Burkett Add install python step to github action --- .github/workflows/test.yml | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5b3078c..f764d32 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,16 +20,21 @@ jobs: - 27.2 - snapshot steps: -- uses: purcell/setup-emacs@master - with: -version: ${{ matrix.emacs_version }} + - name: Install Python +uses: actions/setup-python@v2 +with: + python-version: '3.6' + architecture: 'x64' + - uses: purcell/setup-emacs@master +with: + version: ${{ matrix.emacs_version }} -- uses: actions/checkout@v2 -- name: Install Cask - uses: conao3/setup-cask@master - with: -version: 'snapshot' -- name: Install dependencies - run: 'cask install' -- name: Run tests - run: 'cask exec emacs -Q -batch -L . -l which-key-tests.el -f ert-run-tests-batch-and-exit' + - uses: actions/checkout@v2 + - name: Install Cask +uses: conao3/setup-cask@master +with: + version: 'snapshot' + - name: Install dependencies +run: 'cask install' + - name: Run tests +run: 'cask exec emacs -Q -batch -L . -l which-key-tests.el -f ert-run-tests-batch-and-exit'
[elpa] externals/which-key eb5a2e3 28/32: Clean up some docstrings
branch: externals/which-key commit eb5a2e3de16dca7286a323bad62b55d3c08349e0 Author: Justin Burkett Commit: Justin Burkett Clean up some docstrings --- which-key.el | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/which-key.el b/which-key.el index 9a2883d..3a0ce97 100644 --- a/which-key.el +++ b/which-key.el @@ -254,7 +254,7 @@ disabled by default. Try this to see the effect. :type 'string) (defcustom which-key-show-prefix 'echo - "Whether to and where to display the current prefix sequence. + "Whether to and where to display the current prefix sequence Possible choices are echo for echo area (the default), left, top and nil. Nil turns the feature off." :group 'which-key @@ -266,7 +266,7 @@ and nil. Nil turns the feature off." (const :tag "Hide" nil))) (defcustom which-key-popup-type 'side-window - "Supported types are minibuffer, side-window, frame, and custom." + "Supported types are minibuffer, side-window, frame, and custom" :group 'which-key :type '(radio (const :tag "Show in minibuffer" minibuffer) (const :tag "Show in side window" side-window) @@ -274,12 +274,12 @@ and nil. Nil turns the feature off." (const :tag "Use your custom display functions" custom))) (defcustom which-key-min-display-lines 1 - "The minimum number of horizontal lines to display in the which-key buffer." + "Minimum number of horizontal lines to display in the which-key buffer" :group 'which-key :type 'integer) (defcustom which-key-max-display-columns nil - "The maximum number of columns to display in the which-key buffer. + "Maximum number of columns to display in the which-key buffer nil means don't impose a maximum." :group 'which-key :type '(choice integer (const :tag "Unbounded" nil))) @@ -304,25 +304,23 @@ location is tried." docstring of `display-buffer-in-side-window', ‘slot’ if non-nil, specifies the window slot where to display - BUFFER. A value of zero or nil means use the middle slot on - the specified side. A negative value means use a slot - preceding (that is, above or on the left of) the middle slot. - A positive value means use a slot following (that is, below or - on the right of) the middle slot. The default is zero." +BUFFER. A value of zero or nil means use the middle slot on the +specified side. A negative value means use a slot +preceding (that is, above or on the left of) the middle slot. A +positive value means use a slot following (that is, below or on +the right of) the middle slot. The default is zero." :group 'which-key :type 'integer) (defcustom which-key-side-window-max-width 0.333 - "Maximum width of which-key popup when type is side-window and -location is left or right. -This variable can also be a number between 0 and 1. In that case, it denotes -a percentage out of the frame's width." + "Maximum width of which-key popup when type is side-window +This variable can also be a number between 0 and 1. In that case, +it denotes a percentage out of the frame's width." :group 'which-key :type 'float) (defcustom which-key-side-window-max-height 0.25 - "Maximum height of which-key popup when type is side-window and -location is top or bottom. + "Maximum height of which-key popup when type is side-window This variable can also be a number between 0 and 1. In that case, it denotes a percentage out of the frame's height." :group 'which-key
[elpa] externals/which-key 8b707ef 15/32: Make enable-extended-define-key obsolete
branch: externals/which-key commit 8b707ef6c51808e944f8056b546ceb168a445079 Author: Justin Burkett Commit: Justin Burkett Make enable-extended-define-key obsolete --- which-key.el | 5 + 1 file changed, 5 insertions(+) diff --git a/which-key.el b/which-key.el index c133beb..2c4004f 100644 --- a/which-key.el +++ b/which-key.el @@ -522,6 +522,11 @@ it." :group 'which-key :type 'boolean) +(make-obsolete-variable + 'which-key-enable-extended-define-key + "which-key-enable-extended-define-key is obsolete and has no effect." + "2021-06-21") + ;; Hooks (defcustom which-key-init-buffer-hook '() "Hook run when which-key buffer is initialized."
[elpa] externals/which-key b83c0de 27/32: Clean up which-key--maybe-replace
branch: externals/which-key commit b83c0deca652ee3d42c1501dd09416b2505304b7 Author: Justin Burkett Commit: Justin Burkett Clean up which-key--maybe-replace --- which-key.el | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/which-key.el b/which-key.el index 2bfbb39..9a2883d 100644 --- a/which-key.el +++ b/which-key.el @@ -1506,7 +1506,7 @@ local bindings coming first. Within these categories order using (setq key-binding (which-key--replace-in-binding key-binding repl (when found `(replaced . ,key-binding -(defun which-key--maybe-replace (key-binding &optional prefix) +(defun which-key--maybe-replace (key-binding) "Use `which-key--replacement-alist' to maybe replace KEY-BINDING. KEY-BINDING is a cons cell of the form \(KEY . BINDING\) each of which are strings. KEY is of the form produced by `key-binding'." @@ -1721,17 +1721,13 @@ alists. Returns a list (key separator description)." (local-map (current-local-map)) new-list) (dolist (key-binding unformatted) - (let* ((key (car key-binding)) + (let* ((keys (car key-binding)) (orig-desc (cdr key-binding)) (group (which-key--group-p orig-desc)) - ;; At top-level prefix is nil - (keys (if prefix - (concat (key-description prefix) " " key) - key)) (local (eq (which-key--safe-lookup-key local-map (kbd keys)) (intern orig-desc))) (hl-face (which-key--highlight-face orig-desc)) - (key-binding (which-key--maybe-replace (cons keys orig-desc) prefix)) + (key-binding (which-key--maybe-replace key-binding)) (final-desc (which-key--propertize-description (cdr key-binding) group local hl-face orig-desc))) (when final-desc
[elpa] externals/which-key 4c27fc0 30/32: Improve which-key-add-keymap-based-replacements.
branch: externals/which-key commit 4c27fc0c565cdda58270dae4024ad03a0017de43 Author: Justin Burkett Commit: Justin Burkett Improve which-key-add-keymap-based-replacements. Also, teach which-key--safe-lookup-key to handle numeric results. --- which-key.el | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/which-key.el b/which-key.el index 8598fa6..67b185f 100644 --- a/which-key.el +++ b/which-key.el @@ -909,20 +909,16 @@ For backwards compatibility, REPLACEMENT can also be a string, but the above format is preferred, and the option to use a string for REPLACEMENT will eventually be removed." (while key -(cond ((consp replacement) - (define-key keymap (kbd key) replacement)) - ((stringp replacement) - (let ((binding (lookup-key keymap (kbd key - (if (or (null binding) - (numberp binding)) - ;; using a keymap in case someone intends to make this a - ;; prefix. If they want to bind something else, they will just - ;; end up overriding the prefix map - (define-key keymap (kbd key) - (cons replacement (make-sparse-keymap))) - (define-key keymap (kbd key) (cons replacement binding) - (t - (user-error "replacement is neither a cons cell or a string"))) +(let ((def + (cond +((consp replacement) replacement) +((stringp replacement) + (cons replacement + (or (which-key--safe-lookup-key keymap (kbd key)) + (make-sparse-keymap +(t + (user-error "replacement is neither a cons cell or a string") + (define-key keymap (kbd key) def)) (setq key (pop more) replacement (pop more (put 'which-key-add-keymap-based-replacements 'lisp-indent-function 'defun) @@ -1445,8 +1441,13 @@ local bindings coming first. Within these categories order using (if (stringp maybe-string) (string-width maybe-string) 0)) (defsubst which-key--safe-lookup-key (keymap key) - "Version of `lookup-key' that allows KEYMAP to be nil. KEY is not checked." - (when (keymapp keymap) (lookup-key keymap key))) + "Version of `lookup-key' that allows KEYMAP to be nil. +Also convert numeric results of `lookup-key' to nil. KEY is not +checked." + (when (keymapp keymap) +(let ((result (lookup-key keymap key))) + (when (and result (not (numberp result))) +result (defsubst which-key--butlast-string (str) (mapconcat #'identity (butlast (split-string str)) " "))
[elpa] externals/which-key 27d9fec 32/32: Fix compiler warnings
branch: externals/which-key commit 27d9fec33abb989b030f7677ccf5f799287d6472 Author: Justin Burkett Commit: Justin Burkett Fix compiler warnings Fixes #312 --- which-key.el | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/which-key.el b/which-key.el index 1213d14..ff0db27 100644 --- a/which-key.el +++ b/which-key.el @@ -717,9 +717,20 @@ update.") (goto-char (point-max)) (insert "\n" fmt-msg "\n") +(defsubst which-key--safe-lookup-key (keymap key) + "Version of `lookup-key' that allows KEYMAP to be nil. +Also convert numeric results of `lookup-key' to nil. KEY is not +checked." + (when (keymapp keymap) +(let ((result (lookup-key keymap key))) + (when (and result (not (numberp result))) +result + ;;; Third-party library support Evil +(defvar evil-state nil) + (defcustom which-key-allow-evil-operators (boundp 'evil-this-operator) "Allow popup to show for evil operators. The popup is normally inhibited in the middle of commands, but @@ -1440,15 +1451,6 @@ local bindings coming first. Within these categories order using "If MAYBE-STRING is a string use `which-key--string-width' o/w return 0." (if (stringp maybe-string) (string-width maybe-string) 0)) -(defsubst which-key--safe-lookup-key (keymap key) - "Version of `lookup-key' that allows KEYMAP to be nil. -Also convert numeric results of `lookup-key' to nil. KEY is not -checked." - (when (keymapp keymap) -(let ((result (lookup-key keymap key))) - (when (and result (not (numberp result))) -result - (defsubst which-key--butlast-string (str) (mapconcat #'identity (butlast (split-string str)) " ")) @@ -1702,7 +1704,7 @@ return the docstring." (t (format "%s %s" current docstring) -(defun which-key--format-and-replace (unformatted &optional prefix preserve-full-key) +(defun which-key--format-and-replace (unformatted &optional preserve-full-key) "Take a list of (key . desc) cons cells in UNFORMATTED, add faces and perform replacements according to the three replacement alists. Returns a list (key separator description)." @@ -1851,7 +1853,7 @@ non-nil, then bindings are collected recursively for all prefixes." (when which-key-sort-order (setq unformatted (sort unformatted which-key-sort-order))) -(which-key--format-and-replace unformatted prefix recursive))) +(which-key--format-and-replace unformatted recursive))) ;;; Functions for laying out which-key buffer pages
[elpa] externals/which-key 7d344ce 17/32: Fix test
branch: externals/which-key commit 7d344ce9661549f9b516ac4c308ec7b8d53aaf51 Author: Justin Burkett Commit: Justin Burkett Fix test --- which-key-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/which-key-tests.el b/which-key-tests.el index 705099b..e2cd0ef 100644 --- a/which-key-tests.el +++ b/which-key-tests.el @@ -39,7 +39,7 @@ (should (equal (which-key--get-keymap-bindings map) '(("C-a" . "mycomplete") - ("C-b" . "mymap")) + ("C-b" . "group:mymap")) (ert-deftest which-key-test--prefix-declaration () "Test `which-key-declare-prefixes' and
[elpa] externals/which-key 28f386c 25/32: Fix key sort order functions
branch: externals/which-key commit 28f386cc4af8c0fe21269bb587a5bb229ba3834e Author: Justin Burkett Commit: Justin Burkett Fix key sort order functions We now always get the full key description (prefix + binding) --- which-key.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/which-key.el b/which-key.el index 13c440d..2d81d2e 100644 --- a/which-key.el +++ b/which-key.el @@ -1343,7 +1343,9 @@ width) in lines and characters respectively." "Sorting function used for `which-key-key-order' and `which-key-key-order-alpha'." (save-match-data -(let* ((rngrgxp "^\\([^ ]+\\) \\.\\. [^ ]+") +(let* ((a (which-key--extract-key a)) + (b (which-key--extract-key b)) + (rngrgxp "^\\([^ ]+\\) \\.\\. [^ ]+") (a (if (string-match rngrgxp a) (match-string 1 a) a)) (b (if (string-match rngrgxp b) (match-string 1 b) b)) (aem? (string-equal a ""))
[elpa] externals/which-key cd0c48c 29/32: Clarify usage of keymap replacements in docstrings and README
branch: externals/which-key commit cd0c48cda2e7cc1d3bc93d3611e267a7d022de8a Author: Justin Burkett Commit: Justin Burkett Clarify usage of keymap replacements in docstrings and README --- README.org | 43 ++- which-key.el | 28 ++-- 2 files changed, 32 insertions(+), 39 deletions(-) diff --git a/README.org b/README.org index 2280f70..37c742e 100644 --- a/README.org +++ b/README.org @@ -271,37 +271,38 @@ Keymap-based replacement Using this method, which-key can display a custom string for a key definition in some keymap. There are two ways to define a keymap-based - replacement. The first is to use - =which-key-add-keymap-based-replacements=. The statement + replacement. The preferred way is to use =define-key= (or a command that + uses =define-key= internally) with a cons cell as the definition. For + example, + + #+BEGIN_SRC emacs-lisp + (define-key some-map "f" '("foo" . command-foo)) + (define-key some-map "b" '("bar-prefix" . (keymap))) + #+END_SRC + + binds =command-foo= to =f= in =some-map=, but also stores the string "foo" + which which-key will extract to use to describe this command. The second + example binds an empty keymap to =b= in =some-map= and uses "bar-prefix" to + describe it. These bindings are accepted by =define-key= natively (i.e., + with or without which-key being loaded). Since many key-binding utilities + use =define-key= internally, this functionality should be available with + your favorite method of defining keys as well. + + The second method is to use =which-key-add-keymap-based-replacements=. The + statement #+BEGIN_SRC emacs-lisp (define-key some-map "f" 'long-command-name-foo) (define-key some-map "b" some-prefix-map) (which-key-add-keymap-based-replacements some-map "f" '("foo" . long-command-name-foo) - ;; or - ;; "f" "foo" (see the docstring) - "b" '("bar-prefix" . (keymap)) - ;; or - ;; "b" "bar-prefix" (see the docstring) - ) + "b" '("bar-prefix" . (keymap))) #+END_SRC uses =define-key= to add two bindings and tells which-key to use the string "foo" in place of "command-foo" and the string "bar-prefix" for an empty - prefix map. =which-key-add-keymap-based-replacements= uses =define-key= to - bind (or rebind) the command, and you may also use =define-key= directly as - follows. - - #+BEGIN_SRC emacs-lisp - (define-key some-map "f" '("foo" . command-foo)) - (define-key some-map "b" '("bar-prefix" . (keymap))) - #+END_SRC - - Here =define-key= uses the natively supported =(NAME . COMMAND)= notation - to simultaneously define a command and give that command a name. Since many - key-binding utilities use =define-key= internally, this functionality - should be available with your favorite method of defining keys as well. + prefix map. =which-key-add-keymap-based-replacements= just uses + =define-key= to bind (or rebind) the command. There are other methods of telling which-key to replace command names, which are described next. The keymap-based replacements should be the most diff --git a/which-key.el b/which-key.el index 3a0ce97..8598fa6 100644 --- a/which-key.el +++ b/which-key.el @@ -895,27 +895,19 @@ but more functional." ;;;###autoload (defun which-key-add-keymap-based-replacements (keymap key replacement &rest more) "Replace the description of KEY using REPLACEMENT in KEYMAP. -KEY should take a format suitable for use in -`kbd'. REPLACEMENT is the string to use to describe the -command associated with KEY in the KEYMAP. You may also use a -cons cell of the form \(STRING . COMMAND\) for each REPLACEMENT, -where STRING is the replacement string and COMMAND is a symbol -corresponding to the intended command to be replaced. In the -latter case, which-key will verify the intended command before -performing the replacement. COMMAND should be nil if the binding -corresponds to a key prefix. For example, +KEY should take a format suitable for use in `kbd'. REPLACEMENT +should be a cons cell of the form \(STRING . COMMAND\) for each +REPLACEMENT, where STRING is the replacement string and COMMAND +is a symbol corresponding to the intended command to be +replaced. COMMAND can be nil if the binding corresponds to a key +prefix. An example is \(which-key-add-keymap-based-replacements global-map - \"C-x w\" \"Save as\"\) + \"C-x w\" '\(\"Save as\" . write-file\)\). -and - -\(which-key-add-keymap-based-replacements global-map - \"C-x w\" '\(\"Save as\" . write-file\)\) - -both have the same effect for the \"C-x C-w\" key binding, but -the latter causes which-key to verify that the key sequence is -actually bound to write-file before performing the replacement." +For backwards compatibility, REPLACEMENT can also be a string,
[elpa] externals/which-key e42d946 11/32: Fix prefix sorting
branch: externals/which-key commit e42d946cd98f914a0e9c31fe6cb677305a9f2d30 Author: Justin Burkett Commit: Justin Burkett Fix prefix sorting --- which-key-tests.el | 2 +- which-key.el | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/which-key-tests.el b/which-key-tests.el index 0461737..705099b 100644 --- a/which-key-tests.el +++ b/which-key-tests.el @@ -189,7 +189,7 @@ ("A" . "Z") ("b" . "y") ("B" . "Y") -("p" . "Prefix") +("p" . "prefix") ("SPC" . "x") ("C-a" . "w" (let ((which-key-sort-uppercase-first t)) diff --git a/which-key.el b/which-key.el index ec3f760..55e65b8 100644 --- a/which-key.el +++ b/which-key.el @@ -1401,7 +1401,8 @@ Uses `string-lessp' after applying lowercase." (string-lessp (downcase (cdr acons)) (downcase (cdr bcons (defsubst which-key--group-p (description) - (keymapp (intern description))) + (or (equal description "prefix") + (keymapp (intern description (defun which-key-prefix-then-key-order (acons bcons) "Order first by whether A and/or B is a prefix with no prefix
[elpa] externals/which-key 3f76f51 20/32: Fix which-key--group-p
branch: externals/which-key commit 3f76f5178d28e3b45c236ca83c37613851598abd Author: Justin Burkett Commit: Justin Burkett Fix which-key--group-p length> is a new function maybe --- which-key.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/which-key.el b/which-key.el index 2c4004f..13c440d 100644 --- a/which-key.el +++ b/which-key.el @@ -1406,8 +1406,7 @@ Uses `string-lessp' after applying lowercase." (defsubst which-key--group-p (description) (or (string-equal description "prefix") - (and (length> description 6) - (string-equal (substring description 0 6) "group:")) + (string-match-p "^group:" description) (keymapp (intern description (defun which-key-prefix-then-key-order (acons bcons)
[elpa] externals/pyim a680cf6 1/2: fixed unit test
branch: externals/pyim commit a680cf6b14cf23bbb9425e7eca026a98aa50f487 Author: Chen Bin Commit: Chen Bin fixed unit test --- .github/workflows/test.yml | 26 ++ .travis.yml| 16 README.org | 1 + tests/pyim-tests.el| 10 +- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000..a3dbc99 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: +runs-on: ubuntu-latest +strategy: + fail-fast: false + matrix: +emacs_version: + - 25.3 + - 26.3 + - 27.1 +steps: +- uses: purcell/setup-emacs@master + with: +version: ${{ matrix.emacs_version }} + +- uses: actions/checkout@v2 + +- name: Print emacs version + run: emacs --version + +- name: Run tests + run: make test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 100935e..000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: nix - -os: - - linux - -env: - - EMACS_CI=emacs-25-3 - - EMACS_CI=emacs-26-3 - - EMACS_CI=emacs-27-1 - - EMACS_CI=emacs-snapshot - -install: - - bash <(curl https://raw.githubusercontent.com/purcell/nix-emacs-ci/master/travis-install) - -script: - - bash <(make test) diff --git a/README.org b/README.org index 1badb38..84f2e67 100644 --- a/README.org +++ b/README.org @@ -2,6 +2,7 @@ #+TITLE: PYIM 是一个 Emacs 中文输入法,支持全拼,双拼,五笔,仓颉 和 Rime 等 #+AUTHOR: Feng Shu +#+html: https://github.com/tumashu/pyim/actions/workflows/test.yml";>https://github.com/tumashu/pyim/workflows/test.yml/badge.svg"/> #+html: http://elpa.gnu.org/packages/pyim.html";>https://elpa.gnu.org/packages/pyim.svg"/> #+html: http://elpa.gnu.org/devel/pyim.html";>https://elpa.gnu.org/devel/pyim.svg"/> #+html: https://melpa.org/#/pyim";>https://melpa.org/packages/pyim-badge.svg"/> diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el index bc970fd..2d663be 100644 --- a/tests/pyim-tests.el +++ b/tests/pyim-tests.el @@ -43,6 +43,12 @@ (setq default-input-method "pyim") (setq pyim-dicts (pyim-test-get-dicts)) +(ert-deftest pyim-test-generic () + (let* ((pyim-dcache-backend 'pyim-dregcache)) +(with-temp-buffer + (should (not toggle-input-method-active)) + (call-interactively #'toggle-input-method + (ert-deftest pyim-test-dregcache-backend () (let* ((pyim-dcache-backend 'pyim-dregcache) words) @@ -56,9 +62,11 @@ (setq words (pyim-dcache-get "zun-bei")) (should (eq (length words) 1)) (should (string= (nth 0 words) "尊卑")) + (setq words (pyim-dcache-get "zun")) (should (string= (nth 0 words) "尊")) -(should (eq (length words) 43 +;; `pyim-dregcache-get' calls `pyim-pymap-py2cchar-get' before return result +(should (eq (length words) 44 (ert-run-tests-batch-and-exit) ;; * Footer
[elpa] externals/pyim 259625b 2/2: Merge pull request #403 from tumashu/redguardtoo
branch: externals/pyim commit 259625b30f14376747b9cc9dd9f4b64a276306a7 Merge: 3c13e24 a680cf6 Author: tumashu Commit: GitHub Merge pull request #403 from tumashu/redguardtoo fixed unit test --- .github/workflows/test.yml | 26 ++ .travis.yml| 16 README.org | 1 + tests/pyim-tests.el| 10 +- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000..a3dbc99 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: +runs-on: ubuntu-latest +strategy: + fail-fast: false + matrix: +emacs_version: + - 25.3 + - 26.3 + - 27.1 +steps: +- uses: purcell/setup-emacs@master + with: +version: ${{ matrix.emacs_version }} + +- uses: actions/checkout@v2 + +- name: Print emacs version + run: emacs --version + +- name: Run tests + run: make test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 100935e..000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: nix - -os: - - linux - -env: - - EMACS_CI=emacs-25-3 - - EMACS_CI=emacs-26-3 - - EMACS_CI=emacs-27-1 - - EMACS_CI=emacs-snapshot - -install: - - bash <(curl https://raw.githubusercontent.com/purcell/nix-emacs-ci/master/travis-install) - -script: - - bash <(make test) diff --git a/README.org b/README.org index 1badb38..84f2e67 100644 --- a/README.org +++ b/README.org @@ -2,6 +2,7 @@ #+TITLE: PYIM 是一个 Emacs 中文输入法,支持全拼,双拼,五笔,仓颉 和 Rime 等 #+AUTHOR: Feng Shu +#+html: https://github.com/tumashu/pyim/actions/workflows/test.yml";>https://github.com/tumashu/pyim/workflows/test.yml/badge.svg"/> #+html: http://elpa.gnu.org/packages/pyim.html";>https://elpa.gnu.org/packages/pyim.svg"/> #+html: http://elpa.gnu.org/devel/pyim.html";>https://elpa.gnu.org/devel/pyim.svg"/> #+html: https://melpa.org/#/pyim";>https://melpa.org/packages/pyim-badge.svg"/> diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el index bc970fd..2d663be 100644 --- a/tests/pyim-tests.el +++ b/tests/pyim-tests.el @@ -43,6 +43,12 @@ (setq default-input-method "pyim") (setq pyim-dicts (pyim-test-get-dicts)) +(ert-deftest pyim-test-generic () + (let* ((pyim-dcache-backend 'pyim-dregcache)) +(with-temp-buffer + (should (not toggle-input-method-active)) + (call-interactively #'toggle-input-method + (ert-deftest pyim-test-dregcache-backend () (let* ((pyim-dcache-backend 'pyim-dregcache) words) @@ -56,9 +62,11 @@ (setq words (pyim-dcache-get "zun-bei")) (should (eq (length words) 1)) (should (string= (nth 0 words) "尊卑")) + (setq words (pyim-dcache-get "zun")) (should (string= (nth 0 words) "尊")) -(should (eq (length words) 43 +;; `pyim-dregcache-get' calls `pyim-pymap-py2cchar-get' before return result +(should (eq (length words) 44 (ert-run-tests-batch-and-exit) ;; * Footer