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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 05 Dec 2024 09:02:01 +0200

> From: Visuwesh <[email-masked]>
> Date: Thu, 05 Dec 2024 11:42:08 +0530
> 
> 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.

Thanks, a few comments below.

> +---
> +*** 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.

We don't call these "segments", we call them "components".  And since
you are talking about the last one, you could also say "base name of
the directory".

> +        (when (search-forward ":" bound t)
> +          (add-text-properties
> +           segment-start (1- (point))
> +           `( mouse-face highlight
               ^^
We don't leave whitespace after the opening parenthesis.

> +              help-echo "mouse-1: revert this buffer"

I think the help-echo should say something more similar to what we say
for the other components of the directory shown in the header line.
Something like "re-read this buffer's directory".

> +              keymap ,(define-keymap
> +                        "<mouse-2>" #'revert-buffer
> +                        "<follow-link>" 'follow-link
> +                        "RET" #'revert-buffer))))))))

Should we perhaps call dired-revert directly?