Importing Oort Gnus v0.01.
[elisp/gnus.git-] / lisp / gnus-xmas.el
index 6ecfd94..8b5f2d2 100644 (file)
@@ -1,7 +1,7 @@
 ;;; gnus-xmas.el --- Gnus functions for XEmacs
 
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
-;;      Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
+;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -44,6 +44,12 @@ automatically."
                 directory)
   :group 'gnus-xmas)
 
+(unless gnus-xmas-glyph-directory
+  (unless (setq gnus-xmas-glyph-directory
+               (message-xmas-find-glyph-directory "gnus"))
+    (error "Can't find glyph directory. \
+Possibly the `etc' directory has not been installed.")))
+
 ;;(format "%02x%02x%02x" 114 66 20) "724214"
 
 (defvar gnus-xmas-logo-color-alist
@@ -89,10 +95,6 @@ asynchronously.       The compressed face will be piped to this command."
 
 ;; Don't warn about these undefined variables.
 
-(defvar gnus-group-mode-hook)
-(defvar gnus-summary-mode-hook)
-(defvar gnus-article-mode-hook)
-
 ;;defined in gnus.el
 (defvar gnus-active-hashtb)
 (defvar gnus-article-buffer)
@@ -197,7 +199,7 @@ displayed, no centering will be performed."
        ;; whichever is the least.
        ;; NOFORCE parameter suggested by Daniel Pittman <daniel@danann.net>.
        (set-window-start
-        window (min bottom (save-excursion (forward-line (- top)) (point))) 
+        window (min bottom (save-excursion (forward-line (- top)) (point)))
         t))
       ;; Do horizontal recentering while we're at it.
       (when (and (get-buffer-window (current-buffer) t)
@@ -328,7 +330,8 @@ call it with the value of the `gnus-data' text property."
 
 (defun gnus-xmas-article-menu-add ()
   (gnus-xmas-menu-add article
-    gnus-article-article-menu gnus-article-treatment-menu))
+    gnus-article-article-menu gnus-article-treatment-menu
+    gnus-article-post-menu gnus-article-commands-menu))
 
 (defun gnus-xmas-score-menu-add ()
   (gnus-xmas-menu-add score
@@ -431,9 +434,6 @@ call it with the value of the `gnus-data' text property."
           (< emacs-minor-version 14))
       (defalias 'gnus-set-text-properties 'gnus-xmas-set-text-properties))
 
