Subject: Re: bug#69242: project-any-command with overriding-local-map

From: Dmitry Gutov <[email-masked]>
Date: Mon, 19 Feb 2024 18:01:56 +0200

On 17/02/2024 19:17, Juri Linkov wrote:
> And indeed evaluating in a*vc-diff*  buffer:
> 
>    M-: (let ((overriding-local-map project-prefix-map)) (key-binding (read-key-sequence "? ") t))
> 
> returns nil for any longer than 1-key binding such as 'C-c C-a' or 'C-c RET a'.

I suppose that's because you are entering a sequence that belongs to a 
local map (diff-mode-map), and overriding-local-map overrides them 
entirely ("INSTEAD OF" in the docstring), rather than having a higher 
priority, which is overriding-terminal-local-map does.

> Then found this patch fixes the problem completely (no idea why):
> 
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index aa92a73336e..fe866312931 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -1871,7 +1874,7 @@ project-any-command
>     (interactive)
>     (let* ((pr (project-current t))
>            (prompt-format (or prompt-format "[execute in %s]:"))
> -         (command (let ((overriding-local-map overriding-map))
> +         (command (let ((overriding-terminal-local-map overriding-map))
>                       (key-binding (read-key-sequence
>                                     (format prompt-format (project-root pr)))
>                                    t)))

LGTM, thanks. Let's see if this one triggers any other edge cases we 
didn't test for.