Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
298520df
Commit
298520df
authored
Feb 27, 2014
by
Juanma Barranquero
Browse files
lisp/subr.el (y-or-n-p): Fix double space issue in message.
parent
eed1c399
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
lisp/ChangeLog
lisp/ChangeLog
+4
-0
lisp/subr.el
lisp/subr.el
+12
-16
No files found.
lisp/ChangeLog
View file @
298520df
2014-02-27 Juanma Barranquero <lekktu@gmail.com>
* subr.el (y-or-n-p): Fix double space issue in message.
2014-02-27 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-call-process): Improve trace message.
...
...
lisp/subr.el
View file @
298520df
...
...
@@ -2206,14 +2206,16 @@ is nil and `use-dialog-box' is non-nil."
;; ¡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 @@ is nil and `use-dialog-box' is non-nil."
((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 @@ is nil and `use-dialog-box' is non-nil."
(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)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment