This commit was generated by cvs2svn to compensate for changes in r3784,
[elisp/gnus.git-] / lisp / nnheaderxm.el
index 0a5fc99..7c1435c 100644 (file)
@@ -1,7 +1,7 @@
 ;;; nnheaderxm.el --- making Gnus backends work under XEmacs
-;; Copyright (C) 1996,97 Free Software Foundation, Inc.
+;; Copyright (C) 1996,97,98 Free Software Foundation, Inc.
 
-;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
 
 ;; This file is part of GNU Emacs.
       (,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)