annotate lisp/emacs-lisp/map-ynp.el @ 105458:4d2aa5860e37

(Ffile_attributes): Doc fix. (Bug#4638)
author Eli Zaretskii <eliz@gnu.org>
date Mon, 05 Oct 2009 08:35:12 +0000
parents a9dc0e7c3f2b
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
1 ;;; map-ynp.el --- general-purpose boolean question-asker
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
2
74466
1d4b1a32fd66 Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 68648
diff changeset
3 ;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 2000, 2001, 2002, 2003,
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 95857
diff changeset
4 ;; 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
5
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
6 ;; Author: Roland McGrath <roland@gnu.org>
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
7 ;; Maintainer: FSF
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
8 ;; Keywords: lisp, extensions
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
9
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
11
94655
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94655
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; (at your option) any later version.
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
16
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
21
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94655
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
24
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
25 ;;; Commentary:
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
26
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
27 ;; map-y-or-n-p is a general-purpose question-asking function.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
28 ;; It asks a series of y/n questions (a la y-or-n-p), and decides to
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
29 ;; apply an action to each element of a list based on the answer.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
30 ;; The nice thing is that you also get some other possible answers
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
31 ;; to use, reminiscent of query-replace: ! to answer y to all remaining
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
32 ;; questions; ESC or q to answer n to all remaining questions; . to answer
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
33 ;; y once and then n for the remainder; and you can get help with C-h.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
34
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
35 ;;; Code:
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
36
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 95806
diff changeset
37 (declare-function x-popup-dialog "xmenu.c" (position contents &optional header))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 95806
diff changeset
38
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
39 (defun map-y-or-n-p (prompter actor list &optional help action-alist
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
40 no-cursor-in-echo-area)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
41 "Ask a series of boolean questions.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
42 Takes args PROMPTER ACTOR LIST, and optional args HELP and ACTION-ALIST.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
43
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
44 LIST is a list of objects, or a function of no arguments to return the next
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
45 object or nil.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
46
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
47 If PROMPTER is a string, the prompt is \(format PROMPTER OBJECT\). If not
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
48 a string, PROMPTER is a function of one arg (an object from LIST), which
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
49 returns a string to be used as the prompt for that object. If the return
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
50 value is not a string, it may be nil to ignore the object or non-nil to act
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
51 on the object without asking the user.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
52
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
53 ACTOR is a function of one arg (an object from LIST),
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
54 which gets called with each object that the user answers `yes' for.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
55
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
56 If HELP is given, it is a list (OBJECT OBJECTS ACTION),
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
57 where OBJECT is a string giving the singular noun for an elt of LIST;
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
58 OBJECTS is the plural noun for elts of LIST, and ACTION is a transitive
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
59 verb describing ACTOR. The default is \(\"object\" \"objects\" \"act on\"\).
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
60
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
61 At the prompts, the user may enter y, Y, or SPC to act on that object;
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
62 n, N, or DEL to skip that object; ! to act on all following objects;
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
63 ESC or q to exit (skip all following objects); . (period) to act on the
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
64 current object and then exit; or \\[help-command] to get help.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
65
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
66 If ACTION-ALIST is given, it is an alist (KEY FUNCTION HELP) of extra keys
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
67 that will be accepted. KEY is a character; FUNCTION is a function of one
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
68 arg (an object from LIST); HELP is a string. When the user hits KEY,
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
69 FUNCTION is called. If it returns non-nil, the object is considered
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
70 \"acted upon\", and the next object from LIST is processed. If it returns
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
71 nil, the prompt is repeated for the same object.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
72
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
73 Final optional argument NO-CURSOR-IN-ECHO-AREA non-nil says not to set
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
74 `cursor-in-echo-area' while prompting.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
75
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
76 This function uses `query-replace-map' to define the standard responses,
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
77 but not all of the responses which `query-replace' understands
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
78 are meaningful here.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
79
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
80 Returns the number of actions taken."
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
81 (let* ((actions 0)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
82 user-keys mouse-event map prompt char elt tail def
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
83 ;; Non-nil means we should use mouse menus to ask.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
84 use-menus
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
85 delayed-switch-frame
95806
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
86 ;; Rebind other-window-scroll-buffer so that subfunctions can set
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
87 ;; it temporarily, without risking affecting the caller.
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
88 (other-window-scroll-buffer other-window-scroll-buffer)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
89 (next (if (functionp list)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
90 (lambda () (setq elt (funcall list)))
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
91 (lambda () (when list
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
92 (setq elt (pop list))
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
93 t)))))
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
94 (if (and (listp last-nonmenu-event)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
95 use-dialog-box)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
96 ;; Make a list describing a dialog box.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
97 (let ((object (if help (capitalize (nth 0 help))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
98 (objects (if help (capitalize (nth 1 help))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
99 (action (if help (capitalize (nth 2 help)))))
64829
9c1dcec0d1fb (map-y-or-n-p): Reorder the options
Richard M. Stallman <rms@gnu.org>
parents: 64751
diff changeset
100 (setq map `(("Yes" . act) ("No" . skip)
9c1dcec0d1fb (map-y-or-n-p): Reorder the options
Richard M. Stallman <rms@gnu.org>
parents: 64751
diff changeset
101 ,@(mapcar (lambda (elt)
9c1dcec0d1fb (map-y-or-n-p): Reorder the options
Richard M. Stallman <rms@gnu.org>
parents: 64751
diff changeset
102 (cons (with-syntax-table
9c1dcec0d1fb (map-y-or-n-p): Reorder the options
Richard M. Stallman <rms@gnu.org>
parents: 64751
diff changeset
103 text-mode-syntax-table
9c1dcec0d1fb (map-y-or-n-p): Reorder the options
Richard M. Stallman <rms@gnu.org>
parents: 64751
diff changeset
104 (capitalize (nth 2 elt)))
9c1dcec0d1fb (map-y-or-n-p): Reorder the options
Richard M. Stallman <rms@gnu.org>
parents: 64751
diff changeset
105 (vector (nth 1 elt))))
9c1dcec0d1fb (map-y-or-n-p): Reorder the options
Richard M. Stallman <rms@gnu.org>
parents: 64751
diff changeset
106 action-alist)
9c1dcec0d1fb (map-y-or-n-p): Reorder the options
Richard M. Stallman <rms@gnu.org>
parents: 64751
diff changeset
107 (,(if help (concat action " This But No More")
9c1dcec0d1fb (map-y-or-n-p): Reorder the options
Richard M. Stallman <rms@gnu.org>
parents: 64751
diff changeset
108 "Do This But No More") . act-and-exit)
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
109 (,(if help (concat action " All " objects)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
110 "Do All") . automatic)
64829
9c1dcec0d1fb (map-y-or-n-p): Reorder the options
Richard M. Stallman <rms@gnu.org>
parents: 64751
diff changeset
111 ("No For All" . exit))
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
112 use-menus t
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
113 mouse-event last-nonmenu-event))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
114 (setq user-keys (if action-alist
95857
5d1e0dab59fb (map-y-or-n-p): Accept non-char events.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 95841
diff changeset
115 (concat (mapconcat (lambda (elt)
5d1e0dab59fb (map-y-or-n-p): Accept non-char events.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 95841
diff changeset
116 (key-description
5d1e0dab59fb (map-y-or-n-p): Accept non-char events.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 95841
diff changeset
117 (vector (car elt))))
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
118 action-alist ", ")
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
119 " ")
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
120 "")
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
121 ;; Make a map that defines each user key as a vector containing
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
122 ;; its definition.
95806
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
123 map
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
124 (let ((map (make-sparse-keymap)))
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
125 (set-keymap-parent map query-replace-map)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
126 (define-key map [?\C-\M-v] 'scroll-other-window)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
127 (define-key map [M-next] 'scroll-other-window)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
128 (define-key map [?\C-\M-\S-v] 'scroll-other-window-down)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
129 (define-key map [M-prior] 'scroll-other-window-down)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
130 ;; The above are rather inconvenient, so maybe we should
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
131 ;; provide the non-other keys for the other-scroll as well.
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
132 ;; (define-key map [?\C-v] 'scroll-other-window)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
133 ;; (define-key map [next] 'scroll-other-window)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
134 ;; (define-key map [?\M-v] 'scroll-other-window-down)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
135 ;; (define-key map [prior] 'scroll-other-window-down)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
136 (dolist (elt action-alist)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
137 (define-key map (vector (car elt)) (vector (nth 1 elt))))
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
138 map)))
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
139 (unwind-protect
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
140 (progn
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
141 (if (stringp prompter)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
142 (setq prompter `(lambda (object)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
143 (format ,prompter object))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
144 (while (funcall next)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
145 (setq prompt (funcall prompter elt))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
146 (cond ((stringp prompt)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
147 ;; Prompt the user about this object.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
148 (setq quit-flag nil)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
149 (if use-menus
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
150 (setq def (or (x-popup-dialog (or mouse-event use-menus)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
151 (cons prompt map))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
152 'quit))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
153 ;; Prompt in the echo area.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
154 (let ((cursor-in-echo-area (not no-cursor-in-echo-area))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
155 (message-log-max nil))
76146
77405acb8332 (map-y-or-n-p): Apply minibuffer-prompt-properties.
Kim F. Storm <storm@cua.dk>
parents: 75346
diff changeset
156 (message (apply 'propertize "%s(y, n, !, ., q, %sor %s) "
77405acb8332 (map-y-or-n-p): Apply minibuffer-prompt-properties.
Kim F. Storm <storm@cua.dk>
parents: 75346
diff changeset
157 minibuffer-prompt-properties)
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
158 prompt user-keys
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
159 (key-description (vector help-char)))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
160 (if minibuffer-auto-raise
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
161 (raise-frame (window-frame (minibuffer-window))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
162 (while (progn
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
163 (setq char (read-event))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
164 ;; If we get -1, from end of keyboard
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
165 ;; macro, try again.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
166 (equal char -1)))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
167 ;; Show the answer to the question.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
168 (message "%s(y, n, !, ., q, %sor %s) %s"
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
169 prompt user-keys
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
170 (key-description (vector help-char))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
171 (single-key-description char)))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
172 (setq def (lookup-key map (vector char))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
173 (cond ((eq def 'exit)
95806
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
174 (setq next (lambda () nil)))
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
175 ((eq def 'act)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
176 ;; Act on the object.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
177 (funcall actor elt)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
178 (setq actions (1+ actions)))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
179 ((eq def 'skip)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
180 ;; Skip the object.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
181 )
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
182 ((eq def 'act-and-exit)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
183 ;; Act on the object and then exit.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
184 (funcall actor elt)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
185 (setq actions (1+ actions)
95806
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
186 next (lambda () nil)))
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
187 ((eq def 'quit)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
188 (setq quit-flag t)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
189 (setq next `(lambda ()
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
190 (setq next ',next)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
191 ',elt)))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
192 ((eq def 'automatic)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
193 ;; Act on this and all following objects.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
194 (if (funcall prompter elt)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
195 (progn
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
196 (funcall actor elt)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
197 (setq actions (1+ actions))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
198 (while (funcall next)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
199 (if (funcall prompter elt)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
200 (progn
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
201 (funcall actor elt)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
202 (setq actions (1+ actions))))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
203 ((eq def 'help)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
204 (with-output-to-temp-buffer "*Help*"
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
205 (princ
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
206 (let ((object (if help (nth 0 help) "object"))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
207 (objects (if help (nth 1 help) "objects"))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
208 (action (if help (nth 2 help) "act on")))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
209 (concat
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
210 (format "Type SPC or `y' to %s the current %s;
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
211 DEL or `n' to skip the current %s;
61447
ff2428b81ec5 (map-y-or-n-p): Clarify RET/q in help message.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
212 RET or `q' to give up on the %s (skip all remaining %s);
ff2428b81ec5 (map-y-or-n-p): Clarify RET/q in help message.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
213 C-g to quit (cancel the whole command);
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
214 ! to %s all remaining %s;\n"
61447
ff2428b81ec5 (map-y-or-n-p): Clarify RET/q in help message.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
215 action object object action objects action
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
216 objects)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
217 (mapconcat (function
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
218 (lambda (elt)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
219 (format "%s to %s"
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
220 (single-key-description
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
221 (nth 0 elt))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
222 (nth 2 elt))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
223 action-alist
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
224 ";\n")
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
225 (if action-alist ";\n")
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
226 (format "or . (period) to %s \
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
227 the current %s and exit."
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
228 action object))))
95806
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
229 (with-current-buffer standard-output
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
230 (help-mode)))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
231
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
232 (setq next `(lambda ()
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
233 (setq next ',next)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
234 ',elt)))
95806
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
235 ((and (symbolp def) (commandp def))
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
236 (call-interactively def)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
237 ;; Regurgitated; try again.
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
238 (setq next `(lambda ()
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
239 (setq next ',next)
2e2ae1dd33cc * emacs-lisp/map-ynp.el (map-y-or-n-p): Add support for other-window-scroll.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94655
diff changeset
240 ',elt)))
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
241 ((vectorp def)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
242 ;; A user-defined key.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
243 (if (funcall (aref def 0) elt) ;Call its function.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
244 ;; The function has eaten this object.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
245 (setq actions (1+ actions))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
246 ;; Regurgitated; try again.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
247 (setq next `(lambda ()
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
248 (setq next ',next)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
249 ',elt))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
250 ((and (consp char)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
251 (eq (car char) 'switch-frame))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
252 ;; switch-frame event. Put it off until we're done.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
253 (setq delayed-switch-frame char)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
254 (setq next `(lambda ()
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
255 (setq next ',next)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
256 ',elt)))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
257 (t
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
258 ;; Random char.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
259 (message "Type %s for help."
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
260 (key-description (vector help-char)))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
261 (beep)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
262 (sit-for 1)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
263 (setq next `(lambda ()
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
264 (setq next ',next)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
265 ',elt)))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
266 (prompt
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
267 (funcall actor elt)
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
268 (setq actions (1+ actions))))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
269 (if delayed-switch-frame
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
270 (setq unread-command-events
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
271 (cons delayed-switch-frame unread-command-events))))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
272 ;; Clear the last prompt from the minibuffer.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
273 (let ((message-log-max nil))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
274 (message ""))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
275 ;; Return the number of actions that were taken.
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
276 actions))
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
277
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 79704
diff changeset
278 ;; arch-tag: 1d0a3201-a151-4c10-b231-4da47c9e6dc3
51349
dd8d7c8c6ae8 Moved from lisp/.
Juanma Barranquero <lekktu@gmail.com>
parents:
diff changeset
279 ;;; map-ynp.el ends here