aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2015-01-10 16:20:44 +0100
committerLars Magne Ingebrigtsen2015-01-10 16:20:44 +0100
commit790ca72b3e5790bd8af6f76831ac0c3dde01288e (patch)
tree8b53f695bf3729a67de9919e83454afa010805d7
parent0046f2c1580d439351fbecf2c28526a5e1c845ec (diff)
downloademacs-790ca72b3e5790bd8af6f76831ac0c3dde01288e.tar.gz
emacs-790ca72b3e5790bd8af6f76831ac0c3dde01288e.zip
Further eww DWIM URL interpretation fixups
(eww): Also interpret things like "en.wikipedia.org/wiki/Free software" as an URL.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/net/eww.el5
2 files changed, 6 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 808be4b6957..9bfcd504199 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,8 @@
2 2
3 * net/eww.el (eww): Always interpret URLs that start with https?: 3 * net/eww.el (eww): Always interpret URLs that start with https?:
4 as plain URLs, even if they have spaces in them (bug#19556). 4 as plain URLs, even if they have spaces in them (bug#19556).
5 (eww): Also interpret things like "en.wikipedia.org/wiki/Free
6 software" as an URL.
5 7
62015-01-10 Daniel Colascione <dancol@dancol.org> 82015-01-10 Daniel Colascione <dancol@dancol.org>
7 9
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 52c1501fbe1..8278e3cc1ba 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -256,6 +256,9 @@ word(s) will be searched for via `eww-search-prefix'."
256 (user-error "FTP is not supported.")) 256 (user-error "FTP is not supported."))
257 (t 257 (t
258 (if (or (string-match "\\`https?:" url) 258 (if (or (string-match "\\`https?:" url)
259 ;; Also try to match "naked" URLs like
260 ;; en.wikipedia.org/wiki/Free software
261 (string-match "\\`[a-z._]+/" url)
259 (and (= (length (split-string url)) 1) 262 (and (= (length (split-string url)) 1)
260 (or (and (not (string-match-p "\\`[\"\'].*[\"\']\\'" url)) 263 (or (and (not (string-match-p "\\`[\"\'].*[\"\']\\'" url))
261 (> (length (split-string url "[.:]")) 1)) 264 (> (length (split-string url "[.:]")) 1))
@@ -263,7 +266,7 @@ word(s) will be searched for via `eww-search-prefix'."
263 (progn 266 (progn
264 (unless (string-match-p "\\`[a-zA-Z][-a-zA-Z0-9+.]*://" url) 267 (unless (string-match-p "\\`[a-zA-Z][-a-zA-Z0-9+.]*://" url)
265 (setq url (concat "http://" url))) 268 (setq url (concat "http://" url)))
266 ;; some site don't redirect final / 269 ;; Some sites do not redirect final /
267 (when (string= (url-filename (url-generic-parse-url url)) "") 270 (when (string= (url-filename (url-generic-parse-url url)) "")
268 (setq url (concat url "/")))) 271 (setq url (concat url "/"))))
269 (setq url (concat eww-search-prefix 272 (setq url (concat eww-search-prefix