Mercurial > emacs
comparison lisp/map-ynp.el @ 2442:f692546797f9
(map-y-or-n-p): Make bindings of user-defined keys be each a vector
containing the user's binding, rather than 'user. Check (vectorp DEF)
and call the vector's elt, rather than checking (eq 'user DEF) and
calling something completely random.
author | Roland McGrath <roland@gnu.org> |
---|---|
date | Wed, 31 Mar 1993 22:20:33 +0000 |
parents | 4b05402f3ac5 |
children | b88e105bdbf7 |
comparison
equal
deleted
inserted
replaced
2441:78098404b263 | 2442:f692546797f9 |
---|---|
78 (key-description | 78 (key-description |
79 (char-to-string (car elt))))) | 79 (char-to-string (car elt))))) |
80 action-alist ", ") | 80 action-alist ", ") |
81 " ") | 81 " ") |
82 "")) | 82 "")) |
83 ;; Make a map that defines all the user keys as `user'. | 83 ;; Make a map that defines each user key as a vector containing |
84 ;; its definition. | |
84 (map (cons 'keymap | 85 (map (cons 'keymap |
85 (append (mapcar (function | 86 (append (mapcar (lambda (elt) |
86 (lambda (elt) | 87 (cons (car elt) (vector (nth 1 elt)))) |
87 (cons (car elt) 'user))) | |
88 action-alist) | 88 action-alist) |
89 query-replace-map))) | 89 query-replace-map))) |
90 (actions 0) | 90 (actions 0) |
91 prompt char elt tail def | 91 prompt char elt tail def |
92 (next (if (or (symbolp list) | 92 (next (if (or (symbolp list) |
173 action object))))) | 173 action object))))) |
174 | 174 |
175 (setq next (` (lambda () | 175 (setq next (` (lambda () |
176 (setq next '(, next)) | 176 (setq next '(, next)) |
177 '(, elt))))) | 177 '(, elt))))) |
178 ((eq def 'user) | 178 ((vectorp def) |
179 ;; A user-defined key. | 179 ;; A user-defined key. |
180 (if (funcall (nth 1 tail) elt) ;Call its function. | 180 (if (funcall (aref def 0) elt) ;Call its function. |
181 ;; The function has eaten this object. | 181 ;; The function has eaten this object. |
182 (setq actions (1+ actions)) | 182 (setq actions (1+ actions)) |
183 ;; Regurgitated; try again. | 183 ;; Regurgitated; try again. |
184 (setq next (` (lambda () | 184 (setq next (` (lambda () |
185 (setq next '(, next)) | 185 (setq next '(, next)) |