;;; ;;; tm-sgnus.el --- tm-gnus module for September Gnus ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. ;;; Copyright (C) 1995 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko ;;; Maintainer: MORIOKA Tomohiko ;;; Created: 1995/09/24 ;;; Version: $Revision: 7.24 $ ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word ;;; ;;; This file is part of tm (Tools for MIME). ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as ;;; published by the Free Software Foundation; either version 2, or ;;; (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;; General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with This program. If not, write to the Free Software ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ;;; ;;; Code: (require 'tl-str) (require 'tl-list) (require 'tl-misc) (require 'tm-view) (require 'gnus) (require 'tm-gd5) ;;; @ version ;;; (defconst tm-gnus/RCS-ID "$Id: tm-sgnus.el,v 7.24 1995/12/15 13:47:36 morioka Exp $") (defconst tm-gnus/version (concat (get-version-string tm-gnus/RCS-ID) " for September")) ;;; @ variables ;;; (defvar tm-gnus/automatic-mime-preview t "*If non-nil, show MIME processed article. This variable is set to `gnus-show-mime'.") (setq gnus-show-mime tm-gnus/automatic-mime-preview) ;;; @ command functions ;;; (defun tm-gnus/view-message (arg) "MIME decode and play this message." (interactive "P") (let ((gnus-break-pages nil)) (gnus-summary-select-article t t) ) (pop-to-buffer gnus-original-article-buffer t) (let (buffer-read-only) (if (text-property-any (point-min) (point-max) 'invisible t) (remove-text-properties (point-min) (point-max) gnus-hidden-properties) )) (mime/viewer-mode nil nil nil gnus-original-article-buffer gnus-article-buffer) ) (defun tm-gnus/summary-scroll-down () "Scroll down one line current article." (interactive) (gnus-summary-scroll-up -1) ) (defun tm-gnus/summary-toggle-header (&optional arg) (interactive "P") (if tm-gnus/automatic-mime-preview (let ((mime-viewer/ignored-field-regexp (if (save-excursion (set-buffer gnus-article-buffer) (save-restriction (narrow-to-region (point-min) (if (re-search-forward "^$" nil t) (match-beginning 0) (point-max) )) (some-element (lambda (field) (goto-char (point-min)) (and (re-search-forward (concat "^" field ":") nil t) (setq field (buffer-substring-no-properties (match-beginning 0) (match-end 0))) (not (string-match mime-viewer/visible-field-regexp field)) ) ) mime-viewer/ignored-field-list))) mime-viewer/ignored-field-regexp "^:$"))) (gnus-summary-select-article t t) ) (gnus-summary-toggle-header arg) )) (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message)) (define-key gnus-summary-mode-map "\e\r" (function tm-gnus/summary-scroll-down)) (define-key gnus-summary-mode-map "t" (function tm-gnus/summary-toggle-header)) ;;; @ for tm-view ;;; (defun mime-viewer/quitting-method-for-sgnus () (if (not gnus-show-mime) (mime-viewer/kill-buffer)) (delete-other-windows) (gnus-article-show-summary) (if (or (not gnus-show-mime) (null gnus-have-all-headers)) (gnus-summary-select-article nil t) )) (call-after-loaded 'tm-view (lambda () (set-alist 'mime-viewer/quitting-method-alist 'gnus-original-article-mode (function mime-viewer/quitting-method-for-sgnus)) )) ;;; @ for tm-partial ;;; (defun tm-gnus/partial-preview-function () (tm-gnus/view-message (gnus-summary-article-number)) ) (call-after-loaded 'tm-partial (lambda () (set-atype 'mime/content-decoding-condition '((type . "message/partial") (method . mime-article/grab-message/partials) (major-mode . gnus-original-article-mode) (summary-buffer-exp . gnus-summary-buffer) )) (set-alist 'tm-partial/preview-article-method-alist 'gnus-original-article-mode 'tm-gnus/partial-preview-function) )) ;;; @ article filter ;;; (defun tm-gnus/article-reset-variable () (setq tm-gnus/automatic-mime-preview nil) ) (add-hook 'gnus-article-prepare-hook 'tm-gnus/article-reset-variable) (defun tm-gnus/preview-article () (make-local-variable 'tm:mother-button-dispatcher) (setq tm:mother-button-dispatcher (function gnus-article-push-button)) (mime/viewer-mode nil nil nil gnus-original-article-buffer gnus-article-buffer) (setq tm-gnus/automatic-mime-preview t) (run-hooks 'tm-gnus/article-prepare-hook) ) (setq gnus-show-mime-method (function tm-gnus/preview-article)) (defun tm-gnus/article-decode-encoded-word () (mime/decode-message-header) (run-hooks 'tm-gnus/article-prepare-hook) ) (setq gnus-decode-encoded-word-method (function tm-gnus/article-decode-encoded-word)) (or (fboundp 'tm::gnus-article-hide-headers-if-wanted) (fset 'tm::gnus-article-hide-headers-if-wanted (symbol-function 'gnus-article-hide-headers-if-wanted)) ) (defun gnus-article-hide-headers-if-wanted () (or tm-gnus/automatic-mime-preview (tm::gnus-article-hide-headers-if-wanted) )) ;;; @ for BBDB ;;; (defun tm-gnus/bbdb-setup () (if (memq 'bbdb/gnus-update-record gnus-article-prepare-hook) (progn (remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record) (add-hook 'tm-gnus/article-prepare-hook 'bbdb/gnus-update-record) ))) (add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t) (tm-gnus/bbdb-setup) ;;; @ end ;;; (provide 'tm-sgnus)