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

From: Alcor <[email-masked]>
Date: Thu, 03 Jul 2025 18:55:21 +0200

Juri Linkov <[email-masked]> writes:

> Thanks for the corrected reproducer.  The 'C-h l' (view-lossage)
> shows that 'mouse-drag-region' gets in the way:
>
>  C-x 5 5          ;; other-frame-prefix
>  <down-mouse-1>   ;; mouse-drag-region
>  <mouse-1>        ;; dired-mouse-find-file
>  C-h l            ;; view-lossage
>
> If there are no better ideas, maybe it should be ignored explicitly:
>
> diff --git a/lisp/window.el b/lisp/window.el
> index af7680e4486..3e245741caa 100644
> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -9672,7 +9679,8 @@ display-buffer-override-next-command
>  		     (> (minibuffer-depth) minibuffer-depth)
>  		     ;; But don't remove immediately after
>  		     ;; adding the hook by the same command below.
> -		     (eq this-command command))
> +		     (eq this-command command)
> +		     (memq this-command '(mouse-drag-region)))
>                (funcall exitfun))))
>      ;; Call post-function after the next command finishes (bug#49057).
>      (add-hook 'post-command-hook postfun)

Thanks for the above patch, I can also confirm this fixes the issue when
applied on 30.1.

I just have a question regarding possible side effects: I understand
that this change ignores `mouse-drag-region' events. I'm not sure
whether it's possible to bind functions to these events, but if yes,
wouldn't this preclude any commands/functions bound to
`mouse-drag-region' from being affected by C-x 4 4 or C-x 5 5?

Cheers,
-A.