This commit was generated by cvs2svn to compensate for changes in r26, which
[elisp/tm.git] / tm-gnus.el
1 ;;;
2 ;;; $Id: tm-gnus.el,v 3.0 1994/08/28 16:22:16 morioka Exp $
3 ;;;
4 ;;;   A MIME extension for GNUS
5 ;;;
6 ;;; by Morioka Tomohiko, 1993/11/20
7
8 (provide 'tm-gnus)
9
10 (require 'tm-misc)
11 (require 'gnus)
12
13
14 ;;; @ variables
15 ;;;
16 (defvar tm-gnus/startup-hook nil)
17
18
19 ;;; @ to decode subject in mode-line
20 ;;;
21 ;; This function imported from gnus.el.
22 ;;
23 ;; New implementation in gnus 3.14.3
24 ;;
25 (defun tm-gnus/article-set-mode-line ()
26   "Set Article mode line string.
27 If you don't like it, define your own gnus-article-set-mode-line."
28   (let ((maxlen 15)                     ;Maximum subject length
29         (subject
30          (if gnus-current-headers
31              (mime/decode-string (nntp-header-subject gnus-current-headers))
32            "")
33          ))
34     ;; The value must be a string to escape %-constructs because of subject.
35     (setq mode-line-buffer-identification
36           (format "GNUS: %s%s %s%s%s"
37                   gnus-newsgroup-name
38                   (if gnus-current-article
39                       (format "/%d" gnus-current-article) "")
40                   (rightful-boundary-short-string subject
41                                                   (min (string-width subject)
42                                                        maxlen))
43                   (if (> (string-width subject) maxlen) "..." "")
44                   (make-string (max 0 (- 17 (string-width subject))) ? )
45                   )))
46   (set-buffer-modified-p t))
47
48
49 ;;; @ change MIME header decoding mode, decoding or non decoding.
50 ;;;
51
52 (defun tm-gnus/set-mime-header-decoding-mode (arg)
53   "Set MIME header processing.
54 With arg, turn MIME processing on iff arg is positive."
55   (setq mime/header-decoding-mode arg)
56   (setq gnus-have-all-headers (not gnus-have-all-headers))
57   (gnus-summary-select-article (not gnus-have-all-headers) t)
58   )
59
60 (defun tm-gnus/toggle-mime-header-decoding-mode ()
61   "Toggle MIME header processing.
62 With arg, turn MIME processing on iff arg is positive."
63   (interactive)
64   (tm-gnus/set-mime-header-decoding-mode (not mime/header-decoding-mode))
65   )
66
67 ;;; @ set up
68 ;;;
69 (if (string-match "^GNUS [0-3]" gnus-version)
70     (require 'tm-gnus3)
71   (require 'tm-gnus4)
72   )
73     
74 (run-hooks 'tm-gnus/startup-hook)