emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6dad1f2: Add a user option to control how links are followed in e


From: Lars Ingebrigtsen
Subject: master 6dad1f2: Add a user option to control how links are followed in eww
Date: Tue, 24 Nov 2020 02:22:37 -0500 (EST)

branch: master
commit 6dad1f25de0f9f62dd4855bb6400405b627fd700
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Add a user option to control how links are followed in eww
    
    * doc/misc/eww.texi (Advanced): Document it (bug#44783).
    
    * lisp/net/eww.el (eww-use-browse-url): New variable.
    (eww-follow-link): Use it.
---
 doc/misc/eww.texi | 6 ++++++
 etc/NEWS          | 4 ++++
 lisp/net/eww.el   | 9 ++++++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index 1bccbd7..a2a21f0 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -262,6 +262,12 @@ fetching images that originate from the same source as the
 retrieving these images'' and @code{t} means ``always send cookies
 when retrieving these images''.
 
+@vindex eww-use-browse-url
+  When following links in EWW, @acronym{URL}s that match the
+@code{eww-use-browse-url} regexp will be passed to @code{browse-url}
+instead of EWW handling them itself.  The action can be further
+customized by altering @code{browse-url-handlers}.
+
 @vindex eww-header-line-format
 @cindex Header
   The header line of the EWW buffer can be changed by customizing
diff --git a/etc/NEWS b/etc/NEWS
index 9361cff..f3a75e4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1100,6 +1100,10 @@ background colors or transparency, such as xbm, pbm, 
svg, png and gif.
 ** EWW
 
 +++
+*** New user option 'eww-use-browse-url'.
+This is a regexp that can be set to alter how links are followed in eww.
+
++++
 *** New user option 'eww-retrieve-command'.
 This can be used to download data via an external command.  If nil
 (the default), then 'url-retrieve' is used.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 9ed01ec..597ce95 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -56,6 +56,13 @@
   :group 'eww
   :type 'string)
 
+(defcustom eww-use-browse-url "\\`mailto:";
+  "eww will use `browse-url' when following links that match this regexp.
+The action to be taken can further be customized via
+`browse-url-handlers'."
+  :version "28.1"
+  :type 'regexp)
+
 (defun erc--download-directory ()
   "Return the name of the download directory.
 If ~/Downloads/ exists, that will be used, and if not, the
@@ -1731,7 +1738,7 @@ If EXTERNAL is double prefix, browse in new buffer."
     (cond
      ((not url)
       (message "No link under point"))
-     ((string-match-p "\\`mailto:"; url)
+     ((string-match-p eww-use-browse-url url)
       ;; This respects the user options `browse-url-handlers'
       ;; and `browse-url-mailto-function'.
       (browse-url url))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]