]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix mouse clicks on directory line in Dired
authorJared Finder <jared@finder.org>
Sat, 16 Dec 2023 20:10:03 +0000 (12:10 -0800)
committerEli Zaretskii <eliz@gnu.org>
Mon, 25 Dec 2023 13:02:34 +0000 (15:02 +0200)
The option 'dired-kill-when-opening-new-dired-buffer' should be
also honored when clicking the mouse to kill prev buffer.
* lisp/dired.el (dired--make-directory-clickable): Call
'dired--find-possibly-alternative-file' instead of 'dired', in
the click callback.  (Bug#67856)

lisp/dired.el

index cc548baf08001306a4095fd4462735ff69955beb..998de06ee6332a5285893569bd0ff0320bddca70 100644 (file)
@@ -1941,9 +1941,18 @@ mouse-2: visit this file in other window"
               keymap ,(let* ((current-dir dir)
                              (click (lambda ()
                                       (interactive)
-                                      (if (assoc current-dir dired-subdir-alist)
-                                          (dired-goto-subdir current-dir)
-                                        (dired current-dir)))))
+                                      (cond
+                                       ((assoc current-dir dired-subdir-alist)
+                                        (dired-goto-subdir current-dir))
+                                       ;; If there is a wildcard character in the directory, don't
+                                       ;; use the alternate file machinery which tries to keep only
+                                       ;; one dired buffer open at once.
+                                       ;;
+                                       ;; FIXME: Is this code path reachable?
+                                       ((insert-directory-wildcard-in-dir-p current-dir)
+                                        (dired current-dir))
+                                       (t
+                                        (dired--find-possibly-alternative-file current-dir))))))
                         (define-keymap
                           "<mouse-2>" click
                           "<follow-link>" 'mouse-face