From 31da3b2fd0ee5fec677f01a1a461692fe9b065fe Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Tue, 7 Mar 2023 10:45:57 -0500 Subject: [PATCH] Fix embark custom keymaps --- emacs/.emacs.d/config/init-completion.el | 58 +++++++++++++----------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/emacs/.emacs.d/config/init-completion.el b/emacs/.emacs.d/config/init-completion.el index 5efc03d..b6620dc 100644 --- a/emacs/.emacs.d/config/init-completion.el +++ b/emacs/.emacs.d/config/init-completion.el @@ -58,28 +58,30 @@ targets." (_ (key-binding prefix 'accept-default))) keymap) nil nil t)))) - (embark-define-keymap embark-straight-map - "Keymap for actions for straight.el" - ("u" straight-visit-package-website) - ("r" straight-get-recipe) - ("i" straight-use-package) - ("c" straight-check-package) - ("F" straight-pull-package) - ("f" straight-fetch-package) - ("p" straight-push-package) - ("n" straight-normalize-package) - ("m" straight-merge-package)) + (defvar-keymap embark-straight-map + :doc "Keymap for actions for straight.el" + :parent embark-general-map + "u" #'straight-visit-package-website + "r" #'straight-get-recipe + "i" #'straight-use-package + "c" #'straight-check-package + "F" #'straight-pull-package + "f" #'straight-fetch-package + "p" #'straight-push-package + "n" #'straight-normalize-package + "m" #'straight-merge-package) (add-to-list 'embark-keymap-alist '(straight . embark-straight-map)) - (embark-define-keymap embark-password-store-actions - "Keymap for actions for password-store." - ("c" password-store-copy) - ("f" password-store-copy-field) - ("i" password-store-insert) - ("I" password-store-generate) - ("r" password-store-rename) - ("e" password-store-edit) - ("k" password-store-remove) - ("U" password-store-url)) + (defvar-keymap embark-password-store-actions + :doc "Keymap for actions for password-store." + :parent embark-general-map + "c" #'password-store-copy + "f" #'password-store-copy-field + "i" #'password-store-insert + "I" #'password-store-generate + "r" #'password-store-rename + "e" #'password-store-edit + "k" #'password-store-remove + "U" #'password-store-url) (add-to-list 'embark-keymap-alist '(password-store . embark-password-store-actions)) ;; Add identifiers in LSP-mode as their own target type (with-eval-after-load 'lsp-mode @@ -88,13 +90,15 @@ targets." (when-let ((sym (embark-target-identifier-at-point))) (cons 'lsp-identifier (cdr sym))))) (add-to-list 'embark-target-finders 'embark-target-lsp-identifier-at-point) - (embark-define-keymap embark-lsp-identifier-actions - "Keymap for actions on LSP identifiers." - :parent embark-identifier-map - ("a" lsp-execute-code-action) - ("s" lsp-describe-thing-at-point)) + (defun embark-lsp-execute-code-action (_target) + "Ignores the target and calls lsp-execute-code-action." + (call-interactively #'lsp-execute-code-action)) + (defvar-keymap embark-lsp-identifier-actions + :doc "Keymap for actions on LSP identifiers" + :parent embark-general-map + "a" #'embark-lsp-execute-code-action + "h" #'lsp-describe-thing-at-point) (add-to-list 'embark-keymap-alist '(lsp-identifier . embark-lsp-identifier-actions)) - (add-to-list 'embark-target-injection-hooks '(lsp-execute-code-action embark--ignore-target)) (add-to-list 'embark-target-injection-hooks '(lsp-describe-thing-at-point embark--ignore-target))) (add-to-list 'embark-target-injection-hooks '(xref-find-references embark--ignore-target)) :general