From: yamaoka Date: Tue, 13 Oct 1998 08:45:52 +0000 (+0000) Subject: * lisp/nnheaderxm.el (nnheader-xmas-Y-or-n-p): New function. X-Git-Tag: pgnus-ichikawa-199811302358~166 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=8e478f3ea25791775cc3d184a0f74668163640c6;p=elisp%2Fgnus.git- * lisp/nnheaderxm.el (nnheader-xmas-Y-or-n-p): New function. It will be used for the substitute of `nnheader-Y-or-n-p' under XEmacs. * lisp/nnheader.el (nnheader-Y-or-n-p): Rewrite for Emacs 19 or later except for XEmacs. --- diff --git a/lisp/nnheader.el b/lisp/nnheader.el index 3122dd8..99ef061 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -809,17 +809,20 @@ find-file-hooks, etc. (defun nnheader-Y-or-n-p (prompt) "Ask user a \"Y/n\" question. Return t if answer is neither \"n\", \"N\" nor \"C-g\"." - (if (and (featurep 'xemacs) (should-use-dialog-box-p)) - (yes-or-no-p-dialog-box prompt) - (let ((cursor-in-echo-area t) - (echo-keystrokes 0) - (log-message-max-size 0) - (inhibit-quit t) - message-log-max ans) + (let ((cursor-in-echo-area t) + (echo-keystrokes 0) + (inhibit-quit t) + ans) + (let (message-log-max) (while (not (memq ans '(?\ ?N ?Y ?\C-g ?\e ?\n ?\r ?n ?y))) (message "%s(Y/n) " prompt) - (setq ans (read-char-exclusive))) - (not (memq ans '(?\C-g ?N ?n)))))) + (setq ans (read-char-exclusive)))) + (if (memq ans '(?\C-g ?N ?n)) + (progn + (message "%s(Y/n) No" prompt) + nil) + (message "%s(Y/n) Yes" prompt) + t))) (when (string-match "XEmacs\\|Lucid" emacs-version) (require 'nnheaderxm)) diff --git a/lisp/nnheaderxm.el b/lisp/nnheaderxm.el index f788042..7c1435c 100644 --- a/lisp/nnheaderxm.el +++ b/lisp/nnheaderxm.el @@ -32,9 +32,30 @@ (,function ,@args)) time repeat)) +(defun nnheader-xmas-Y-or-n-p (prompt) + "Ask user a \"Y/n\" question. Return t if answer is neither \"n\", \"N\" nor \"C-g\"." + (if (should-use-dialog-box-p) + (yes-or-no-p-dialog-box prompt) + (let ((cursor-in-echo-area t) + (echo-keystrokes 0) + (inhibit-quit t) + event) + (message "%s(Y/n) " prompt) + (while (or (not (key-press-event-p (setq event (next-command-event)))) + (not (or (eq (event-key event) 'escape) + (memq (event-to-character event) + '(?\ ?N ?Y ?\C-g ?\e ?\n ?\r ?n ?y)))))) + (if (memq (event-key event) '(?\C-g ?N ?n)) + (progn + (message "%s(Y/n) No" prompt) + nil) + (message "%s(Y/n) Yes" prompt) + t)))) + (fset 'nnheader-run-at-time 'nnheader-xmas-run-at-time) (fset 'nnheader-cancel-timer 'delete-itimer) (fset 'nnheader-cancel-function-timers 'ignore) +(fset 'nnheader-Y-or-n-p 'nnheader-xmas-Y-or-n-p) (provide 'nnheaderxm)