Skip to content

Commit

Permalink
Add a few new actions for commands and for variables
Browse files Browse the repository at this point in the history
The default configuration now has new action keymaps for commands and
for variables, which have the symbol action map as their parent. For
commands, we have M-x, global-set-key and local-set-key actions. For
variables, we have set-variable, customize-set-variable and
customize-variable actions. (The last one creates a Customize buffer,
while the one before last uses the minibuffer.) Also, the binding for
Info-goto-emacs-command-node has been moved to the command map.
  • Loading branch information
oantolin committed Jan 10, 2021
1 parent f6b0983 commit 846cfbd
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions embark.el
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@
(environment-variables . embark-file-map) ; they come up in file completion
(url . embark-url-map)
(buffer . embark-buffer-map)
(command . embark-symbol-map)
(unicode-name . embark-unicode-name-map)
(symbol . embark-symbol-map)
(variable . embark-symbol-map)
(minor-mode . embark-symbol-map)
(command . embark-command-map)
(variable . embark-variable-map)
(minor-mode . embark-command-map)
(unicode-name . embark-unicode-name-map)
(package . embark-package-map)
(bookmark . embark-bookmark-map)
(region . embark-region-map)
Expand Down Expand Up @@ -1634,6 +1634,13 @@ This is whatever command opened the minibuffer in the first place."
(setq this-command embark--command) ; so the proper hooks apply
(call-interactively embark--command))


(defalias 'embark-execute-command
;; this one is kind of embarrassing: embark-keymap-prompter gives
;; execute-extended-command special treatment, so we need a command
;; just like it... but with a different name!
#'execute-extended-command)

(defun embark-insert (string)
"Insert STRING at point."
(interactive "sInsert: ")
Expand Down Expand Up @@ -1848,12 +1855,26 @@ and leaves the point to the left of it."
(embark-define-keymap embark-symbol-map
"Keymap for Embark symbol actions."
("h" describe-symbol)
("c" Info-goto-emacs-command-node)
("s" embark-info-lookup-symbol)
("d" embark-find-definition)
("b" where-is)
("e" eval-expression))

(embark-define-keymap embark-command-map
"Keymap for Embark command actions."
:parent embark-symbol-map
("x" embark-execute-command)
("c" Info-goto-emacs-command-node)
("g" global-set-key)
("l" local-set-key))

(embark-define-keymap embark-variable-map
"Keymap for Embark variable actions."
:parent embark-symbol-map
("=" set-variable)
("c" customize-set-variable)
("C" customize-variable))

(embark-define-keymap embark-package-map
"Keymap for Embark package actions."
("h" describe-package)
Expand Down

0 comments on commit 846cfbd

Please sign in to comment.