*** empty log message ***
[gnus] / lisp / gnus-ems.el
1 ;;; gnus-ems.el --- functions for making Gnus work under different Emacsen
2 ;; Copyright (C) 1995 Free Software Foundation, Inc.
3
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
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
21 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 ;;; Commentary:
24
25 ;;; Code:
26
27 (defvar gnus-mouse-2 [mouse-2])
28 (defvar gnus-easymenu 'easymenu)
29
30 ;; We do not byte-compile this file, because error messages are such a
31 ;; bore.  
32
33 (eval
34  '(cond 
35    ((string-match "XEmacs\\|Lucid" emacs-version)
36     ;; XEmacs definitions.
37
38     (setq gnus-mouse-2 [button2])
39     (setq gnus-easymenu 'auc-menu)
40
41     (or (memq 'underline (list-faces))
42         (funcall (intern "make-face") 'underline))
43     (or (face-differs-from-default-p 'underline)
44         (set-face-underline-p 'underline t))
45     (or (fboundp 'set-text-properties)
46         (defun set-text-properties (start end props &optional buffer)
47           (if props
48               (put-text-property start end (car props) (cadr props) buffer)
49             (remove-text-properties start end ()))))
50     
51     (or (fboundp 'make-overlay) (fset 'make-overlay 'make-extent))
52     (or (fboundp 'overlay-put) (fset 'overlay-put 'set-extent-property))
53     (or (fboundp 'move-overlay) 
54         (defun move-overlay (extent start end &optional buffer)
55           (set-extent-endpoints extent start end)))
56     (or (boundp 'standard-display-table) (setq standard-display-table nil))
57
58     (if (not gnus-visual)
59         ()
60       (setq gnus-group-mode-hook
61             (cons
62              (lambda ()
63                (easy-menu-add gnus-group-reading-menu)
64                (easy-menu-add gnus-group-group-menu)
65                (easy-menu-add gnus-group-post-menu)
66                (easy-menu-add gnus-group-misc-menu)
67                (gnus-install-mouse-tracker)) 
68              gnus-group-mode-hook))
69       (setq gnus-summary-mode-hook
70             (cons
71              (lambda ()
72                (easy-menu-add gnus-summary-mark-menu)
73                (easy-menu-add gnus-summary-move-menu)
74                (easy-menu-add gnus-summary-article-menu)
75                (easy-menu-add gnus-summary-thread-menu)
76                (easy-menu-add gnus-summary-misc-menu)
77                (easy-menu-add gnus-summary-post-menu)
78                (easy-menu-add gnus-summary-kill-menu)
79                (gnus-install-mouse-tracker)) 
80              gnus-summary-mode-hook))
81       (setq gnus-article-mode-hook
82             (cons
83              (lambda ()
84                (easy-menu-add gnus-article-article-menu)
85                (easy-menu-add gnus-article-treatment-menu))
86              gnus-article-mode-hook)))
87
88     (defun gnus-install-mouse-tracker ()
89       (require 'mode-motion)
90       (setq mode-motion-hook 'mode-motion-highlight-line)))
91
92    ((and (not (string-match "28.9" emacs-version)) 
93          (not (string-match "29" emacs-version)))
94     (setq gnus-hidden-properties '(invisible t)))
95    
96    ))
97
98 (eval-and-compile
99   (cond
100    ((not window-system)
101     (defun gnus-dummy-func (&rest args))
102     (let ((funcs '(mouse-set-point set-face-foreground
103                                    set-face-background x-popup-menu)))
104       (while funcs
105         (or (fboundp (car funcs))
106             (fset (car funcs) 'gnus-dummy-func))
107         (setq funcs (cdr funcs))))))
108   (or (fboundp 'file-regular-p)
109       (defun file-regular-p (file)
110         (and (not (file-directory-p file))
111              (not (file-symlink-p file))
112              (file-exists-p file))))
113   (or (fboundp 'face-list)
114       (defun face-list (&rest args)))
115   )
116
117 (defun gnus-ems-redefine ()
118   (cond 
119    ((string-match "XEmacs\\|Lucid" emacs-version)
120     ;; XEmacs definitions.
121     (fset 'gnus-set-mouse-face (lambda (string) string))
122
123     (defun gnus-summary-make-display-table ()
124       (let* ((table (window-display-table)))
125         (and (not table)
126              (setq table (make-vector 261 ())))
127         (let ((i 32))
128           (while (>= (setq i (1- i)) 0)
129             (aset table i [??])))
130         (aset table ?\n nil)
131         (let ((i 160))
132           (while (>= (setq i (1- i)) 127)
133             (aset table i [??])))
134         (setq gnus-summary-display-table table)))
135
136     )
137
138    ))
139
140 (provide 'gnus-ems)
141
142 ;; Local Variables:
143 ;; byte-compile-warnings: nil
144 ;; End:
145
146 ;;; gnus-ems.el ends here