New user option 'webjump-use-internal-browser'

* lisp/net/webjump.el (webjump-use-internal-browser): New defcustom.
(webjump): Respect it.  Reported by Youmu <condy0919@gmail.com>.
This commit is contained in:
Po Lu 2022-07-13 12:36:08 +08:00
parent 6be201cf51
commit 14a56f52c5
2 changed files with 39 additions and 12 deletions

View file

@ -2030,6 +2030,11 @@ Set it to nil to exclude line numbering from kills and copies.
** Miscellaneous
---
*** New user option 'webjump-use-internal-browser'.
When non-nil, WebJump will use an internal browser to open web pages,
instead of the default external browser.
+++
*** New user option 'font-lock-ignore'.
This option provides a mechanism to selectively disable font-lock

View file

@ -79,6 +79,14 @@
:prefix "webjump-"
:group 'browse-url)
(defcustom webjump-use-internal-browser nil
"Whether or not to force the use of an internal browser.
If non-nil, WebJump will always use an internal browser (such as
EWW or xwidget-webkit) to open web pages, as opposed to an
external browser like IceCat."
:version "29.1"
:type 'boolean)
(defconst webjump-sample-sites
'(
;; FSF, not including Emacs-specific.
@ -255,18 +263,32 @@ Please submit bug reports and other feedback to the author, Neil W. Van Dyke
webjump-sites t))
(name (car item))
(expr (cdr item)))
(browse-url (webjump-url-fix
(cond ((not expr) "")
((stringp expr) expr)
((vectorp expr) (webjump-builtin expr name))
((listp expr) (eval expr t))
((symbolp expr)
(if (fboundp expr)
(funcall expr name)
(error "WebJump URL function \"%s\" undefined"
expr)))
(t (error "WebJump URL expression for \"%s\" invalid"
name)))))))
(if webjump-use-internal-browser
(browse-url-with-browser-kind
'internal (webjump-url-fix
(cond ((not expr) "")
((stringp expr) expr)
((vectorp expr) (webjump-builtin expr name))
((listp expr) (eval expr t))
((symbolp expr)
(if (fboundp expr)
(funcall expr name)
(error "WebJump URL function \"%s\" undefined"
expr)))
(t (error "WebJump URL expression for \"%s\" invalid"
name)))))
(browse-url (webjump-url-fix
(cond ((not expr) "")
((stringp expr) expr)
((vectorp expr) (webjump-builtin expr name))
((listp expr) (eval expr t))
((symbolp expr)
(if (fboundp expr)
(funcall expr name)
(error "WebJump URL function \"%s\" undefined"
expr)))
(t (error "WebJump URL expression for \"%s\" invalid"
name))))))))
(defun webjump-builtin (expr name)
(if (< (length expr) 1)