2 ;;; tm-ognus.el --- tm-gnus module for GNUS 3.* and 4.*
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; $Id: tm-ognus.el,v 7.1 1995/10/17 16:56:12 morioka Exp $
10 ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word
12 ;;; This file is part of tm (Tools for MIME).
18 (autoload 'mime/decode-message-header
19 "tm-ew-d" "Decode MIME encoded-words in message header." t)
20 (autoload 'mime-eword/decode-string
21 "tm-ew-d" "Decode MIME encoded-words in string." t)
24 (defvar tm-gnus/decoding-mode t "*Decode MIME header if non-nil.")
26 (defun tm-gnus/add-decoding-mode-to-mode-line ()
27 (or (assq 'tm-gnus/decoding-mode minor-mode-alist)
28 (setq minor-mode-alist
29 (cons (list 'tm-gnus/decoding-mode " MIME")
34 ;;; @ change MIME encoded-word decoding mode, decoding or non decoding.
37 (defun tm-gnus/set-decoding-mode (arg)
38 "Set MIME encoded-word processing.
39 With arg, turn MIME encoded-word processing on iff arg is positive."
40 (setq tm-gnus/decoding-mode arg)
41 (setq gnus-have-all-headers (not gnus-have-all-headers))
42 (gnus-summary-select-article (not gnus-have-all-headers) t)
45 (defun tm-gnus/toggle-decoding-mode ()
46 "Toggle MIME encoded-word processing.
47 With arg, turn MIME encoded-word processing on iff arg is positive."
49 (tm-gnus/set-decoding-mode (not tm-gnus/decoding-mode))
53 ;;; @ to decode subjects in mode-line
55 ;; This function imported from gnus.el.
57 ;; New implementation in gnus 3.14.3
60 (defun tm-gnus/article-set-mode-line ()
61 "Set Article mode line string.
62 If you don't like it, define your own gnus-article-set-mode-line."
63 (let ((maxlen 15) ;Maximum subject length
65 (if gnus-current-headers
66 (mime-eword/decode-string
67 (nntp-header-subject gnus-current-headers))
70 ;; The value must be a string to escape %-constructs because of subject.
71 (setq mode-line-buffer-identification
72 (format "GNUS: %s%s %s%s%s"
74 (if gnus-current-article
75 (format "/%d" gnus-current-article) "")
76 (rightful-boundary-short-string subject
77 (min (string-width subject)
79 (if (> (string-width subject) maxlen) "..." "")
80 (make-string (max 0 (- 17 (string-width subject))) ? )
82 (set-buffer-modified-p t))
85 ;;; @ to decode subjects in Summary buffer
88 (defun tm-gnus/decode-summary-subjects ()
91 (let ((subj (or (gnus-header-subject header) "")))
92 (nntp-set-header-subject
93 header (mime-eword/decode-string subj))
95 gnus-newsgroup-headers)