Synch to No Gnus 200507290604.
[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, 2003
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., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
26
27 ;;; Commentary:
28
29 ;;; Code:
30
31 (require 'timer-funcs)
32
33 (defalias 'nnheader-cancel-timer 'delete-itimer)
34 (defalias 'nnheader-string-as-multibyte 'identity)
35
36 (defun nnheader-xmas-Y-or-n-p (prompt)
37   "Ask user a \"Y/n\" question. Return t if answer is neither \"n\", \"N\" nor \"C-g\"."
38   (if (should-use-dialog-box-p)
39       (yes-or-no-p-dialog-box prompt)
40     (let ((cursor-in-echo-area t)
41           (echo-keystrokes 0)
42           (inhibit-quit t)
43           event)
44       (message "%s(Y/n) " prompt)
45       (while (or (not (key-press-event-p (setq event (next-command-event))))
46                  (not (or (eq (event-key event) 'escape)
47                           (memq (event-to-character event)
48                                 '(?\  ?N ?Y ?\C-g ?\e ?\n ?\r ?n ?y))))))
49       (if (memq (event-key event) '(?\C-g ?N ?n))
50           (progn
51             (message "%s(Y/n) No" prompt)
52             nil)
53         (message "%s(Y/n) Yes" prompt)
54         t))))
55
56 (defalias 'nnheader-Y-or-n-p 'nnheader-xmas-Y-or-n-p)
57
58 (provide 'nnheaderxm)
59
60 ;;; nnheaderxm.el ends here