[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/engine-mode eff5f26894 25/71: Add a custom variable to set
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/engine-mode eff5f26894 25/71: Add a custom variable to set the default browser |
Date: |
Wed, 21 Dec 2022 09:59:09 -0500 (EST) |
branch: elpa/engine-mode
commit eff5f268949ab90c8cf639e71166511705ad0da1
Author: Harry Schwartz <hello@harryrschwartz.com>
Commit: Harry Schwartz <hello@harryrschwartz.com>
Add a custom variable to set the default browser
Previously, if a user wanted to change the default browser for all
engines, they had to overwrite `browse-url-browser-function`. That's not
great, since Emacs uses that globally to open *all* links.
Now, to set the default browser for engine-mode only, users can
overwrite the `engine/browser-function` variable instead.
`engine/browser-function` defaults to `browse-url-browser-function`, so
there shouldn't be any compatibility issues.
Thanks very much to @asok for the idea and initial implementation!
---
README.md | 16 +++++++++-------
engine-mode.el | 10 ++++++++--
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 1b1d15e06e..108b6cbbb6 100644
--- a/README.md
+++ b/README.md
@@ -45,18 +45,20 @@ load path and globally enabling it:
## Changing your default browser
-`engine-mode` uses `browse-url` to open the URL it constructs. To
-change the browser that `browse-url` uses, you'll need to redefine
-the `browse-url-browser-function` variable.
-
-For example, to use Emacs' built-in `eww` browser:
+`engine-mode` uses the `engine/browser-function` variable to determine
+which browser it should use to open the URL it constructs. To change
+the default browser, redefine `engine/browser-function`. For example,
+to always use Emacs' built-in `eww` browser:
```emacs
-(setq browse-url-browser-function 'eww-browse-url)
+(setq engine/browser-function 'eww-browse-url)
```
+`engine/browser-function` defaults to `browse-url-browser-function`,
+which Emacs uses globally to open links.
+
The implementation of the `browse-url-browser-function` variable
-contains a comprehensive list of possible browsing functions. You can
+contains a comprehensive list of possible browser functions. You can
get to that by hitting `C-h v browser-url-browser-function <RETURN>`
and following the link to `browse-url.el`.
diff --git a/engine-mode.el b/engine-mode.el
index f48ce9c5b5..6ad319178f 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: 2015.05.17
+;; Version: 2015.05.19
;; URL: https://github.com/hrs/engine-mode/engine-mode.el
;; This file is NOT part of GNU Emacs.
@@ -62,6 +62,12 @@
:group 'engine-mode
:type 'string)
+(defcustom engine/browser-function browse-url-browser-function
+ "The default browser function used when opening a URL in an engine.
+Defaults to `browse-url-browser-function'."
+ :group 'engine-mode
+ :type 'symbol)
+
(defun engine/search-prompt (engine-name)
(concat "Search " (capitalize engine-name) ": "))
@@ -98,7 +104,7 @@
`(define-key engine-mode-map (kbd ,(engine/scope-keybinding keybinding))
(quote ,(engine/function-name engine-name)))))
-(cl-defmacro defengine (engine-name search-engine-url &key keybinding
docstring (browser 'browse-url-browser-function) (term-transformation-hook
'identity))
+(cl-defmacro defengine (engine-name search-engine-url &key keybinding
docstring (browser 'engine/browser-function) (term-transformation-hook
'identity))
"Define a custom search engine.
`engine-name' is a symbol naming the engine.
- [nongnu] elpa/engine-mode d99f9b4ab2 63/71: Prevent browse-url-browser-function shadowing, (continued)
- [nongnu] elpa/engine-mode d99f9b4ab2 63/71: Prevent browse-url-browser-function shadowing, ELPA Syncer, 2022/12/21
- [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 <=
- [nongnu] elpa/engine-mode 282f5d5910 62/71: Fix link to MELPA Stable status badge, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode f955a5b889 67/71: Fix issues found by package-lint, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode fac252e11d 19/71: Add documentation for redefining the keymap prefix, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 4fa7ee6c06 14/71: Add documentation for changing the default browser, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 70bbde97bf 12/71: define a prefix key (which defaults to "C-c /"), ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 65e9a37fd0 44/71: Minimise side-effects when loading, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 50b0d436e8 42/71: Define prefixed map as an actual prefix command, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 1bfcc961c5 46/71: Set URL to the bare GitHub repo, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 20608906f8 61/71: Document installation with use-package, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode f36d8bf785 69/71: Prefer HTTPS to HTTP, ELPA Syncer, 2022/12/21