aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2014-02-27 15:21:28 +0100
committerJuanma Barranquero2014-02-27 15:21:28 +0100
commit298520dfb7f609e41db1368ff47834d3d04e2183 (patch)
tree4733e5fd6fcfc1f86eba57134282fb7006a1417e
parenteed1c3990176addda8eb4deed826d1d12fb54dee (diff)
downloademacs-298520dfb7f609e41db1368ff47834d3d04e2183.tar.gz
emacs-298520dfb7f609e41db1368ff47834d3d04e2183.zip
lisp/subr.el (y-or-n-p): Fix double space issue in message.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/subr.el28
2 files changed, 16 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 37e0b7aa1a2..07781adc191 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12014-02-27 Juanma Barranquero <lekktu@gmail.com>
2
3 * subr.el (y-or-n-p): Fix double space issue in message.
4
12014-02-27 Michael Albinus <michael.albinus@gmx.de> 52014-02-27 Michael Albinus <michael.albinus@gmx.de>
2 6
3 * net/tramp.el (tramp-call-process): Improve trace message. 7 * net/tramp.el (tramp-call-process): Improve trace message.
diff --git a/lisp/subr.el b/lisp/subr.el
index ad783acc929..1bfa3c83a35 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2206,14 +2206,16 @@ is nil and `use-dialog-box' is non-nil."
2206 ;; ¡Beware! when I tried to edebug this code, Emacs got into a weird state 2206 ;; ¡Beware! when I tried to edebug this code, Emacs got into a weird state
2207 ;; where all the keys were unbound (i.e. it somehow got triggered 2207 ;; where all the keys were unbound (i.e. it somehow got triggered
2208 ;; within read-key, apparently). I had to kill it. 2208 ;; within read-key, apparently). I had to kill it.
2209 (let ((answer 'recenter)) 2209 (let ((answer 'recenter)
2210 (padded (lambda (prompt &optional dialog)
2211 (let ((l (length prompt)))
2212 (concat prompt
2213 (if (or (zerop l) (eq ?\s (aref prompt (1- l))))
2214 "" " ")
2215 (if dialog "" "(y or n) "))))))
2210 (cond 2216 (cond
2211 (noninteractive 2217 (noninteractive
2212 (setq prompt (concat prompt 2218 (setq prompt (funcall padded prompt))
2213 (if (or (zerop (length prompt))
2214 (eq ?\s (aref prompt (1- (length prompt)))))
2215 "" " ")
2216 "(y or n) "))
2217 (let ((temp-prompt prompt)) 2219 (let ((temp-prompt prompt))
2218 (while (not (memq answer '(act skip))) 2220 (while (not (memq answer '(act skip)))
2219 (let ((str (read-string temp-prompt))) 2221 (let ((str (read-string temp-prompt)))
@@ -2224,14 +2226,10 @@ is nil and `use-dialog-box' is non-nil."
2224 ((and (display-popup-menus-p) 2226 ((and (display-popup-menus-p)
2225 (listp last-nonmenu-event) 2227 (listp last-nonmenu-event)
2226 use-dialog-box) 2228 use-dialog-box)
2227 (setq answer 2229 (setq prompt (funcall padded prompt t)
2228 (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip))))) 2230 answer (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip)))))
2229 (t 2231 (t
2230 (setq prompt (concat prompt 2232 (setq prompt (funcall padded prompt))
2231 (if (or (zerop (length prompt))
2232 (eq ?\s (aref prompt (1- (length prompt)))))
2233 "" " ")
2234 "(y or n) "))
2235 (while 2233 (while
2236 (let* ((scroll-actions '(recenter scroll-up scroll-down 2234 (let* ((scroll-actions '(recenter scroll-up scroll-down
2237 scroll-other-window scroll-other-window-down)) 2235 scroll-other-window scroll-other-window-down))
@@ -2264,9 +2262,7 @@ is nil and `use-dialog-box' is non-nil."
2264 (discard-input)))) 2262 (discard-input))))
2265 (let ((ret (eq answer 'act))) 2263 (let ((ret (eq answer 'act)))
2266 (unless noninteractive 2264 (unless noninteractive
2267 ;; FIXME this prints one too many spaces, since prompt 2265 (message "%s%c" prompt (if ret ?y ?n)))
2268 ;; already ends in a space. Eg "... (y or n) y".
2269 (message "%s %s" prompt (if ret "y" "n")))
2270 ret))) 2266 ret)))
2271 2267
2272 2268