1 ;;; gnus-ems.el --- functions for making Gnus work under different Emacsen
2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
33 ;;; Function aliases later to be redefined for XEmacs usage.
35 (defvar gnus-mouse-2 [mouse-2])
36 (defvar gnus-down-mouse-3 [down-mouse-3])
37 (defvar gnus-down-mouse-2 [down-mouse-2])
38 (defvar gnus-widget-button-keymap nil)
39 (defvar gnus-mode-line-modified
40 (if (featurep 'xemacs)
45 (autoload 'gnus-xmas-define "gnus-xmas")
46 (autoload 'gnus-xmas-redefine "gnus-xmas")
47 (autoload 'gnus-get-buffer-create "gnus")
48 (autoload 'nnheader-find-etc-directory "nnheader"))
50 (autoload 'smiley-region "smiley")
52 (defun gnus-kill-all-overlays ()
53 "Delete all overlays in the current buffer."
54 (let* ((overlayss (overlay-lists))
55 (buffer-read-only nil)
56 (overlays (delq nil (nconc (car overlayss) (cdr overlayss)))))
58 (delete-overlay (pop overlays)))))
62 (defun gnus-mule-max-width-function (el max-width)
63 `(let* ((val (eval (, el)))
64 (valstr (if (numberp val)
65 (int-to-string val) val)))
66 (if (> (length valstr) ,max-width)
67 (truncate-string-to-width valstr ,max-width)
71 (if (featurep 'xemacs)
73 (defvar gnus-mouse-face-prop 'mouse-face
74 "Property used for highlighting mouse regions.")))
77 (defvar gnus-tmp-unread)
78 (defvar gnus-tmp-replied)
79 (defvar gnus-tmp-score-char)
80 (defvar gnus-tmp-indentation)
81 (defvar gnus-tmp-opening-bracket)
82 (defvar gnus-tmp-lines)
83 (defvar gnus-tmp-name)
84 (defvar gnus-tmp-closing-bracket)
85 (defvar gnus-tmp-subject-or-nil)
86 (defvar gnus-check-before-posting)
87 (defvar gnus-mouse-face)
88 (defvar gnus-group-buffer))
90 (defun gnus-ems-redefine ()
96 ;; Mule and new Emacs definitions
98 ;; [Note] Now there are three kinds of mule implementations,
99 ;; original MULE, XEmacs/mule and Emacs 20+ including
100 ;; MULE features. Unfortunately these APIs are different. In
101 ;; particular, Emacs (including original Mule) and XEmacs are
102 ;; quite different. However, this version of Gnus doesn't support
103 ;; anything other than XEmacs 20+ and Emacs 20.3+.
105 ;; Predicates to check are following:
106 ;; (boundp 'MULE) is t only if Mule (original; anything older than
107 ;; Mule 2.3) is running.
108 ;; (featurep 'mule) is t when other mule variants are running.
110 ;; It is possible to detect XEmacs/mule by (featurep 'mule) and
111 ;; (featurep 'xemacs). In this case, the implementation for
112 ;; XEmacs/mule may be shareable between XEmacs and XEmacs/mule.
114 (defvar gnus-summary-display-table nil
115 "Display table used in summary mode buffers.")
116 (defalias 'gnus-max-width-function 'gnus-mule-max-width-function)
118 (when (boundp 'gnus-check-before-posting)
119 (setq gnus-check-before-posting
121 (delq 'control-chars gnus-check-before-posting))))