unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: eliz@gnu.org, 74700@debbugs.gnu.org
Subject: bug#74700: [PATCH] Revert Dired buffer when clicking on last segment of directory name
Date: Tue, 24 Dec 2024 08:52:16 +0530	[thread overview]
Message-ID: <874j2tbw9j.fsf@gmail.com> (raw)
In-Reply-To: <87msgmozm3.fsf@web.de> (Michael Heerdegen's message of "Mon, 23 Dec 2024 22:31:32 +0100")

[திங்கள் டிசம்பர் 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	other threads:[~2024-12-24  3:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874j2tbw9j.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=74700@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).