hrs / engine-mode

Minor mode for defining and querying search engines through Emacs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maybe you want to support spaces in :keybinding definition?

ag91 opened this issue · comments

The :keybinding key is very cool.
I was just a bit puzzled that using a prefix gives problem. I mean the following definition was not taken:

(defengine duckduckgo1
      "https://duckduckgo.com/?q=%s"
      :keybinding "I b")

But instead this works fine:

(defengine duckduckgo1
      "https://duckduckgo.com/?q=%s"
      :keybinding "Ib")

This happens because

(defun engine/bind-key (engine-name keybinding)
  (when keybinding
    `(define-key engine-mode-prefixed-map ,keybinding
       (quote ,(engine/function-name engine-name)))))

does not use kbd like so:

(defun engine/bind-key (engine-name keybinding)
  (when keybinding
    `(define-key engine-mode-prefixed-map (kbd ,keybinding)
       (quote ,(engine/function-name engine-name)))))

Would be sensible to add this in the code, or instructions in the README?

That's a thoroughly reasonable idea. 😄

117a9c0 both wraps the :keybinding argument in a call to kbd and updates the README to reflect that.