Subject: bug#78945: 30.1; C-x 4 4 and C-x 5 5 do not work with `dired-mouse-find-file'

From: Stefan Monnier <[email-masked]>
Date: Mon, 07 Jul 2025 09:58:01 -0400

> Not sure how would be possible to handle double-clicks in this case:
>
>   C-x 5 5                 ;; other-frame-prefix
>   <down-mouse-1>          ;; mouse-drag-region
>   <mouse-1>               ;; mouse-set-point
>   <double-down-mouse-1>   ;; mouse-drag-region
>   <double-mouse-1>        ;; mouse-set-point

Why not?

> `describe-key` uses
>
>   (and (not (memq mouse-1-click-follows-link '(nil double)))
>        (> (length raw) 0)
>        (eq (car-safe (aref raw 0)) 'mouse-1)

Not really.  The relevant code is (in `help--read-key-sequence`):

          (while
              ;; Read at least one key-sequence.
              (or (null key-list)
                  ;; After a down event, also read the (presumably) following
                  ;; up-event.
                  (memq 'down last-modifiers)
                  ;; After a click, see if a double click is on the way.
                  (and (memq 'click last-modifiers)
                       (not (sit-for (/ (mouse-double-click-time) 1000.0) t))))

That also handles triple-clicks.

> But I'm afraid that not exiting on <mouse-1> in
> `display-buffer-override-next-command` would be too error-prone.

The "normal" way to disable the override is by consuming it:

                       ;; Reset display-buffer-overriding-action
                       ;; after the first display-buffer action (bug#39722).
                       (funcall clearfun)

I'm not suggesting we leave the override active "indefinitely" for as
long as no `display-buffer` used it, but I don't expect any serious
problem if the override lingers a bit longer.

        Stefan