summaryrefslogtreecommitdiff
path: root/lisp/url/url-handlers.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2015-12-29 21:40:28 -0800
committerJohn Wiegley <johnw@newartisans.com>2015-12-29 21:40:28 -0800
commit9f2f14a0725211b13a744573344636b57b9c98b9 (patch)
tree7190e0fb3d4aa06018d8cf997f06b806fb09a9c8 /lisp/url/url-handlers.el
parentd259328fb87db8cc67d52771efcfa653e52c5b71 (diff)
parente823c34072bf045800d91e12c7ddb61fa23c6e30 (diff)
downloademacs-9f2f14a0725211b13a744573344636b57b9c98b9.tar.gz
Merge emacs-25 into master (using imerge)
Diffstat (limited to 'lisp/url/url-handlers.el')
-rw-r--r--lisp/url/url-handlers.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index 6d2a5c2ee4b..9c272767858 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -342,8 +342,15 @@ if it had been inserted from a file named URL."
;; XXX: This is HTTP/S specific and should be moved to url-http
;; instead. See http://debbugs.gnu.org/17549.
(when (bound-and-true-p url-http-response-status)
- (unless (and (>= url-http-response-status 200)
- (< url-http-response-status 300))
+ ;; Don't signal an error if VISIT is non-nil, because
+ ;; 'insert-file-contents' doesn't. This is required to
+ ;; support, e.g., 'browse-url-emacs', which is a fancy way of
+ ;; visiting the HTML source of a URL: in that case, we want to
+ ;; display a file buffer even if the URL does not exist and
+ ;; 'url-retrieve-synchronously' returns 404 or whatever.
+ (unless (or visit
+ (and (>= url-http-response-status 200)
+ (< url-http-response-status 300)))
(let ((desc (nth 2 (assq url-http-response-status url-http-codes))))
(kill-buffer buffer)
;; Signal file-error per http://debbugs.gnu.org/16733.