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