Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
aa4de341
Commit
aa4de341
authored
Oct 29, 2011
by
Chong Yidong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* lisp/subr.el (y-or-n-p): Add code for batch mode.
Fixes: debbugs:9818
parent
e1eb5385
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
lisp/ChangeLog
lisp/ChangeLog
+2
-0
lisp/subr.el
lisp/subr.el
+20
-6
No files found.
lisp/ChangeLog
View file @
aa4de341
2011-10-29 Chong Yidong <cyd@gnu.org>
* subr.el (y-or-n-p): Add code for batch mode (Bug#9818).
* mouse.el (mouse-yank-primary): Push the mark (Bug#9894).
* textmodes/flyspell.el (flyspell-word): Fix char offset for
...
...
lisp/subr.el
View file @
aa4de341
...
...
@@ -2262,11 +2262,25 @@ is nil and `use-dialog-box' is non-nil."
;; where all the keys were unbound (i.e. it somehow got triggered
;; within read-key, apparently). I had to kill it.
(
let
((
answer
'recenter
))
(
if
(
and
(
display-popup-menus-p
)
(
listp
last-nonmenu-event
)
use-dialog-box
)
(
setq
answer
(
x-popup-dialog
t
`
(
,
prompt
(
"Yes"
.
act
)
(
"No"
.
skip
))))
(
cond
(
noninteractive
(
setq
prompt
(
concat
prompt
(
if
(
eq
?\s
(
aref
prompt
(
1-
(
length
prompt
))))
""
" "
)
"(y or n) "
))
(
let
((
temp-prompt
prompt
))
(
while
(
not
(
memq
answer
'
(
act
skip
)))
(
let
((
str
(
read-string
temp-prompt
)))
(
cond
((
member
str
'
(
"y"
"Y"
))
(
setq
answer
'act
))
((
member
str
'
(
"n"
"N"
))
(
setq
answer
'skip
))
(
t
(
setq
temp-prompt
(
concat
"Please answer y or n. "
prompt
))))))))
((
and
(
display-popup-menus-p
)
(
listp
last-nonmenu-event
)
use-dialog-box
)
(
setq
answer
(
x-popup-dialog
t
`
(
,
prompt
(
"Yes"
.
act
)
(
"No"
.
skip
)))))
(
t
(
setq
prompt
(
concat
prompt
(
if
(
eq
?\s
(
aref
prompt
(
1-
(
length
prompt
))))
""
" "
)
...
...
@@ -2288,7 +2302,7 @@ is nil and `use-dialog-box' is non-nil."
((
memq
answer
'
(
exit-prefix
quit
))
(
signal
'quit
nil
)
t
)
(
t
t
)))
(
ding
)
(
discard-input
)))
(
discard-input
)))
)
(
let
((
ret
(
eq
answer
'act
)))
(
unless
noninteractive
(
message
"%s %s"
prompt
(
if
ret
"y"
"n"
)))
...
...
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