]> git.eshelyaron.com Git - emacs.git/commitdiff
Restore HTML rendering behavior of browse-url-of-buffer/file.
authorTassilo Horn <tsdh@gnu.org>
Wed, 6 May 2020 20:23:03 +0000 (22:23 +0200)
committerTassilo Horn <tsdh@gnu.org>
Wed, 6 May 2020 20:23:03 +0000 (22:23 +0200)
* lisp/net/browse-url.el (browse-url-default-handlers): Add a browser
handler for HTML page file:// URLs before the generic file:// handler.
(browse-url--browser): New defun.

lisp/net/browse-url.el

index 1275c15578f0d0ae63709eceb5e21a1bb8f3d995..67dc4cd231bf147a8f4b6356e38939166aaeacd4 100644 (file)
@@ -601,10 +601,17 @@ down (this *won't* always work)."
   "Calls `browse-url-man-function' with URL and ARGS."
   (funcall browse-url-man-function url args))
 
+(defun browse-url--browser (url &rest args)
+  "Calls `browse-url-browser-function' with URL and ARGS."
+  (funcall browse-url-browser-function url args))
+
 ;;;###autoload
 (defvar browse-url-default-handlers
   '(("\\`mailto:" . browse-url--mailto)
     ("\\`man:" . browse-url--man)
+    ;; Render file:// URLs if they are HTML pages, otherwise just find
+    ;; the file.
+    ("\\`file://.*\\.html?\\b" . browse-url--browser)
     ("\\`file://" . browse-url-emacs))
   "Like `browse-url-handlers' but populated by Emacs and packages.