aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/map-ynp.el63
2 files changed, 37 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 02250524116..41376f5b764 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12000-09-19 Dave Love <fx@gnu.org>
2
3 * map-ynp.el (map-y-or-n-p): Check use-dialog-box. Don't lose
4 with null `help'. Use modern backquote syntax.
5
12000-09-19 Gerd Moellmann <gerd@gnu.org> 62000-09-19 Gerd Moellmann <gerd@gnu.org>
2 7
3 * font-lock.el (font-lock-mode): Change message telling the user 8 * font-lock.el (font-lock-mode): Change message telling the user
diff --git a/lisp/map-ynp.el b/lisp/map-ynp.el
index be664e02e11..d23c31ac4b4 100644
--- a/lisp/map-ynp.el
+++ b/lisp/map-ynp.el
@@ -1,6 +1,6 @@
1;;; map-ynp.el --- General-purpose boolean question-asker. 1;;; map-ynp.el --- General-purpose boolean question-asker.
2 2
3;; Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. 3;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 2000 Free Software Foundation, Inc.
4 4
5;; Author: Roland McGrath <roland@gnu.org> 5;; Author: Roland McGrath <roland@gnu.org>
6;; Maintainer: FSF 6;; Maintainer: FSF
@@ -96,20 +96,21 @@ Returns the number of actions taken."
96 list (cdr list)) 96 list (cdr list))
97 t) 97 t)
98 nil)))))) 98 nil))))))
99 (if (listp last-nonmenu-event) 99 (if (and (listp last-nonmenu-event)
100 use-dialog-box)
100 ;; Make a list describing a dialog box. 101 ;; Make a list describing a dialog box.
101 (let ((object (capitalize (nth 0 help))) 102 (let ((object (if help (capitalize (nth 0 help))))
102 (objects (capitalize (nth 1 help))) 103 (objects (if help (capitalize (nth 1 help))))
103 (action (capitalize (nth 2 help)))) 104 (action (if help (capitalize (nth 2 help)))))
104 (setq map (` (("Yes" . act) ("No" . skip) ("Quit" . exit) 105 (setq map `(("Yes" . act) ("No" . skip) ("Quit" . exit)
105 ((, (if help (concat action " " object " And Quit") 106 (,(if help (concat action " " object " And Quit")
106 "Do it and Quit")) . act-and-exit) 107 "Do it and Quit") . act-and-exit)
107 ((, (if help (concat action " All " objects) 108 (,(if help (concat action " All " objects)
108 "Do All")) . automatic) 109 "Do All") . automatic)
109 (,@ (mapcar (lambda (elt) 110 ,@(mapcar (lambda (elt)
110 (cons (capitalize (nth 2 elt)) 111 (cons (capitalize (nth 2 elt))
111 (vector (nth 1 elt)))) 112 (vector (nth 1 elt))))
112 action-alist)))) 113 action-alist))
113 use-menus t 114 use-menus t
114 mouse-event last-nonmenu-event)) 115 mouse-event last-nonmenu-event))
115 (setq user-keys (if action-alist 116 (setq user-keys (if action-alist
@@ -130,8 +131,8 @@ Returns the number of actions taken."
130 (unwind-protect 131 (unwind-protect
131 (progn 132 (progn
132 (if (stringp prompter) 133 (if (stringp prompter)
133 (setq prompter (` (lambda (object) 134 (setq prompter `(lambda (object)
134 (format (, prompter) object))))) 135 (format ,prompter object))))
135 (while (funcall next) 136 (while (funcall next)
136 (setq prompt (funcall prompter elt)) 137 (setq prompt (funcall prompter elt))
137 (cond ((stringp prompt) 138 (cond ((stringp prompt)
@@ -176,9 +177,9 @@ Returns the number of actions taken."
176 next (function (lambda () nil)))) 177 next (function (lambda () nil))))
177 ((or (eq def 'quit) (eq def 'exit-prefix)) 178 ((or (eq def 'quit) (eq def 'exit-prefix))
178 (setq quit-flag t) 179 (setq quit-flag t)
179 (setq next (` (lambda () 180 (setq next `(lambda ()
180 (setq next '(, next)) 181 (setq next ',next)
181 '(, elt))))) 182 ',elt)))
182 ((eq def 'automatic) 183 ((eq def 'automatic)
183 ;; Act on this and all following objects. 184 ;; Act on this and all following objects.
184 (if (funcall prompter elt) 185 (if (funcall prompter elt)
@@ -219,34 +220,34 @@ the current %s and exit."
219 (set-buffer standard-output) 220 (set-buffer standard-output)
220 (help-mode))) 221 (help-mode)))
221 222
222 (setq next (` (lambda () 223 (setq next (lambda ()
223 (setq next '(, next)) 224 (setq next ',next)
224 '(, elt))))) 225 ',elt)))
225 ((vectorp def) 226 ((vectorp def)
226 ;; A user-defined key. 227 ;; A user-defined key.
227 (if (funcall (aref def 0) elt) ;Call its function. 228 (if (funcall (aref def 0) elt) ;Call its function.
228 ;; The function has eaten this object. 229 ;; The function has eaten this object.
229 (setq actions (1+ actions)) 230 (setq actions (1+ actions))
230 ;; Regurgitated; try again. 231 ;; Regurgitated; try again.
231 (setq next (` (lambda () 232 (setq next (lambda ()
232 (setq next '(, next)) 233 (setq next ',next)
233 '(, elt)))))) 234 ',elt))))
234 ((and (consp char) 235 ((and (consp char)
235 (eq (car char) 'switch-frame)) 236 (eq (car char) 'switch-frame))
236 ;; switch-frame event. Put it off until we're done. 237 ;; switch-frame event. Put it off until we're done.
237 (setq delayed-switch-frame char) 238 (setq delayed-switch-frame char)
238 (setq next (` (lambda () 239 (setq next (lambda ()
239 (setq next '(, next)) 240 (setq next ',next)
240 '(, elt))))) 241 ',elt)))
241 (t 242 (t
242 ;; Random char. 243 ;; Random char.
243 (message "Type %s for help." 244 (message "Type %s for help."
244 (key-description (vector help-char))) 245 (key-description (vector help-char)))
245 (beep) 246 (beep)
246 (sit-for 1) 247 (sit-for 1)
247 (setq next (` (lambda () 248 (setq next (lambda ()
248 (setq next '(, next)) 249 (setq next ',next)
249 '(, elt))))))) 250 ',elt)))))
250 (prompt 251 (prompt
251 (funcall actor elt) 252 (funcall actor elt)
252 (setq actions (1+ actions)))))) 253 (setq actions (1+ actions))))))