]> git.eshelyaron.com Git - emacs.git/commitdiff
New user option 'webjump-use-internal-browser'
authorPo Lu <luangruo@yahoo.com>
Wed, 13 Jul 2022 04:36:08 +0000 (12:36 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 13 Jul 2022 04:36:08 +0000 (12:36 +0800)
* lisp/net/webjump.el (webjump-use-internal-browser): New defcustom.
(webjump): Respect it.  Reported by Youmu <condy0919@gmail.com>.

etc/NEWS
lisp/net/webjump.el

index 9f302bdfb5f175148019a2e8d30a8679b35a13b3..b46f33fd67fc49aa356ab02cc18338f6e14d13b0 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
index b2ef47898cdde132b3097dc9db2cc3328b764c8c..9886a4c79d8d3422daef5b5c56c0524f4e68dad1 100644 (file)
   :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)