branch: externals/ivy commit 3780e2e7b2a43e6c5056d2c542d3e1c229b9f67b Author: Basil L. Contovounesios <ba...@contovou.net> Commit: Basil L. Contovounesios <ba...@contovou.net>
Function-quote keymap definitions * counsel.el (counsel-find-file-map, counsel-compile-map) (counsel-mode-map): * ivy.el (ivy-minibuffer-map, ivy-mode-map, ivy-switch-buffer-map) (ivy-reverse-i-search-map, ivy-occur-mode-map): * swiper.el (swiper-map, swiper-all-map, swiper-isearch-map): Consistently #'-quote command symbols to help avoid mistakes. --- counsel.el | 48 ++++++++++----------- ivy.el | 143 ++++++++++++++++++++++++++++++++----------------------------- swiper.el | 17 ++++---- 3 files changed, 107 insertions(+), 101 deletions(-) diff --git a/counsel.el b/counsel.el index 16836417b0..d01007f1c8 100644 --- a/counsel.el +++ b/counsel.el @@ -1865,7 +1865,7 @@ currently checked out." (define-key map (kbd "C-<backspace>") #'counsel-up-directory) (define-key map (kbd "`") #'counsel-file-jump-from-find) (define-key map (kbd "C-`") (ivy-make-magic-action #'counsel-find-file "b")) - (define-key map [remap undo] #'counsel-find-file-undo) + (define-key map `[remap ,#'undo] #'counsel-find-file-undo) map)) (defun counsel-file-jump-from-find () @@ -6825,7 +6825,8 @@ handling for the `counsel-compile' metadata." ;; operation which doesn't include the metadata we want. (defvar counsel-compile-map (let ((map (make-sparse-keymap))) - (define-key map [remap ivy-insert-current] #'counsel-compile-edit-command) + (define-key map `[remap ,#'ivy-insert-current] + #'counsel-compile-edit-command) map) "Additional ivy keybindings during command selection.") @@ -7215,29 +7216,28 @@ The user options `counsel-search-engine' and ;;* `counsel-mode' (defvar counsel-mode-map (let ((map (make-sparse-keymap))) - (dolist (binding - '((execute-extended-command . counsel-M-x) - (describe-bindings . counsel-descbinds) - (describe-function . counsel-describe-function) - (describe-variable . counsel-describe-variable) - (describe-symbol . counsel-describe-symbol) - (apropos-command . counsel-apropos) - (describe-face . counsel-describe-face) - (list-faces-display . counsel-faces) - (find-file . counsel-find-file) - (find-library . counsel-find-library) - (imenu . counsel-imenu) - (load-library . counsel-load-library) - (load-theme . counsel-load-theme) - (yank-pop . counsel-yank-pop) - (info-lookup-symbol . counsel-info-lookup-symbol) - (pop-to-mark-command . counsel-mark-ring) - (geiser-doc-look-up-manual . counsel-geiser-doc-look-up-manual) - (bookmark-jump . counsel-bookmark))) - (define-key map (vector 'remap (car binding)) (cdr binding))) + (define-key map `[remap ,#'execute-extended-command] #'counsel-M-x) + (define-key map `[remap ,#'describe-bindings] #'counsel-descbinds) + (define-key map `[remap ,#'describe-function] #'counsel-describe-function) + (define-key map `[remap ,#'describe-variable] #'counsel-describe-variable) + (define-key map [remap describe-symbol] #'counsel-describe-symbol) + (define-key map `[remap ,#'apropos-command] #'counsel-apropos) + (define-key map `[remap ,#'describe-face] #'counsel-describe-face) + (define-key map `[remap ,#'list-faces-display] #'counsel-faces) + (define-key map `[remap ,#'find-file] #'counsel-find-file) + (define-key map `[remap ,#'find-library] #'counsel-find-library) + (define-key map `[remap ,#'imenu] #'counsel-imenu) + (define-key map `[remap ,#'load-library] #'counsel-load-library) + (define-key map `[remap ,#'load-theme] #'counsel-load-theme) + (define-key map `[remap ,#'yank-pop] #'counsel-yank-pop) + (define-key map `[remap ,#'info-lookup-symbol] #'counsel-info-lookup-symbol) + (define-key map `[remap ,#'pop-to-mark-command] #'counsel-mark-ring) + (define-key map [remap geiser-doc-look-up-manual] + #'counsel-geiser-doc-look-up-manual) + (define-key map `[remap ,#'bookmark-jump] #'counsel-bookmark) map) - "Map for `counsel-mode'. -Remaps built-in functions to counsel replacements.") + "Keymap for `counsel-mode'. +Remaps built-in and external functions to Counsel replacements.") (defcustom counsel-mode-override-describe-bindings nil "Whether to override `describe-bindings' when `counsel-mode' is active." diff --git a/ivy.el b/ivy.el index 48facf5344..3be4b96867 100644 --- a/ivy.el +++ b/ivy.el @@ -320,56 +320,60 @@ Remove DEF from `counsel-M-x' list." (defvar ivy-minibuffer-map (let ((map (make-sparse-keymap))) - (ivy-define-key map (kbd "C-m") 'ivy-done) - (define-key map [down-mouse-1] 'ignore) - (ivy-define-key map [mouse-1] 'ivy-mouse-done) - (ivy-define-key map [mouse-3] 'ivy-mouse-dispatching-done) - (ivy-define-key map (kbd "C-M-m") 'ivy-call) - (ivy-define-key map (kbd "C-j") 'ivy-alt-done) - (ivy-define-key map (kbd "C-M-j") 'ivy-immediate-done) - (ivy-define-key map (kbd "TAB") 'ivy-partial-or-done) - (ivy-define-key map [remap next-line] 'ivy-next-line) - (ivy-define-key map [remap previous-line] 'ivy-previous-line) - (ivy-define-key map (kbd "C-r") 'ivy-reverse-i-search) - (define-key map (kbd "SPC") 'self-insert-command) - (ivy-define-key map [remap delete-backward-char] 'ivy-backward-delete-char) - (ivy-define-key map [remap backward-delete-char-untabify] 'ivy-backward-delete-char) - (ivy-define-key map [remap backward-kill-word] 'ivy-backward-kill-word) - (ivy-define-key map [remap delete-char] 'ivy-delete-char) - (ivy-define-key map [remap forward-char] 'ivy-forward-char) - (ivy-define-key map (kbd "<right>") 'ivy-forward-char) - (ivy-define-key map [remap kill-word] 'ivy-kill-word) - (ivy-define-key map [remap beginning-of-buffer] 'ivy-beginning-of-buffer) - (ivy-define-key map [remap end-of-buffer] 'ivy-end-of-buffer) - (ivy-define-key map (kbd "M-n") 'ivy-next-history-element) - (ivy-define-key map (kbd "M-p") 'ivy-previous-history-element) - (define-key map (kbd "C-g") 'minibuffer-keyboard-quit) - (ivy-define-key map [remap scroll-up-command] 'ivy-scroll-up-command) - (ivy-define-key map [remap scroll-down-command] 'ivy-scroll-down-command) - (ivy-define-key map (kbd "<next>") 'ivy-scroll-up-command) - (ivy-define-key map (kbd "<prior>") 'ivy-scroll-down-command) - (ivy-define-key map (kbd "C-v") 'ivy-scroll-up-command) - (ivy-define-key map (kbd "M-v") 'ivy-scroll-down-command) - (ivy-define-key map (kbd "C-M-n") 'ivy-next-line-and-call) - (ivy-define-key map (kbd "C-M-p") 'ivy-previous-line-and-call) - (ivy-define-key map (kbd "M-a") 'ivy-toggle-marks) - (ivy-define-key map (kbd "M-r") 'ivy-toggle-regexp-quote) - (ivy-define-key map (kbd "M-j") 'ivy-yank-word) - (ivy-define-key map (kbd "M-i") 'ivy-insert-current) - (ivy-define-key map (kbd "C-M-y") 'ivy-insert-current-full) - (ivy-define-key map (kbd "C-o") 'hydra-ivy/body) - (ivy-define-key map (kbd "M-o") 'ivy-dispatching-done) - (ivy-define-key map (kbd "C-M-o") 'ivy-dispatching-call) - (ivy-define-key map [remap kill-line] 'ivy-kill-line) - (ivy-define-key map [remap kill-whole-line] 'ivy-kill-whole-line) - (ivy-define-key map (kbd "S-SPC") 'ivy-restrict-to-matches) - (ivy-define-key map [remap kill-ring-save] 'ivy-kill-ring-save) - (ivy-define-key map (kbd "C-M-a") 'ivy-read-action) - (ivy-define-key map (kbd "C-c C-o") 'ivy-occur) - (ivy-define-key map (kbd "C-c C-a") 'ivy-toggle-ignore) - (ivy-define-key map (kbd "C-c C-s") 'ivy-rotate-sort) - (ivy-define-key map [remap describe-mode] 'ivy-help) - (ivy-define-key map "$" 'ivy-magic-read-file-env) + (ivy-define-key map (kbd "C-m") #'ivy-done) + (define-key map [down-mouse-1] #'ignore) + (ivy-define-key map [mouse-1] #'ivy-mouse-done) + (ivy-define-key map [mouse-3] #'ivy-mouse-dispatching-done) + (ivy-define-key map (kbd "C-M-m") #'ivy-call) + (ivy-define-key map (kbd "C-j") #'ivy-alt-done) + (ivy-define-key map (kbd "C-M-j") #'ivy-immediate-done) + (ivy-define-key map (kbd "TAB") #'ivy-partial-or-done) + (ivy-define-key map `[remap ,#'next-line] #'ivy-next-line) + (ivy-define-key map `[remap ,#'previous-line] #'ivy-previous-line) + (ivy-define-key map (kbd "C-r") #'ivy-reverse-i-search) + (define-key map (kbd "SPC") #'self-insert-command) + (ivy-define-key map `[remap ,#'delete-backward-char] + #'ivy-backward-delete-char) + (ivy-define-key map `[remap ,#'backward-delete-char-untabify] + #'ivy-backward-delete-char) + (ivy-define-key map `[remap ,#'backward-kill-word] #'ivy-backward-kill-word) + (ivy-define-key map `[remap ,#'delete-char] #'ivy-delete-char) + (ivy-define-key map `[remap ,#'forward-char] #'ivy-forward-char) + (ivy-define-key map (kbd "<right>") #'ivy-forward-char) + (ivy-define-key map `[remap ,#'kill-word] #'ivy-kill-word) + (ivy-define-key map `[remap ,#'beginning-of-buffer] + #'ivy-beginning-of-buffer) + (ivy-define-key map `[remap ,#'end-of-buffer] #'ivy-end-of-buffer) + (ivy-define-key map (kbd "M-n") #'ivy-next-history-element) + (ivy-define-key map (kbd "M-p") #'ivy-previous-history-element) + (define-key map (kbd "C-g") #'minibuffer-keyboard-quit) + (ivy-define-key map `[remap ,#'scroll-up-command] #'ivy-scroll-up-command) + (ivy-define-key map `[remap ,#'scroll-down-command] + #'ivy-scroll-down-command) + (ivy-define-key map (kbd "<next>") #'ivy-scroll-up-command) + (ivy-define-key map (kbd "<prior>") #'ivy-scroll-down-command) + (ivy-define-key map (kbd "C-v") #'ivy-scroll-up-command) + (ivy-define-key map (kbd "M-v") #'ivy-scroll-down-command) + (ivy-define-key map (kbd "C-M-n") #'ivy-next-line-and-call) + (ivy-define-key map (kbd "C-M-p") #'ivy-previous-line-and-call) + (ivy-define-key map (kbd "M-a") #'ivy-toggle-marks) + (ivy-define-key map (kbd "M-r") #'ivy-toggle-regexp-quote) + (ivy-define-key map (kbd "M-j") #'ivy-yank-word) + (ivy-define-key map (kbd "M-i") #'ivy-insert-current) + (ivy-define-key map (kbd "C-M-y") #'ivy-insert-current-full) + (ivy-define-key map (kbd "C-o") #'hydra-ivy/body) + (ivy-define-key map (kbd "M-o") #'ivy-dispatching-done) + (ivy-define-key map (kbd "C-M-o") #'ivy-dispatching-call) + (ivy-define-key map `[remap ,#'kill-line] #'ivy-kill-line) + (ivy-define-key map `[remap ,#'kill-whole-line] #'ivy-kill-whole-line) + (ivy-define-key map (kbd "S-SPC") #'ivy-restrict-to-matches) + (ivy-define-key map `[remap ,#'kill-ring-save] #'ivy-kill-ring-save) + (ivy-define-key map (kbd "C-M-a") #'ivy-read-action) + (ivy-define-key map (kbd "C-c C-o") #'ivy-occur) + (ivy-define-key map (kbd "C-c C-a") #'ivy-toggle-ignore) + (ivy-define-key map (kbd "C-c C-s") #'ivy-rotate-sort) + (ivy-define-key map `[remap ,#'describe-mode] #'ivy-help) + (ivy-define-key map "$" #'ivy-magic-read-file-env) map) "Keymap used in the minibuffer.") (autoload 'hydra-ivy/body "ivy-hydra" "" t) @@ -377,8 +381,9 @@ Remove DEF from `counsel-M-x' list." (defvar ivy-mode-map (let ((map (make-sparse-keymap))) - (ivy-define-key map [remap switch-to-buffer] 'ivy-switch-buffer) - (ivy-define-key map [remap switch-to-buffer-other-window] 'ivy-switch-buffer-other-window) + (ivy-define-key map `[remap ,#'switch-to-buffer] #'ivy-switch-buffer) + (ivy-define-key map `[remap ,#'switch-to-buffer-other-window] + #'ivy-switch-buffer-other-window) map) "Keymap for `ivy-mode'.") @@ -4643,7 +4648,7 @@ BUFFER may be a string or nil." (defvar ivy-switch-buffer-map (let ((map (make-sparse-keymap))) - (ivy-define-key map (kbd "C-k") 'ivy-switch-buffer-kill) + (ivy-define-key map (kbd "C-k") #'ivy-switch-buffer-kill) map)) (defun ivy-switch-buffer-kill () @@ -4979,7 +4984,7 @@ This list can be rotated with `ivy-rotate-preferred-builders'." (defvar ivy-reverse-i-search-map (let ((map (make-sparse-keymap))) - (ivy-define-key map (kbd "C-k") 'ivy-reverse-i-search-kill) + (ivy-define-key map (kbd "C-k") #'ivy-reverse-i-search-kill) map)) (defun ivy-history-contents (history) @@ -5051,21 +5056,21 @@ buffer would modify `ivy-last'.") (defvar ivy-occur-mode-map (let ((map (make-sparse-keymap))) - (ivy-define-key map [mouse-1] 'ivy-occur-click) - (ivy-define-key map (kbd "RET") 'ivy-occur-press-and-switch) - (ivy-define-key map (kbd "j") 'ivy-occur-next-line) - (ivy-define-key map (kbd "k") 'ivy-occur-previous-line) - (define-key map (kbd "h") 'backward-char) - (define-key map (kbd "l") 'forward-char) - (ivy-define-key map (kbd "f") 'ivy-occur-press) - (ivy-define-key map (kbd "g") 'ivy-occur-revert-buffer) - (ivy-define-key map (kbd "a") 'ivy-occur-read-action) - (ivy-define-key map (kbd "o") 'ivy-occur-dispatch) - (ivy-define-key map (kbd "c") 'ivy-occur-toggle-calling) - (define-key map (kbd "q") 'quit-window) - (define-key map (kbd "R") 'read-only-mode) - (ivy-define-key map (kbd "C-d") 'ivy-occur-delete-candidate) - (ivy-define-key map (kbd "F") 'ivy-occur-flush-lines) + (ivy-define-key map [mouse-1] #'ivy-occur-click) + (ivy-define-key map (kbd "RET") #'ivy-occur-press-and-switch) + (ivy-define-key map (kbd "j") #'ivy-occur-next-line) + (ivy-define-key map (kbd "k") #'ivy-occur-previous-line) + (define-key map (kbd "h") #'backward-char) + (define-key map (kbd "l") #'forward-char) + (ivy-define-key map (kbd "f") #'ivy-occur-press) + (ivy-define-key map (kbd "g") #'ivy-occur-revert-buffer) + (ivy-define-key map (kbd "a") #'ivy-occur-read-action) + (ivy-define-key map (kbd "o") #'ivy-occur-dispatch) + (ivy-define-key map (kbd "c") #'ivy-occur-toggle-calling) + (define-key map (kbd "q") #'quit-window) + (define-key map (kbd "R") #'read-only-mode) + (ivy-define-key map (kbd "C-d") #'ivy-occur-delete-candidate) + (ivy-define-key map (kbd "F") #'ivy-occur-flush-lines) map) "Keymap for Ivy Occur mode.") diff --git a/swiper.el b/swiper.el index ad5876670d..1aaab3d68e 100644 --- a/swiper.el +++ b/swiper.el @@ -155,12 +155,12 @@ If the input is empty, select the previous history element instead." (defvar swiper-map (let ((map (make-sparse-keymap))) - (define-key map (kbd "C-s") 'swiper-C-s) - (define-key map (kbd "M-q") 'swiper-query-replace) - (define-key map (kbd "C-l") 'swiper-recenter-top-bottom) - (define-key map (kbd "C-'") 'swiper-avy) - (define-key map (kbd "C-7") 'swiper-mc) - (define-key map (kbd "C-c C-f") 'swiper-toggle-face-matching) + (define-key map (kbd "C-s") #'swiper-C-s) + (define-key map (kbd "M-q") #'swiper-query-replace) + (define-key map (kbd "C-l") #'swiper-recenter-top-bottom) + (define-key map (kbd "C-'") #'swiper-avy) + (define-key map (kbd "C-7") #'swiper-mc) + (define-key map (kbd "C-c C-f") #'swiper-toggle-face-matching) map) "Keymap for swiper.") @@ -1332,7 +1332,7 @@ See `ivy-format-functions-alist' for further information." (defvar swiper-all-map (let ((map (make-sparse-keymap))) - (define-key map (kbd "M-q") 'swiper-all-query-replace) + (define-key map (kbd "M-q") #'swiper-all-query-replace) map) "Keymap for `swiper-all'.") @@ -1617,7 +1617,8 @@ When the input is empty, browse the search history instead." (defvar swiper-isearch-map (let ((map (make-sparse-keymap))) (set-keymap-parent map swiper-map) - (define-key map [remap ivy-insert-current] #'swiper--isearch-insert-current) + (define-key map `[remap ,#'ivy-insert-current] + #'swiper--isearch-insert-current) (define-key map (kbd "M-n") #'swiper-isearch-thing-at-point) (define-key map (kbd "C-r") #'swiper-isearch-C-r) map)