bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#74700: [PATCH] Revert Dired buffer when clicking on last segment of


From: Visuwesh
Subject: bug#74700: [PATCH] Revert Dired buffer when clicking on last segment of directory name
Date: Tue, 24 Dec 2024 08:52:16 +0530
User-agent: Gnus/5.13 (Gnus v5.13)

[திங்கள் டிசம்பர் 23, 2024] Michael Heerdegen wrote:

> Hello,
>
> a user on emacs-help (Dieter, CC'd) mentioned that in contrast to hitting g,
> reverting with this new method loses the position of point, instead,
> point is repositioned at the beginning of the buffer.  And I agree that
> this is not the optimal behavior.  Can we maybe improve this?
>

I didn't notice this, thanks for bringing this to my attention.  This
also caught another bug that I would not have noticed since I have
mouse-autoselect-window set non-nil.  With the following patch, using
mouse-2 on the base name reverts the buffer without moving point.
However, using mouse-1 still moves the point to bob.  I believe we could
fix it by directly binding mouse-1 but I would like to respect
mouse-1-click-follows-link like the rest of the code in the function.
I cannot tell how to prevent mouse-1 from moving point reading the Info
nodes (info "(elisp) Clickable Text") and (info "(emacs) Mouse
References").  I tried

    (with-selected-window (posn-window (event-start e)) ...)

to no avail.  This goes beyond my level of knowledge so someone else
will have to take care of this.  But please install the following patch
because without it using mouse-2 on the base name tries to revert the
current-buffer instead of the dired buffer when the dired buffer is not
shown in the selected window.

diff -u --label /home/viz/lib/ports/emacs/lisp/dired.el --label \#\<buffer\ 
dired.el\> /home/viz/lib/ports/emacs/lisp/dired.el /tmp/buffer-content-C8kgcN
--- /home/viz/lib/ports/emacs/lisp/dired.el
+++ #<buffer dired.el>
@@ -2089,8 +2089,10 @@
            `( mouse-face highlight
               help-echo "mouse-1: revert this buffer"
               keymap ,(define-keymap
-                        "<mouse-2>" #'revert-buffer
-                        "<follow-link>" 'follow-link
+                        "<mouse-2>" (lambda (_)
+                                      (interactive "@e")
+                                      (revert-buffer))
+                        "<follow-link>" 'mouse-face
                         "RET" #'revert-buffer))))))))
 
 (defun dired--get-ellipsis-length ()

Diff finished.  Tue Dec 24 08:40:30 2024







reply via email to

[Prev in Thread] Current Thread [Next in Thread]