Commit ea47bcc4 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Fix `browse-url-of-dired'

* lisp/net/browse-url.el (browse-url-emacs): Make the
`browse-url-of-dired' command work again after the browse-emacs
changes (bug#42429).
parent 0a3d584c
Pipeline #7386 passed with stage
in 65 minutes and 43 seconds
......@@ -134,6 +134,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Code:
(require 'url)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Variables
......@@ -1374,10 +1376,16 @@ Optional argument SAME-WINDOW non-nil means show the URL in the
currently selected window instead."
(interactive (browse-url-interactive-arg "URL: "))
(require 'url-handlers)
(let ((file-name-handler-alist
(cons (cons url-handler-regexp 'url-file-handler)
file-name-handler-alist)))
(if same-window (find-file url) (find-file-other-window url))))
(let ((parsed (url-generic-parse-url url))
(func (if same-window 'find-file 'find-file-other-window)))
(if (and (equal (url-type parsed) "file")
(file-directory-p (url-filename parsed)))
;; It's a directory; just open it.
(funcall func (url-filename parsed))
(let ((file-name-handler-alist
(cons (cons url-handler-regexp 'url-file-handler)
file-name-handler-alist)))
(funcall func url)))))
(function-put 'browse-url-emacs 'browse-url-browser-kind 'internal)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment