Tags: hrs/engine-mode
Tags
Fall back to define-key if keymap-set isn't bound `keymap-set` was introduced in a recent version of Emacs. I switched to it in 2.2.2 to allow more complex keybindings, but forgot it's unavailable in older versions! This checks whether `keymap-set` is available, uses it if it is, and reverts to `define-key` if it's not. Closes #57.
Allow binding engines to non-prefix key sequences We'd like to be able to bind some engines to sequences of keys "nested" under the common engine-mode prefix. For example, something like this ought to work: ``` (defengine wikipedia-spanish "https://es.wikipedia.org/w/index.php?search=%s" :keybinding "w s") ``` This makes that possible by replacing the use of `define-key` (which takes a key sequence, which needs to start with a prefix key) with the recommended function `keymap-set` (which takes any string that satisfies `key-valid-p`). Closes #56.
Prevent browse-url-browser-function shadowing Engines, by default, use the built-in `browse-url-browser-function` to decide which browser to open for a given search. However, if that function has been locally bound to another browser function, it'll use that new function instead! That's not the intended behavior. For example, suppose a user defines an engine to search Wikipedia using their default browser, then tries to invoke it from within an `eww` buffer. They'd *expect* their default browser to open, but instead, because `eww` locally overwrites `browse-url-browser-function`, their search will be opened in `eww`! Surprise! This explicitly binds the `engine/browser-function` to `browse-url-browser-function`. That ensures that the default browser will be set at macro-expansion, so future rebindings of `browse-url-browser-function` shouldn't affect engines. Fixes #40.