[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/engine-mode d99f9b4ab2 63/71: Prevent browse-url-browser-f
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/engine-mode d99f9b4ab2 63/71: Prevent browse-url-browser-function shadowing |
Date: |
Wed, 21 Dec 2022 09:59:17 -0500 (EST) |
branch: elpa/engine-mode
commit d99f9b4ab266b2b777f3f323f766687970456fa9
Author: Harry R. Schwartz <hello@harryrschwartz.com>
Commit: Harry R. Schwartz <hello@harryrschwartz.com>
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`!
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 redefinitions of `browse-url-browser-function`
shouldn't affect engines.
This is technically a breaking change, since users might expect that
redefining
`browse-url-browser-function` after defining engines would cause those
engines
to use the new default browser. The documentation doesn't *explicitly*
promise
that, though, and I tend to think this implementation is slightly less
surprising.
Users who *do* want to change the default browser on a mode-by-mode basis
should
still be able to do so by defining a hook:
(add-hook 'my-favorite-mode-hook
(lambda () (setq engine/browser-function
'my-favorite-browsing-function)))
Fixes #40.
---
engine-mode.el | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/engine-mode.el b/engine-mode.el
index 8e2a0e4d15..34b7346187 100644
--- a/engine-mode.el
+++ b/engine-mode.el
@@ -1,7 +1,7 @@
;;; engine-mode.el --- Define and query search engines from within Emacs.
;; Author: Harry R. Schwartz <hello@harryrschwartz.com>
-;; Version: 2.1.2
+;; Version: 2.2.0
;; URL: https://github.com/hrs/engine-mode
;; Package-Requires: ((cl-lib "0.5"))
@@ -82,9 +82,9 @@ For example, to use \"C-c s\" instead of the default \"C-x
/\":
(define-key engine-mode-map (kbd engine/keybinding-prefix) nil)
(define-key engine-mode-map prefix-key engine-mode-prefixed-map))
-(defcustom engine/browser-function nil
+(defcustom engine/browser-function browse-url-browser-function
"The default browser function used when opening a URL in an engine.
-Defaults to `nil' which means to go with `browse-url-browser-function'."
+Defaults to `browse-url-browser-function'."
:group 'engine-mode
:type 'symbol)
@@ -107,8 +107,7 @@ Defaults to `nil' which means to go with
`browse-url-browser-function'."
(defun engine/execute-search (search-engine-url browser-function search-term)
"Display the results of the query."
(interactive)
- (let ((browse-url-browser-function (or browser-function
- browse-url-browser-function)))
+ (let ((browse-url-browser-function browser-function))
(browse-url
(format-spec search-engine-url
(format-spec-make ?s (url-hexify-string search-term))))))
- [nongnu] elpa/engine-mode bd2ea005b3 11/71: add a docstring for the defengine macro, (continued)
- [nongnu] elpa/engine-mode bd2ea005b3 11/71: add a docstring for the defengine macro, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode c73489f15b 22/71: Add README documentation for custom docstrings, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 449c09afe5 26/71: Nest prefixed keymaps correctly, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode e44d23f6c9 28/71: Add melpa-stable badge to README, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode c37373e36c 06/71: requiring engine-mode, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 98020c5c8f 30/71: Update README text around Chrome script, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 96b3488a6d 54/71: Bump version to 2.1.1, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 30a361b27f 71/71: Remove the rfcs search engine from the docs, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode e99f205873 57/71: Document a definition of the Qwant search engine, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 4f2abf66d9 53/71: Ensure that local keymaps aren't propagated, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode d99f9b4ab2 63/71: Prevent browse-url-browser-function shadowing,
ELPA Syncer <=
- [nongnu] elpa/engine-mode 7617af1c21 04/71: avoid multiple-evaluation issue for engine-name, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode b84d806f75 07/71: fix documentation typo, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode b804a5d6c8 13/71: use symbol under point as the default search term, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 3d4d39f29c 16/71: License under GPLv3, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 243d046914 35/71: make engine-mode keybinding prefix customizable, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 2c327f1785 24/71: Set engine-specific browsers, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 244610231f 34/71: Include a MELPA badge on the README, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 59f1d463fa 39/71: Fix rebind key conflict., ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 224919b648 29/71: Corrected Project Gutenberg URL., ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode eff5f26894 25/71: Add a custom variable to set the default browser, ELPA Syncer, 2022/12/21