Mercurial > emacs
comparison lisp/map-ynp.el @ 14818:3349089ced14
(map-y-or-n-p): Fix previous change.
Delete autoload cookie (file is preloaded).
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 17 Mar 1996 15:40:29 +0000 |
parents | 83f275dcd93a |
children | 6f891b1ba617 |
comparison
equal
deleted
inserted
replaced
14817:cdd8a024f000 | 14818:3349089ced14 |
---|---|
32 ;; questions; ESC or q to answer n to all remaining questions; . to answer | 32 ;; questions; ESC or q to answer n to all remaining questions; . to answer |
33 ;; y once and then n for the remainder; and you can get help with C-h. | 33 ;; y once and then n for the remainder; and you can get help with C-h. |
34 | 34 |
35 ;;; Code: | 35 ;;; Code: |
36 | 36 |
37 ;;;###autoload | |
38 (defun map-y-or-n-p (prompter actor list &optional help action-alist | 37 (defun map-y-or-n-p (prompter actor list &optional help action-alist |
39 no-cursor-in-echo-area) | 38 no-cursor-in-echo-area) |
40 "Ask a series of boolean questions. | 39 "Ask a series of boolean questions. |
41 Takes args PROMPTER ACTOR LIST, and optional args HELP and ACTION-ALIST. | 40 Takes args PROMPTER ACTOR LIST, and optional args HELP and ACTION-ALIST. |
42 | 41 |
77 are meaningful here. | 76 are meaningful here. |
78 | 77 |
79 Returns the number of actions taken." | 78 Returns the number of actions taken." |
80 (let* ((actions 0) | 79 (let* ((actions 0) |
81 user-keys mouse-event map prompt char elt tail def | 80 user-keys mouse-event map prompt char elt tail def |
81 ;; Non-nil means we should use mouse menus to ask. | |
82 use-menus | |
82 delayed-switch-frame | 83 delayed-switch-frame |
83 (next (if (or (and list (symbolp list)) | 84 (next (if (or (and list (symbolp list)) |
84 (subrp list) | 85 (subrp list) |
85 (byte-code-function-p list) | 86 (byte-code-function-p list) |
86 (and (consp list) | 87 (and (consp list) |
106 "Do All")) . automatic) | 107 "Do All")) . automatic) |
107 (,@ (mapcar (lambda (elt) | 108 (,@ (mapcar (lambda (elt) |
108 (cons (capitalize (nth 2 elt)) | 109 (cons (capitalize (nth 2 elt)) |
109 (vector (nth 1 elt)))) | 110 (vector (nth 1 elt)))) |
110 action-alist)))) | 111 action-alist)))) |
112 use-menus t | |
111 mouse-event last-nonmenu-event)) | 113 mouse-event last-nonmenu-event)) |
112 (setq user-keys (if action-alist | 114 (setq user-keys (if action-alist |
113 (concat (mapconcat (function | 115 (concat (mapconcat (function |
114 (lambda (elt) | 116 (lambda (elt) |
115 (key-description | 117 (key-description |
132 (while (funcall next) | 134 (while (funcall next) |
133 (setq prompt (funcall prompter elt)) | 135 (setq prompt (funcall prompter elt)) |
134 (cond ((stringp prompt) | 136 (cond ((stringp prompt) |
135 ;; Prompt the user about this object. | 137 ;; Prompt the user about this object. |
136 (setq quit-flag nil) | 138 (setq quit-flag nil) |
137 (if mouse-event | 139 (if use-menus |
138 (setq def (or (x-popup-dialog mouse-event | 140 (setq def (or (x-popup-dialog (or mouse-event use-menus) |
139 (cons prompt map)) | 141 (cons prompt map)) |
140 'quit)) | 142 'quit)) |
141 ;; Prompt in the echo area. | 143 ;; Prompt in the echo area. |
142 (let ((cursor-in-echo-area (not no-cursor-in-echo-area)) | 144 (let ((cursor-in-echo-area (not no-cursor-in-echo-area)) |
143 (message-log-max nil)) | 145 (message-log-max nil)) |