Substitute command keys in 'ielm-header' at use time

Before, command keys were substituted into the ielm-header when
ielm.el was loaded, which resulted in the substitutions depending on
the user's current buffer instead of the ielm buffer.
For example, if the user was in an info-mode buffer, the key would
appear as 'H' instead of 'C-h m'.
Now, the command key is substituted after the ielm buffer has been
created.
* lisp/ielm.el (ielm-header): Remove substitute-command-keys.
(inferior-emacs-lisp-mode): Add substitute-command-keys.  (Bug#65213)

Copyright-paperwork-exempt: yes
This commit is contained in:
Matthew Tromp 2023-08-10 10:41:24 -04:00 committed by Eli Zaretskii
parent 99367078e5
commit 556cb01b48

View file

@ -148,9 +148,8 @@ such as `edebug-defun' to work with such inputs."
This variable is buffer-local.") This variable is buffer-local.")
(defvar ielm-header (defvar ielm-header
(substitute-command-keys
"*** Welcome to IELM *** Type (describe-mode) or press \ "*** Welcome to IELM *** Type (describe-mode) or press \
\\[describe-mode] for help.\n") \\[describe-mode] for help.\n"
"Message to display when IELM is started.") "Message to display when IELM is started.")
(defvaralias 'inferior-emacs-lisp-mode-map 'ielm-map) (defvaralias 'inferior-emacs-lisp-mode-map 'ielm-map)
@ -615,7 +614,7 @@ Customized bindings may be defined in `ielm-map', which currently contains:
(setq-local comint-inhibit-carriage-motion t) (setq-local comint-inhibit-carriage-motion t)
;; Add a silly header ;; Add a silly header
(insert ielm-header) (insert (substitute-command-keys ielm-header))
(ielm-set-pm (point-max)) (ielm-set-pm (point-max))
(unless comint-use-prompt-regexp (unless comint-use-prompt-regexp
(let ((inhibit-read-only t)) (let ((inhibit-read-only t))