unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74700: [PATCH] Revert Dired buffer when clicking on last segment of directory name
@ 2024-12-05  6:12 Visuwesh
  2024-12-05  7:02 ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Visuwesh @ 2024-12-05  6:12 UTC (permalink / raw)
  To: 74700

[-- Attachment #1: Type: text/plain, Size: 882 bytes --]

Tags: patch

Attached patch makes it possible to revert the current Dired buffer by
clicking on the last segment of the directory line.  With the patch
applied,

  /home/viz/lib/ports/emacs:

clicking on 'emacs' now reverts the buffer that shows ~/lib/ports/emacs.
Previously, it did nothing.  This makes it possible to update the Dired
listing without needing to use the keyboard.


In GNU Emacs 31.0.50 (build 25, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.2, Xaw scroll bars) of 2024-11-10 built on astatine
Repository revision: 1704fa4fb4164a15c7e258b922dbba190811d92d
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure --with-sound=alsa --with-x-toolkit=lucid --without-xaw3d
 --without-gconf --without-libsystemd --with-cairo CFLAGS=-g3'

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Revert-Dired-buffer-when-clicking-on-last-segment-of.patch --]
[-- Type: text/patch, Size: 1863 bytes --]

From 83da5ad8ef930ed6d093b6b5dec2322599fac763 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Thu, 5 Dec 2024 11:40:02 +0530
Subject: [PATCH] Revert Dired buffer when clicking on last segment of
 directory name

* lisp/dired.el (dired--make-directory-clickable): Make clicking
on the last segment of the directory line revert the Dired
buffer.
* etc/NEWS: Announce the change.
---
 etc/NEWS      |  5 +++++
 lisp/dired.el | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index e63132efeda..e35f007dbe1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -587,6 +587,11 @@ Without 'dired-hide-details-hide-absolute-location':
 
     /absolute/path/to/my/important/project: (100 GiB available)
 
+---
+*** Clicking on last segment of directory reverts buffer
+When 'dired-make-directory-clickable' is non-nil, clicking on the last
+segment of the directory name now reverts the Dired buffer.
+
 ** Grep
 
 +++
diff --git a/lisp/dired.el b/lisp/dired.el
index f79a2220bea..4e300879f88 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2082,7 +2082,16 @@ dired--make-directory-clickable
                           "<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: revert this buffer"
+              keymap ,(define-keymap
+                        "<mouse-2>" #'revert-buffer
+                        "<follow-link>" 'follow-link
+                        "RET" #'revert-buffer))))))))
 
 (defun dired--get-ellipsis-length ()
   "Return length of ellipsis."
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-12-26 12:08 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-05  6:12 bug#74700: [PATCH] Revert Dired buffer when clicking on last segment of directory name Visuwesh
2024-12-05  7:02 ` Eli Zaretskii
2024-12-05  8:26   ` Visuwesh
2024-12-05  8:41     ` Eli Zaretskii
2024-12-05  9:02       ` Visuwesh
2024-12-05  9:24         ` Eli Zaretskii
2024-12-05 10:42           ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-05 17:56         ` Juri Linkov
2024-12-12 10:31     ` Eli Zaretskii
2024-12-23 21:31       ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-24  3:22         ` Visuwesh
2024-12-24 23:39           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-25  3:43             ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-25  4:47             ` Visuwesh
2024-12-26  8:56               ` Eli Zaretskii
2024-12-26 11:51                 ` Visuwesh
2024-12-26 12:08                   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).