]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert Dired buffer when clicking on basename of directory
authorVisuwesh <visuweshm@gmail.com>
Thu, 5 Dec 2024 06:10:02 +0000 (11:40 +0530)
committerEshel Yaron <me@eshelyaron.com>
Thu, 12 Dec 2024 16:01:01 +0000 (17:01 +0100)
* lisp/dired.el (dired--make-directory-clickable): Make clicking
on basename of the directory revert the Dired buffer.
* etc/NEWS: Announce the change.  (Bug#74700)

(cherry picked from commit eb9ba4830e4c7853150eaed93f89225c00d6e52a)

etc/NEWS
lisp/dired.el

index 19825bfea687f765cb1fd1802233cfe7399631ee..694a0e49b05f4ac8cc750d4c2ddb1ed6f39c1d46 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -574,6 +574,11 @@ Without dired-hide-details-hide-absolute-location:
 
   /absolute/path/to/my/important/project: (100 GiB available)
 
+---
+*** Clicking on base name of directory reverts buffer.
+When 'dired-make-directory-clickable' is non-nil, clicking on the base
+name of the directory now reverts the Dired buffer.
+
 ** Grep
 
 +++
index bf19f247c8124146630e0cf0731a121267c4a7ef..8999c55004b3f3a0d50da5b92d3cc87dc7c12e3b 100644 (file)
@@ -2075,7 +2075,16 @@ mouse-2: visit this file in other window"
                           "<mouse-2>" click
                           "<follow-link>" 'mouse-face
                           "RET" click))))
-          (setq segment-start (point)))))))
+          (setq segment-start (point)))
+        (when (search-forward ":" bound t)
+          (add-text-properties
+           segment-start (1- (point))
+           `(mouse-face highlight
+             help-echo "mouse-1: re-read this buffer's directory"
+             keymap ,(define-keymap
+                       "<mouse-2>" #'revert-buffer
+                       "<follow-link>" 'follow-link
+                       "RET" #'revert-buffer))))))))
 
 (defun dired--get-ellipsis-length ()
   "Return length of ellipsis."