Skip to content

Common keys - #916

Open
Matafou wants to merge 4 commits into
ProofGeneral:masterfrom
Matafou:common-keys
Open

Matafou wants to merge 4 commits into
ProofGeneral:masterfrom
Matafou:common-keys

Conversation

@Matafou

@Matafou Matafou commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Coq: key bindings for all backends, and fixes in the goals and response buffers

  • Script buffer: coq-mode-map is the keymap of Coq mode in every backend, and with Proof General it has priority over proof-mode-map. This is now documented in the manual and in CHANGES: users keep their key bindings when they switch backend by defining them in coq-mode-map.
  • Goals and response buffers: they had their own copy of the default keys of the queries, so the key bindings of the user in coq-mode-map did not apply there, and each backend had to redo the copy.
    • The new list coq-all-buffers-commands names the commands of the script buffer that make sense in these buffers too: queries, display and printing options.
    • coq-all-buffers-keymap returns a keymap with the key bindings of these commands in coq-mode-map, both the default ones and those of the user. It does not include the keymaps that coq-mode-map inherits from. It also has C-c C-a C-r and C-c C-a C-g, which store the response and the goals (in the script buffer, these keys are insertions).
    • Proof General makes this keymap a parent of coq-goals-mode-map and coq-response-mode-map, before its generic keymaps. It rebuilds it each time these buffers are set up, so after the user's configuration. Key bindings the user put directly in these mode maps keep their priority.
    • The hypothesis keys (f, F, h, H) stay in the goals buffer only.
    • Change: C-c C-a C-r and C-c C-a C-g now also work in the goals buffer.
  • Fix: storing the goals or the response again, for instance with C-c C-a C-r from response-freeze, opened a new frame each time. It now updates the visible window that already displays that buffer.
  • Keys q and c of the goals and response buffers (bury-buffer, pg-response-clear-displays) never worked: they were bound to the event symbols [q] and [c] instead of characters. They are now commented out, with the working version and the question whether they are useful. No change of behavior.
  • Tests, with and without Proof General: user key bindings and their priorities in the three buffers, the hypothesis keys only in the goals buffer, the generic Proof General keys still working, and storing twice opening a single frame.

Matafou and others added 4 commits November 7, 2026 00:21
…tests).

coq-mode-map is the keymap of Coq mode in all backends, and with Proof
General it has priority over proof-mode-map.  Document it in the manual
and in CHANGES: to keep their key bindings with another backend, users
define them in coq-mode-map, preferably on the common commands.  Tests:
a key binding of the user in coq-mode-map, also by local-set-key in
coq-mode-hook, applies without Proof General; with it, it has priority
over proof-mode-map, whose key bindings apply too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ls and response buffers.

The goals and response buffers had their own copy of the default keys
of the queries and of the display, so that the key bindings of the
user in coq-mode-map did not apply there, and each backend had to
redo it.  coq-all-buffers-commands lists the commands of the script
buffer that make sense there too (queries, display, printing options),
and coq-all-buffers-keymap returns a keymap with their key bindings in
coq-mode-map, default and of the user, plus C-c C-a C-r and C-c C-a C-g
(store the response and the goals, insertions in the script buffer).
Proof General makes it a parent of coq-goals-mode-map and
coq-response-mode-map, before its generic keymaps, each time these
buffers are set up: after the configuration of the user, whose key
bindings in these mode maps keep the priority.  The keys of the
hypotheses (f, F, h, H) stay in the goals buffer only.  Tests, with and
without Proof General, and doc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
coq-store-buffer-win displayed the buffer in another frame each time:
storing the goals or the response again, for instance with C-c C-a C-r
from *response-freeze* (which has the keys of the response buffer),
opened a new frame.  Reuse the visible window that displays it, if
any.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They were bound to [q] and [c], the event symbols q and c, not the
characters, so they never worked: the keys q and c are undefined in
these buffers (proof-universal-keys-only-mode).  Rather than enabling
them after all this time, keep the working version in a comment, with
the question whether they are really useful.  No change of behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant