This commit was generated by cvs2svn to compensate for changes in r6105,
[elisp/gnus.git-] / lisp / nnheaderxm.el
1 ;;; nnheaderxm.el --- making Gnus backends work under XEmacs
2 ;; Copyright (C) 1996,97,98 Free Software Foundation, Inc.
3
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; Keywords: news
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 ;;; Commentary:
25
26 ;;; Code:
27
28 (defun nnheader-xmas-run-at-time (time repeat function &rest args)
29   (start-itimer
30    "nnheader-run-at-time"
31    `(lambda ()
32       (,function ,@args))
33    time repeat))
34
35 (defun nnheader-xmas-Y-or-n-p (prompt)
36   "Ask user a \"Y/n\" question. Return t if answer is neither \"n\", \"N\" nor \"C-g\"."
37   (if (should-use-dialog-box-p)
38       (yes-or-no-p-dialog-box prompt)
39     (let ((cursor-in-echo-area t)
40           (echo-keystrokes 0)
41           (inhibit-quit t)
42           event)
43       (message "%s(Y/n) " prompt)
44       (while (or (not (key-press-event-p (setq event (next-command-event))))
45                  (not (or (eq (event-key event) 'escape)
46                           (memq (event-to-character event)
47                                 '(?\  ?N ?Y ?\C-g ?\e ?\n ?\r ?n ?y))))))
48       (if (memq (event-key event) '(?\C-g ?N ?n))
49           (progn
50             (message "%s(Y/n) No" prompt)
51             nil)
52         (message "%s(Y/n) Yes" prompt)
53         t))))
54
55 (fset 'nnheader-run-at-time 'nnheader-xmas-run-at-time)
56 (fset 'nnheader-cancel-timer 'delete-itimer)
57 (fset 'nnheader-cancel-function-timers 'ignore)
58 (fset 'nnheader-Y-or-n-p 'nnheader-xmas-Y-or-n-p)
59
60 (provide 'nnheaderxm)
61
62 ;;; nnheaderxm.el ends here.