]> git.eshelyaron.com Git - emacs.git/commitdiff
Restore how (read-from-minibuffer ... read-expression-map) worked
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 14 Jul 2022 17:58:30 +0000 (19:58 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 14 Jul 2022 17:58:30 +0000 (19:58 +0200)
* lisp/simple.el (read-expression-map): Don't override RET and C-j
here, since that leads to breakages of other usages of this map
(bug#56548).
(read--expression-map): New map.
(read--expression): Use it.

lisp/simple.el

index e048df3695193cc11cf0600a0bdcccead5f2bf72..5443d961e13f4052b9dbce96884c1f991cccecab 100644 (file)
@@ -1918,17 +1918,19 @@ in *Help* buffer.  See also the command `describe-char'."
                   bidi-fixer encoding-msg pos total percent col hscroll))))))
 \f
 ;; Initialize read-expression-map.  It is defined at C level.
-(defvar read-expression-map
-  (let ((m (make-sparse-keymap)))
-    (define-key m "\M-\t" 'completion-at-point)
-    ;; Might as well bind TAB to completion, since inserting a TAB char is
-    ;; much too rarely useful.
-    (define-key m "\t" 'completion-at-point)
-    (define-key m "\r" 'read--expression-try-read)
-    (define-key m "\n" 'read--expression-try-read)
-    (define-key m "\M-g\M-c" 'read-expression-switch-to-completions)
-    (set-keymap-parent m minibuffer-local-map)
-    m))
+(defvar-keymap read-expression-map
+  :parent minibuffer-local-map
+  "C-M-i" #'completion-at-point
+  ;; Might as well bind TAB to completion, since inserting a TAB char is
+  ;; much too rarely useful.
+  "TAB" #'completion-at-point
+  "M-g M-c" #'read-expression-switch-to-completions)
+
+(defvar-keymap read--expression-map
+  :doc "Keymap used by `read--expression'."
+  :parent read-expression-map
+  "RET" #'read--expression-try-read
+  "C-j" #'read--expression-try-read)
 
 (defun read-minibuffer (prompt &optional initial-contents)
   "Return a Lisp object read using the minibuffer, unevaluated.
@@ -2020,7 +2022,7 @@ function `read-from-minibuffer'."
                   #'elisp-completion-at-point nil t)
         (run-hooks 'eval-expression-minibuffer-setup-hook))
     (read-from-minibuffer prompt initial-contents
-                          read-expression-map t
+                          read--expression-map t
                           'read-expression-history)))
 
 (defun read--expression-try-read ()