branch: elpa/engine-mode commit 117a9c0cbc1ff8ade7f17cd40d1d2f5eb24f51a3 Author: Harry R. Schwartz <he...@harryrschwartz.com> Commit: Harry R. Schwartz <he...@harryrschwartz.com>
Use kbd to convert :keybinding correctly Previously, assigning `:keybinding` to `"a b"` would bind the associated engine to `C-x / a SPC b`. That `SPC` in there? Not really optimal. This commit wraps the `:keybinding` argument with a call to `kbd`, so spaces, for example, will be correctly interpreted. Closes #41. --- README.md | 3 ++- engine-mode.el | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3d0d2f941d..5374f982c8 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ will take the selected region (or prompt for input, if no region is selected) and search GitHub for it, displaying the results in your default browser. The `defengine` macro can also take an optional key combination, prefixed with -`engine/keymap-prefix` (which defaults to "C-x /"): +`engine/keymap-prefix` (which defaults to "C-x /"). That keybinding will be +wrapped in a call to `kbd`. ```emacs (defengine duckduckgo diff --git a/engine-mode.el b/engine-mode.el index e68346979c..e9b274fd53 100644 --- a/engine-mode.el +++ b/engine-mode.el @@ -122,7 +122,7 @@ Defaults to `nil' which means to go with `browse-url-browser-function'." (defun engine/bind-key (engine-name keybinding) (when keybinding - `(define-key engine-mode-prefixed-map ,keybinding + `(define-key engine-mode-prefixed-map (kbd ,keybinding) (quote ,(engine/function-name engine-name))))) ;;;###autoload