X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fmap-ynp.el;h=80b0f8459234eeebe3cab72f7c5ac6edf10480cc;hb=515ed47192a2fc212474dc246a875771890e0cbe;hp=64d3e5857e94b1c9ae9d3cf6c9ee84851e74bed4;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910;p=chise%2Fxemacs-chise.git.1 diff --git a/lisp/map-ynp.el b/lisp/map-ynp.el index 64d3e58..80b0f84 100644 --- a/lisp/map-ynp.el +++ b/lisp/map-ynp.el @@ -90,22 +90,21 @@ Returns the number of actions taken." (compiled-function-p list) (and (consp list) (eq (car list) 'lambda))) - (function (lambda () - (setq elt (funcall list)))) - (function (lambda () - (if list - (progn - (setq elt (car list) - list (cdr list)) - t) - nil)))))) + #'(lambda () (setq elt (funcall list))) + #'(lambda () + (if list + (progn + (setq elt (car list) + list (cdr list)) + t) + nil))))) (if (should-use-dialog-box-p) ;; Make a list describing a dialog box. (let (;; (object (capitalize (or (nth 0 help) "object"))) ;; (objects (capitalize (or (nth 1 help) "objects"))) ;; (action (capitalize (or (nth 2 help) "act on"))) ) - (setq map `(("Yes" . act) ("No" . skip) + (setq map `(("%_Yes" . act) ("%_No" . skip) ; bogus crap. --ben ; ((, (if help ; (capitalize @@ -120,22 +119,21 @@ Returns the number of actions taken." ; ((, (capitalize ; (or (and help (nth 5 help)) "Quit"))) ; . exit) - ("Yes All" . automatic) - ("No All" . exit) - ("Cancel" . quit) - ,@(mapcar (lambda (elt) - (cons (capitalize (nth 2 elt)) - (vector (nth 1 elt)))) + ("Yes %_All" . automatic) + ("No A%_ll" . exit) + ("%_Cancel" . quit) + ,@(mapcar #'(lambda (elt) + (cons (capitalize (nth 2 elt)) + (vector (nth 1 elt)))) action-alist)) mouse-event last-command-event)) (setq user-keys (if action-alist - (concat (mapconcat (function - (lambda (elt) - (key-description - (if (characterp (car elt)) - ;; XEmacs - (char-to-string (car elt)) - (car elt))))) + (concat (mapconcat #'(lambda (elt) + (key-description + (if (characterp (car elt)) + ;; XEmacs + (char-to-string (car elt)) + (car elt)))) action-alist ", ") " ") "") @@ -156,8 +154,8 @@ Returns the number of actions taken." (unwind-protect (progn (if (stringp prompter) - (setq prompter (` (lambda (object) - (format (, prompter) object))))) + (setq prompter `(lambda (object) + (format ,prompter object)))) (while (funcall next) (setq prompt (funcall prompter elt)) (cond ((stringp prompt) @@ -186,7 +184,7 @@ Returns the number of actions taken." (single-key-description char)))) (setq def (lookup-key map (vector char)))) (cond ((eq def 'exit) - (setq next (function (lambda () nil)))) + (setq next #'(lambda () nil))) ((eq def 'act) ;; Act on the object. (funcall actor elt) @@ -201,9 +199,9 @@ Returns the number of actions taken." next (function (lambda () nil)))) ((or (eq def 'quit) (eq def 'exit-prefix)) (setq quit-flag t) - (setq next (` (lambda () - (setq next '(, next)) - '(, elt))))) + (setq next `(lambda () + (setq next ',next) + ',elt))) ((eq def 'automatic) ;; Act on this and all following objects. ;; (if (funcall prompter elt) ; Emacs @@ -233,7 +231,8 @@ ESC or `q' to exit;\n" (lambda (elt) (format "%c to %s" (nth 0 elt) - (nth 2 elt)))) + (normalize-menu-item-name + (nth 2 elt))))) action-alist ";\n") (if action-alist ";\n") @@ -244,34 +243,34 @@ the current %s and exit." (set-buffer standard-output) (help-mode))) - (setq next (` (lambda () - (setq next '(, next)) - '(, elt))))) + (setq next `(lambda () + (setq next ',next) + ',elt))) ((vectorp def) ;; A user-defined key. (if (funcall (aref def 0) elt) ;Call its function. ;; The function has eaten this object. (setq actions (1+ actions)) ;; Regurgitated; try again. - (setq next (` (lambda () - (setq next '(, next)) - '(, elt)))))) + (setq next `(lambda () + (setq next ',next) + ',elt)))) ;((and (consp char) ; Emacs ; (eq (car char) 'switch-frame)) ; ;; switch-frame event. Put it off until we're done. ; (setq delayed-switch-frame char) - ; (setq next (` (lambda () - ; (setq next '(, next)) - ; '(, elt))))) + ; (setq next `(lambda () + ; (setq next ',next) + ; ',elt))) (t ;; Random char. (message "Type %s for help." (key-description (vector help-char))) (beep) (sit-for 1) - (setq next (` (lambda () - (setq next '(, next)) - '(, elt))))))) + (setq next `(lambda () + (setq next ',next) + ',elt))))) ((eval prompt) (progn (funcall actor elt)