-  (when (fboundp 'turn-off-scroll-in-place)
-    (add-hook 'gnus-article-mode-hook 'turn-off-scroll-in-place))
-
   (unless (boundp 'standard-display-table)
     (setq standard-display-table nil))
 
@@ -478,30 +478,17 @@ call it with the value of the `gnus-data' text property."
   (defalias 'gnus-annotation-in-region-p 'gnus-xmas-annotation-in-region-p)
   (defalias 'gnus-mime-button-menu 'gnus-xmas-mime-button-menu)
 
-  (add-hook 'gnus-group-mode-hook 'gnus-xmas-group-menu-add)
-  (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
-  (add-hook 'gnus-article-mode-hook 'gnus-xmas-article-menu-add)
+  ;; These ones are not defcutom'ed, sometimes not even defvar'ed. They
+  ;; probably should. If that is done, the code below should then be moved
+  ;; where each variable is defined, in order not to mess with user settings.
+  ;; -- didier
   (add-hook 'gnus-score-mode-hook 'gnus-xmas-score-menu-add)
-
-  (add-hook 'gnus-pick-mode-hook 'gnus-xmas-pick-menu-add)
-  (add-hook 'gnus-topic-mode-hook 'gnus-xmas-topic-menu-add)
-  (add-hook 'gnus-tree-mode-hook 'gnus-xmas-tree-menu-add)
   (add-hook 'gnus-binary-mode-hook 'gnus-xmas-binary-menu-add)
   (add-hook 'gnus-grouplens-mode-hook 'gnus-xmas-grouplens-menu-add)
   (add-hook 'gnus-server-mode-hook 'gnus-xmas-server-menu-add)
   (add-hook 'gnus-browse-mode-hook 'gnus-xmas-browse-menu-add)
-
-  (add-hook 'gnus-group-mode-hook 'gnus-xmas-setup-group-toolbar)
-  (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
-
-  (add-hook 'gnus-agent-summary-mode-hook 'gnus-xmas-agent-summary-menu-add)
-  (add-hook 'gnus-agent-group-mode-hook 'gnus-xmas-agent-group-menu-add)
-  (add-hook 'gnus-agent-server-mode-hook 'gnus-xmas-agent-server-menu-add)
-
   (add-hook 'gnus-draft-mode-hook 'gnus-xmas-draft-menu-add)
-  (add-hook 'gnus-summary-mode-hook
-           'gnus-xmas-switch-horizontal-scrollbar-off)
-  (add-hook 'gnus-tree-mode-hook 'gnus-xmas-switch-horizontal-scrollbar-off))
+  (add-hook 'gnus-mailing-list-mode-hook 'gnus-xmas-mailing-list-menu-add))
 
 
 ;;; XEmacs logo and toolbar.
@@ -509,7 +496,6 @@ call it with the value of the `gnus-data' text property."
 (defun gnus-xmas-group-startup-message (&optional x y)
   "Insert startup message in current buffer."
   ;; Insert the message.
-  (setq gnus-xmas-glyph-directory (message-xmas-find-glyph-directory "gnus"))
   (erase-buffer)
   (cond
    ((and (console-on-window-system-p)
@@ -700,27 +686,32 @@ XEmacs compatibility workaround."
   "Face to show X face"
   :group 'gnus-xmas)
 
-(defun gnus-xmas-article-display-xface (beg end)
-  "Display any XFace headers in the current article."
+(defun gnus-xmas-article-display-xface (beg end &optional buffer)
+  "Display any XFace headers in BUFFER."
   (save-excursion
     (let ((xface-glyph
           (cond
            ((featurep 'xface)
             (make-glyph (vector 'xface :data
                                 (concat "X-Face: "
-                                        (buffer-substring beg end)))))
+                                        (if buffer
+                                            (with-current-buffer buffer
+                                              (buffer-substring beg end))
+                                          (buffer-substring beg end))))))
            ((featurep 'xpm)
-            (let ((cur (current-buffer)))
+            (let ((cur (or buffer (current-buffer))))
               (save-excursion
                 (gnus-set-work-buffer)
                 (insert-buffer-substring cur beg end)
-                (gnus-xmas-call-region "uncompface")
-                (goto-char (point-min))
-                (insert "/* Width=48, Height=48 */\n")
-                (gnus-xmas-call-region "icontopbm")
-                (gnus-xmas-call-region "ppmtoxpm")
-                (make-glyph
-                 (vector 'xpm :data (buffer-string))))))
+                (let ((coding-system-for-read 'binary)
+                      (coding-system-for-write 'binary))
+                  (gnus-xmas-call-region "uncompface")
+                  (goto-char (point-min))
+                  (insert "/* Width=48, Height=48 */\n")
+                  (gnus-xmas-call-region "icontopbm")
+                  (gnus-xmas-call-region "ppmtoxpm")
+                  (make-glyph
+                   (vector 'xpm :data (buffer-string)))))))
            (t
             (make-glyph [nothing]))))
          (ext (make-extent (progn
@@ -742,7 +733,6 @@ XEmacs compatibility workaround."
 
 (defvar gnus-xmas-modeline-glyph
   (progn
-    (setq gnus-xmas-glyph-directory (message-xmas-find-glyph-directory "gnus"))
     (let* ((file-xpm (expand-file-name "gnus-pointer.xpm"
                                       gnus-xmas-glyph-directory))
           (file-xbm (expand-file-name "gnus-pointer.xbm"
@@ -872,8 +862,6 @@ XEmacs compatibility workaround."
   (gnus-xmas-menu-add mailing-list
                      gnus-mailing-list-menu))
 
-(add-hook 'gnus-mailing-list-mode-hook 'gnus-xmas-mailing-list-menu-add)
-
 (provide 'gnus-xmas)
 
 ;;; gnus-xmas.el ends here