From: Lars Ingebrigtsen Date: Sat, 17 Oct 2020 09:24:03 +0000 (+0200) Subject: Fix `browse-url-of-dired' X-Git-Tag: emacs-28.0.90~5585 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ea47bcc431ee7e3fbb545ad05b12ed921923c468;p=emacs.git 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). --- diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index e7dad48cf4a..8b245b01066 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -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)