]> git.eshelyaron.com Git - emacs.git/commitdiff
hack-local-variables-confirm uses the minibuffer to read answer (bug#38076)
authorJuri Linkov <juri@linkov.net>
Sat, 9 Nov 2019 22:32:09 +0000 (00:32 +0200)
committerJuri Linkov <juri@linkov.net>
Sat, 9 Nov 2019 22:32:09 +0000 (00:32 +0200)
* lisp/files.el (hack-local-variables-confirm):
Use read-char-from-minibuffer instead of read-char-choice.
Remove special handling of original window scrolling
that is now supported in the minibuffer.  This fixes
https://lists.gnu.org/archive/html/emacs-devel/2019-10/msg01020.html
(files--ask-user-about-large-file): Use read-char-from-minibuffer
instead of read-char-choice.

etc/NEWS
lisp/files.el

index f2685a1bfd8147a61f39d7c4ff3cbce9cb29294d..8356601cde7aa6fb3d213560b03a609a5d19e7e7 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -726,6 +726,9 @@ at the end of the active minibuffer.
 +++
 *** 'y-or-n-p' now uses the minibuffer to read 'y' or 'n' answer.
 
+*** Some commands that previously used read-char-choice now read
+a character using the minibuffer by read-char-from-minibuffer.
+
 ** map.el
 *** Now also understands plists.
 *** Now defined via generic functions that can be extended via 'cl-defmethod'.
index f7726b566a9c39c584ced0b8db6e7cd08b6700e1..24b882ede26a58d0f4c95428c9fb81e43bcd9df9 100644 (file)
@@ -2120,7 +2120,7 @@ think it does, because \"free\" is pretty hard to define in practice."
                                       ("Yes" . ?y)
                                       ("No" . ?n)
                                       ("Open literally" . ?l)))
-                (read-char-choice
+                (read-char-from-minibuffer
                  (concat prompt " (y)es or (n)o or (l)iterally ")
                  '(?y ?Y ?n ?N ?l ?L)))))
         (cond ((memq choice '(?y ?Y)) nil)
@@ -3503,24 +3503,16 @@ n  -- to ignore the local variables list.")
       ;; Display the buffer and read a choice.
       (save-window-excursion
        (pop-to-buffer buf '(display-buffer--maybe-at-bottom))
-       (let* ((exit-chars '(?y ?n ?\s ?\C-g ?\C-v))
+       (let* ((exit-chars '(?y ?n ?\s))
               (prompt (format "Please type %s%s: "
                               (if offer-save "y, n, or !" "y or n")
                               (if (< (line-number-at-pos (point-max))
                                      (window-body-height))
                                   ""
-                                (push ?\C-v exit-chars)
-                                ", or C-v to scroll")))
+                                ", or C-v/M-v to scroll")))
               char)
          (if offer-save (push ?! exit-chars))
-         (while (null char)
-           (setq char (read-char-choice prompt exit-chars t))
-           (when (eq char ?\C-v)
-             (condition-case nil
-                 (scroll-up)
-               (error (goto-char (point-min))
-                      (recenter 1)))
-             (setq char nil)))
+         (setq char (read-char-from-minibuffer prompt exit-chars))
          (when (and offer-save (= char ?!) unsafe-vars)
            (customize-push-and-save 'safe-local-variable-values unsafe-vars))
          (prog1 (memq char '(?! ?\s ?y))