emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 027f218: hack-local-variables-confirm uses the minibuffer to read


From: Juri Linkov
Subject: master 027f218: hack-local-variables-confirm uses the minibuffer to read answer (bug#38076)
Date: Sat, 9 Nov 2019 17:32:16 -0500 (EST)

branch: master
commit 027f218ad227c3966df94b22566c2e89a307362d
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    hack-local-variables-confirm uses the minibuffer to read answer (bug#38076)
    
    * 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      |  3 +++
 lisp/files.el | 16 ++++------------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index f2685a1..8356601 100644
--- 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'.
diff --git a/lisp/files.el b/lisp/files.el
index f7726b5..24b882e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]