[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r116582: lisp/subr.el (y-or-n-p): Fix double space i
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] trunk r116582: lisp/subr.el (y-or-n-p): Fix double space issue in message. |
Date: |
Thu, 27 Feb 2014 14:21:41 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116582
revision-id: address@hidden
parent: address@hidden
committer: Juanma Barranquero <address@hidden>
branch nick: trunk
timestamp: Thu 2014-02-27 15:21:28 +0100
message:
lisp/subr.el (y-or-n-p): Fix double space issue in message.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/subr.el subr.el-20091113204419-o5vbwnq5f7feedwu-151
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-02-27 11:59:04 +0000
+++ b/lisp/ChangeLog 2014-02-27 14:21:28 +0000
@@ -1,3 +1,7 @@
+2014-02-27 Juanma Barranquero <address@hidden>
+
+ * subr.el (y-or-n-p): Fix double space issue in message.
+
2014-02-27 Michael Albinus <address@hidden>
* net/tramp.el (tramp-call-process): Improve trace message.
=== modified file 'lisp/subr.el'
--- a/lisp/subr.el 2014-02-12 19:40:35 +0000
+++ b/lisp/subr.el 2014-02-27 14:21:28 +0000
@@ -2206,14 +2206,16 @@
;; ¡Beware! when I tried to edebug this code, Emacs got into a weird state
;; where all the keys were unbound (i.e. it somehow got triggered
;; within read-key, apparently). I had to kill it.
- (let ((answer 'recenter))
+ (let ((answer 'recenter)
+ (padded (lambda (prompt &optional dialog)
+ (let ((l (length prompt)))
+ (concat prompt
+ (if (or (zerop l) (eq ?\s (aref prompt (1- l))))
+ "" " ")
+ (if dialog "" "(y or n) "))))))
(cond
(noninteractive
- (setq prompt (concat prompt
- (if (or (zerop (length prompt))
- (eq ?\s (aref prompt (1- (length prompt)))))
- "" " ")
- "(y or n) "))
+ (setq prompt (funcall padded prompt))
(let ((temp-prompt prompt))
(while (not (memq answer '(act skip)))
(let ((str (read-string temp-prompt)))
@@ -2224,14 +2226,10 @@
((and (display-popup-menus-p)
(listp last-nonmenu-event)
use-dialog-box)
- (setq answer
- (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip)))))
+ (setq prompt (funcall padded prompt t)
+ answer (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip)))))
(t
- (setq prompt (concat prompt
- (if (or (zerop (length prompt))
- (eq ?\s (aref prompt (1- (length prompt)))))
- "" " ")
- "(y or n) "))
+ (setq prompt (funcall padded prompt))
(while
(let* ((scroll-actions '(recenter scroll-up scroll-down
scroll-other-window
scroll-other-window-down))
@@ -2264,9 +2262,7 @@
(discard-input))))
(let ((ret (eq answer 'act)))
(unless noninteractive
- ;; FIXME this prints one too many spaces, since prompt
- ;; already ends in a space. Eg "... (y or n) y".
- (message "%s %s" prompt (if ret "y" "n")))
+ (message "%s%c" prompt (if ret ?y ?n)))
ret)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r116582: lisp/subr.el (y-or-n-p): Fix double space issue in message.,
Juanma Barranquero <=