Subject: Re: bug#73544: smerge key bindings awkward

From: Stefan Monnier <[email-masked]>
Date: Thu, 17 Oct 2024 13:37:43 -0400

> It's a defect in the user interface.

IIUC the original scenario is:

    C-c ^ n
    <fix the conflict>
    C-c ^ n

and here being annoyed that `n` was inserted (after flashing the buffer
because `C-c ^` is not bound to anything) because that was the last
conflict and `smerge-mode` turned itself off automatically.

I'm not completely sure what is the exact defect you see here and how
you suggest to fix it.  E.g. do you also care to "fix" a case like

    emacs foo
    C-c ^ n

where the user forgot to enable `smerge-mode`?

How 'bout the patch below, which will end up preventing `read-key-sequence`
from stopping at `C-c ^`?

        Stefan

diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index aad3e302826..fa52286fee7 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -168,6 +168,10 @@ smerge-command-prefix
 		 (const :tag "none"  "")
 		 string))
 
+;; Make it so `C-x ^ n' doesn't insert `n' but just signals an error
+;; when SMerge mode is not enabled.
+;;;###autoload (global-set-key "\C-c^" (make-sparse-keymap))
+
 (defvar-keymap smerge-mode-map
   (key-description smerge-command-prefix) smerge-basic-map)