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