This was an interesting one.
html-mode
is derived from sgml-mode
, which uses skeletons, which may read input from the minibuffer, which, underneath it all, uses read-char
to get keyboard input.
read-char
gets one event (one key press) before the key-translation-map
is used. On top of that, if the help-form
(minibuffer-help-form
when reading from the minibuffer) variable is bound and is not nil
, characters equal to help-char
are captured and trigger the evaluation of help-form
(or minibuffer-help-form
), the value of which, if it is a string, is displayed in the *Char Help*
buffer.
Here's the problem: C-h
is the default value of help-char
. This makes it impossible to input C-h
(or whatever help-char
is set to) if minibuffer-help-form
is set, and skeleton-read
does set it.
This suggests that the issue described in the question should affect other modes too.
Here's a minimal example:
(define-key key-translation-map (kbd "C-h") (kbd "<DEL>"))
(let ((minibuffer-help-form "Help!"))
(read-from-minibuffer "Try using ^H now! "))
To get around this, you can just
(setq help-char nil)
or customize this variable. This disables evaluation of help-form
and minibuffer-help-form
everywhere.
Alternatively, you can add advice to skeleton-read
to allow using C-h
in skeleton prompts and keep the default behavior elsewhere:
(advice-add 'skeleton-read :around
(lambda (orig &rest args)
(let ((help-char nil))
(apply orig args))))