emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 bcf4913: Allow 'browse-url-emacs' visit non-exist


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-25 bcf4913: Allow 'browse-url-emacs' visit non-existent URLs
Date: Sat, 19 Dec 2015 09:55:00 +0000

branch: emacs-25
commit bcf4913e0619c2778b75b96e9628661e3d8260c3
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Allow 'browse-url-emacs' visit non-existent URLs
    
    * lisp/url/url-handlers.el (url-insert-file-contents): Don't
    signal an error if VISIT is non-nil, to more faithfully emulate
    the behavior of 'insert-file-contents'.  (Bug#22160)
---
 lisp/url/url-handlers.el |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index bafe3e5..0b9d43f 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -340,8 +340,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.



reply via email to

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