I changed the C-h key binding to be used as backspace.

(define-key key-translation-map (kbd "C-h") (kbd "< DEL >"))

Now, this works flawlessy pretty much everywhere except in html-mode. When I'm in an HTML command minibuffer and press C-h, instead of deleting the last character this message appears:

You are inserting a skeleton. Standard text gets inserted into the buffer automatically, and you are prompted to fill in the variable parts.

How could I solve this problem if possible?


1 Answer 1


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))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.