X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=semi-setup.el;h=d37b1909e88b81dbb9903853505ad2863a2bd5ad;hb=83b8b7fd1a73b6975330b7fd71905058b5cf521d;hp=33ec99c0c305aa33095eb74fe96c261df828f4a2;hpb=593ef21e075b718ee667195c078c456ce1bce52a;p=elisp%2Fsemi.git diff --git a/semi-setup.el b/semi-setup.el index 33ec99c..d37b190 100644 --- a/semi-setup.el +++ b/semi-setup.el @@ -1,8 +1,8 @@ ;;; semi-setup.el --- setup file for MIME-View. -;; Copyright (C) 1994,1995,1996,1997,1998 Free Software Foundation, Inc. +;; Copyright (C) 1994,95,96,97,98,99,2000 Free Software Foundation, Inc. -;; Author: MORIOKA Tomohiko +;; Author: MORIOKA Tomohiko ;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word ;; This file is part of SEMI (Setting for Emacs MIME Interfaces). @@ -19,73 +19,131 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Code: (require 'semi-def) (require 'path-util) - -;; for image/* and X-Face +(defun call-after-loaded (module func &optional hook-name) + "If MODULE is provided, then FUNC is called. +Otherwise func is set to MODULE-load-hook. +If optional argument HOOK-NAME is specified, +it is used as hook to set." + (if (featurep module) + (funcall func) + (or hook-name + (setq hook-name (intern (concat (symbol-name module) "-load-hook"))) + ) + (add-hook hook-name func) + )) + + +;; for image/* (defvar mime-setup-enable-inline-image (and window-system - (or running-xemacs - (and (featurep 'mule)(module-installed-p 'bitmap)) - )) + (or (featurep 'xemacs)(featurep 'mule))) "*If it is non-nil, semi-setup sets up to use mime-image.") (if mime-setup-enable-inline-image - (call-after-loaded 'mime-view - (function - (lambda () - (require 'mime-image) - ))) - ) + (eval-after-load "mime-view" + '(require 'mime-image))) +;; for text/html +(defvar mime-setup-enable-inline-html + (module-installed-p 'w3) + "*If it is non-nil, semi-setup sets up to use mime-w3.") + +(if mime-setup-enable-inline-html + (eval-after-load "mime-view" + '(progn + (autoload 'mime-preview-text/html "mime-w3") + + (ctree-set-calist-strictly + 'mime-preview-condition + '((type . text)(subtype . html) + (body . visible) + (body-presentation-method . mime-preview-text/html))) + + (set-alist 'mime-view-type-subtype-score-alist + '(text . html) 3) + ))) -(defvar mime-setup-enable-pgp - (module-installed-p 'mailcrypt) - "*If it is non-nil, semi-setup sets uf to use mime-pgp.") ;; for PGP +(defvar mime-setup-enable-pgp t + "*If it is non-nil, semi-setup sets uf to use mime-pgp.") + (if mime-setup-enable-pgp (eval-after-load "mime-view" '(progn + (require 'mime-pgp) + (mime-add-condition 'preview '((type . application)(subtype . pgp) (message-button . visible))) (mime-add-condition 'action '((type . application)(subtype . pgp) - (method . mime-method-for-application/pgp)) + (method . mime-view-application/pgp)) 'strict "mime-pgp") (mime-add-condition 'action '((type . text)(subtype . x-pgp) - (method . mime-method-for-application/pgp))) + (method . mime-view-application/pgp))) (mime-add-condition 'action '((type . multipart)(subtype . signed) - (method . mime-method-to-verify-multipart/signed)) + (method . mime-verify-multipart/signed)) 'strict "mime-pgp") (mime-add-condition 'action '((type . application)(subtype . pgp-signature) - (method . mime-method-to-verify-application/pgp-signature)) + (method . mime-verify-application/pgp-signature)) 'strict "mime-pgp") (mime-add-condition 'action '((type . application)(subtype . pgp-encrypted) - (method . mime-method-to-decrypt-application/pgp-encrypted)) + (method . mime-decrypt-application/pgp-encrypted)) 'strict "mime-pgp") (mime-add-condition 'action '((type . application)(subtype . pgp-keys) - (method . mime-method-to-add-application/pgp-keys)) + (method . mime-add-application/pgp-keys)) 'strict "mime-pgp") + + (mime-add-condition + 'action + '((type . application)(subtype . pkcs7-signature) + (method . mime-verify-application/pkcs7-signature)) + 'strict "mime-pgp") + + (mime-add-condition + 'action + '((type . application)(subtype . x-pkcs7-signature) + (method . mime-verify-application/pkcs7-signature)) + 'strict "mime-pgp") + + (mime-add-condition + 'action + '((type . application)(subtype . pkcs7-mime) + (method . mime-view-application/pkcs7-mime)) + 'strict "mime-pgp") + + (mime-add-condition + 'action + '((type . application)(subtype . x-pkcs7-mime) + (method . mime-view-application/pkcs7-mime)) + 'strict "mime-pgp") + + (ctree-set-calist-strictly + 'mime-preview-condition + '((type . multipart) (subtype . encrypted) ("protocol" . "application/pgp-encrypted") + (body . visible) + (body-presentation-method . mime-display-multipart/pgp-encrypted))) )) ) @@ -93,23 +151,23 @@ ;;; @ for mime-edit ;;; -(defun mime-setup-decode-message-header () - (save-excursion - (save-restriction - (goto-char (point-min)) - (narrow-to-region - (point-min) - (if (re-search-forward - (concat "^" (regexp-quote mail-header-separator) "$") - nil t) - (match-beginning 0) - (point-max) - )) - (eword-decode-header) - (set-buffer-modified-p nil) - ))) - -(add-hook 'mime-edit-mode-hook 'mime-setup-decode-message-header) +;; (defun mime-setup-decode-message-header () +;; (save-excursion +;; (save-restriction +;; (goto-char (point-min)) +;; (narrow-to-region +;; (point-min) +;; (if (re-search-forward +;; (concat "^" (regexp-quote mail-header-separator) "$") +;; nil t) +;; (match-beginning 0) +;; (point-max) +;; )) +;; (mime-decode-header-in-buffer) +;; (set-buffer-modified-p nil) +;; ))) + +;; (add-hook 'mime-edit-mode-hook 'mime-setup-decode-message-header) ;;; @@ variables @@ -147,7 +205,22 @@ ;;; @ for mu-cite ;;; -(add-hook 'mu-cite/pre-cite-hook 'eword-decode-header) +;; (add-hook 'mu-cite/pre-cite-hook 'eword-decode-header) + + +;;; @ for Mac OS X +;;; + +(when (eq system-type 'darwin) + (eval-after-load "mime-view" + '(progn + (mime-add-condition + 'action + '((type . application) + (method . mime-mac-save-and-play-with-open)) + 'with-default + "mime-mac") + ))) ;;; @ end