X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=emh.el;h=74d906fb81a6aeea08fb45fedf770c9072ab1512;hb=6bd9295b67da7e5c6d7df23cfc958df9fff09f86;hp=ceabe47ea0bd2c38a7aecfed8d4363598b468c1a;hpb=11173fb6b4a87cacebe600cefa8fa390bc61d441;p=elisp%2Femh.git diff --git a/emh.el b/emh.el index ceabe47..74d906f 100644 --- a/emh.el +++ b/emh.el @@ -1,6 +1,6 @@ ;;; emh.el --- MIME extender for mh-e -;; Copyright (C) 1995,1996 Free Software Foundation, Inc. +;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko ;; OKABE Yasuo @@ -8,7 +8,6 @@ ;; Created: 1993/11/21 ;; Renamed: 1993/11/27 from mh-e-mime.el ;; Renamed: 1997/02/21 from tm-mh-e.el -;; Version: $Revision: 0.7 $ ;; Keywords: MH, MIME, multimedia, encoded-word, multilingual, mail ;; This file is part of emh. @@ -31,33 +30,43 @@ ;;; Code: (require 'mh-e) -(require 'mime-view) (require 'alist) +(require 'mime-view) +(eval-when-compile (require 'mime-text)) ;;; @ version ;;; -(defconst emh-RCS-ID - "$Id: emh.el,v 0.7 1997-03-04 20:22:07 morioka Exp $") - -(defconst emh-version (get-version-string emh-RCS-ID)) +(defconst emh-version "1.6.0") ;;; @ variable ;;; -(defvar emh-automatic-mime-preview t - "*If non-nil, show MIME processed message.") +(defgroup emh nil + "MIME Extension for mh-e" + :group 'mime + :group 'mh) -(defvar emh-decode-encoded-word t - "*If non-nil, decode encoded-word when it is not MIME preview mode.") +(defcustom emh-automatic-mime-preview t + "*If non-nil, show MIME processed message." + :group 'emh + :type 'boolean) + +(defcustom emh-decode-encoded-word t + "*If non-nil, decode encoded-word when it is not MIME preview mode." + :group 'emh + :type 'boolean) ;;; @ functions ;;; (defun mh-display-msg (msg-num folder &optional show-buffer mode) + "Display message number MSG-NUM of FOLDER. +This function uses `mime-view-mode' if MODE is not nil. If MODE is +nil, `emh-automatic-mime-preview' is used as default value." (or mode (setq mode emh-automatic-mime-preview) ) @@ -91,19 +100,12 @@ (setq abuf (get-buffer-create aname)) (set-buffer abuf) ) - (as-binary-input-file - (insert-file-contents msg-filename) - ;; (goto-char (point-min)) - (while (re-search-forward "\r$" nil t) - (replace-match "") - ) - ) + (insert-file-contents-as-raw-text msg-filename) (set-buffer-modified-p nil) (setq buffer-read-only t) (setq buffer-file-name msg-filename) (mh-show-mode) - (mime-view-mode nil nil nil - aname (concat "show-" folder)) + (mime-view-buffer aname (concat "show-" folder)) (goto-char (point-min)) ) (let ((clean-message-header mh-clean-message-header) @@ -175,9 +177,9 @@ With arg, turn MIME processing on if arg is positive." (save-excursion (set-buffer mh-show-buffer) (if (null emh-automatic-mime-preview) - (if (and mime::preview/article-buffer - (get-buffer mime::preview/article-buffer)) - (kill-buffer mime::preview/article-buffer) + (if (and mime-raw-buffer + (get-buffer mime-raw-buffer)) + (kill-buffer mime-raw-buffer) ))) (mh-invalidate-show-buffer) (mh-show (mh-get-msg-num t)) @@ -192,7 +194,8 @@ With arg, turn MIME processing on if arg is positive." (defun emh-header-display () (interactive) (mh-invalidate-show-buffer) - (let ((mime-view-ignored-field-regexp "^:$") + (let (mime-view-ignored-field-list + mime-view-visible-field-list emh-decode-encoded-word) (mh-header-display) )) @@ -223,41 +226,31 @@ digest are inserted into the folder after that message." ;;; @ for mime-view ;;; -(fset 'emh-decode-charset-buffer - (symbol-function 'mime-charset/decode-buffer)) +(set-alist 'mime-raw-representation-type-alist 'mh-show-mode 'binary) -(set-alist 'mime-text-decoder-alist - 'mh-show-mode - (function emh-decode-charset-buffer)) -(defvar emh-content-header-filter-hook - (if window-system - '(emh-highlight-header) - ) +(defvar emh-display-header-hook (if window-system + '(emh-highlight-header) + ) "Hook for header filtering.") (autoload 'emh-highlight-header "emh-face") -(defun emh-content-header-filter () - (goto-char (point-min)) - (mime-preview/cut-header) - (emh-decode-charset-buffer default-mime-charset) - (eword-decode-header) - (run-hooks 'emh-content-header-filter-hook) +(defun emh-header-presentation-method (entity situation) + (mime-insert-decoded-header + entity + mime-view-ignored-field-list mime-view-visible-field-list + default-mime-charset) + (run-hooks 'emh-display-header-hook) ) -(set-alist 'mime-view-content-header-filter-alist - 'mh-show-mode - (function emh-content-header-filter)) +(set-alist 'mime-header-presentation-method-alist + 'mh-show-mode #'emh-header-presentation-method) + (defun emh-quitting-method () - (let ((win (get-buffer-window - mime/output-buffer-name)) - (buf (current-buffer)) - ) - (if win - (delete-window win) - ) + (let ((buf (current-buffer))) + (mime-maybe-hide-echo-buffer) (pop-to-buffer (let ((name (buffer-name buf))) (substring name 5) @@ -268,12 +261,9 @@ digest are inserted into the folder after that message." (mh-show (mh-get-msg-num t)) )) -(set-alist 'mime-view-quitting-method-alist - 'mh-show-mode - (function emh-quitting-method)) -(set-alist 'mime-view-show-summary-method - 'mh-show-mode - (function emh-quitting-method)) +(set-alist 'mime-preview-quitting-method-alist + 'mh-show-mode #'emh-quitting-method) + (defun emh-following-method (buf) (save-excursion @@ -289,37 +279,38 @@ digest are inserted into the folder after that message." (goto-char last) ))) -(set-alist 'mime-view-following-method-alist - 'mh-show-mode - (function emh-following-method)) +(set-alist 'mime-preview-following-method-alist + 'mh-show-mode #'emh-following-method) ;;; @@ for mime-partial ;;; -(call-after-loaded - 'mime-partial - (function - (lambda () - (set-atype 'mime/content-decoding-condition - '((type . "message/partial") - (method . mime-article/grab-message/partials) - (major-mode . mh-show-mode) - (summary-buffer-exp - . (and (or (string-match "^article-\\(.+\\)$" article-buffer) - (string-match "^show-\\(.+\\)$" article-buffer)) - (substring article-buffer - (match-beginning 1) (match-end 1)) - )) - )) - (set-alist 'mime-partial/preview-article-method-alist - 'mh-show-mode - (function - (lambda () - (let ((emh-automatic-mime-preview t)) - (emh-show) - )))) - ))) +(autoload 'mime-combine-message/partial-pieces-automatically + "mime-partial" + "Internal method to combine message/partial messages automatically.") + +(mime-add-condition + 'action + '((type . message)(subtype . partial) + (method . mime-combine-message/partial-pieces-automatically) + (major-mode . mh-show-mode) + (summary-buffer-exp + . (and (or (string-match "^article-\\(.+\\)$" + article-buffer) + (string-match "^show-\\(.+\\)$" article-buffer)) + (substring article-buffer + (match-beginning 1) (match-end 1)) + )) + )) + +(set-alist 'mime-view-partial-message-method-alist + 'mh-show-mode + (function + (lambda () + (let ((emh-automatic-mime-preview t)) + (emh-show) + )))) ;;; @ set up @@ -338,8 +329,8 @@ digest are inserted into the folder after that message." (if buf (let ((the-buf (current-buffer))) (switch-to-buffer buf) - (if (and mime::article/preview-buffer - (setq buf (get-buffer mime::article/preview-buffer)) + (if (and mime-preview-buffer + (setq buf (get-buffer mime-preview-buffer)) ) (progn (switch-to-buffer the-buf) @@ -350,49 +341,12 @@ digest are inserted into the folder after that message." )))) (add-hook 'mh-before-quit-hook (function emh-summary-before-quit)) - - -;;; @@ for emh-comp.el -;;; - -(autoload 'emh-edit-again "emh-comp" - "Clean-up a draft or a message previously sent and make it resendable." t) -(autoload 'emh-extract-rejected-mail "emh-comp" - "Extract a letter returned by the mail system and make it re-editable." t) -(autoload 'emh-forward "emh-comp" - "Forward a message or message sequence by MIME style." t) - -(call-after-loaded - 'mime-setup - (function - (lambda () - (substitute-key-definition - 'mh-edit-again 'emh-edit-again mh-folder-mode-map) - (substitute-key-definition - 'mh-extract-rejected-mail 'emh-extract-rejected-mail - mh-folder-mode-map) - (substitute-key-definition - 'mh-forward 'emh-forward mh-folder-mode-map) - - (call-after-loaded - 'mh-comp - (function - (lambda () - (require 'emh-comp) - )) - 'mh-letter-mode-hook) - ))) ;;; @ for BBDB ;;; -(call-after-loaded - 'bbdb - (function - (lambda () - (require 'mime-bbdb) - ))) +(eval-after-load "bbdb" '(require 'mime-bbdb)) ;;; @ end