]> git.eshelyaron.com Git - emacs.git/commitdiff
Make Dired header clickable on non-Posix systems as well
authorEli Zaretskii <eliz@gnu.org>
Sat, 29 Oct 2022 13:16:06 +0000 (16:16 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 29 Oct 2022 13:16:06 +0000 (16:16 +0300)
* lisp/dired.el (dired--make-directory-clickable): Support
MS-Windows and MS-DOS absolute directory names with drive letters
and UNCs.  (Bug#21973)

lisp/dired.el

index 128770105b08fed59b5a1124615a1e6aa68ca4e0..7a8f1ae7a16b1ca2af341d9f0f76b9172d4a0cb2 100644 (file)
@@ -1911,11 +1911,15 @@ mouse-2: visit this file in other window"
 (defun dired--make-directory-clickable ()
   (save-excursion
     (goto-char (point-min))
-    (while (re-search-forward "^  /" nil t 1)
+    (while (re-search-forward
+            (if (memq system-type '(windows-nt ms-dos))
+                "^  \\([a-zA-Z]:/\\|//\\)"
+              "^  /")
+            nil t 1)
       (let ((bound (line-end-position))
             (segment-start (point))
             (inhibit-read-only t)
-            (dir "/"))
+            (dir (substring (match-string 1) 2)))
         (while (search-forward "/" bound t 1)
           (setq dir (concat dir (buffer-substring segment-start (point))))
           (add-text-properties