Commit 027f218a authored by Juri Linkov's avatar Juri Linkov

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
(files--ask-user-about-large-file): Use read-char-from-minibuffer
instead of read-char-choice.
parent 04ab6747
Pipeline #3992 failed with stage
in 90 minutes and 2 seconds
......@@ -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'.
......@@ -2120,7 +2120,7 @@ think it does, because \"free\" is pretty hard to define in practice."
("Yes" . ?y)
("No" . ?n)
("Open literally" . ?l)))
(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.
(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))
(push ?\C-v exit-chars)
", or C-v to scroll")))
", or C-v/M-v to scroll")))
(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
(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))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment