projects
/
elisp
/
semi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(Required environment): Update required version of APEL to 10.7 or
[elisp/semi.git]
/
mime-edit.el
diff --git
a/mime-edit.el
b/mime-edit.el
index
d6899a3
..
26938e9
100644
(file)
--- a/
mime-edit.el
+++ b/
mime-edit.el
@@
-1,6
+1,7
@@
;;; mime-edit.el --- Simple MIME Composer for GNU Emacs
;;; mime-edit.el --- Simple MIME Composer for GNU Emacs
-;; Copyright (C) 1993,94,95,96,97,98,99,2000 Free Software Foundation, Inc.
+;; Copyright (C) 1993,94,95,96,97,98,99,2000,01,02,03
+;; Free Software Foundation, Inc.
;; Author: UMEDA Masanobu <umerin@mse.kyutech.ac.jp>
;; MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
;; Author: UMEDA Masanobu <umerin@mse.kyutech.ac.jp>
;; MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
@@
-23,8
+24,8
@@
;; 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
;; 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.
;;; Commentary:
;;; Commentary:
@@
-110,7
+111,6
@@
(require 'sendmail)
(require 'mail-utils)
(require 'mel)
(require 'sendmail)
(require 'mail-utils)
(require 'mel)
-(require 'eword-encode) ; eword-encode-field-body
(require 'mime-view)
(require 'signature)
(require 'alist)
(require 'mime-view)
(require 'signature)
(require 'alist)
@@
-236,6
+236,9
@@
To insert a signature file automatically, call the function
("application"
("octet-stream" ("type" "" "tar" "shar"))
("postscript")
("application"
("octet-stream" ("type" "" "tar" "shar"))
("postscript")
+ ("pdf")
+ ("msword")
+ ("vnd.ms-excel")
("vnd.ms-powerpoint")
("x-kiss" ("x-cnf")))
("image"
("vnd.ms-powerpoint")
("x-kiss" ("x-cnf")))
("image"
@@
-321,6
+324,11
@@
To insert a signature file automatically, call the function
"base64"
"attachment" (("filename" . file))
)
"base64"
"attachment" (("filename" . file))
)
+ ("\\.xls$" ; MS Excel
+ "application" "vnd.ms-excel" nil
+ "base64"
+ "attachment" (("filename" . file))
+ )
("\\.ppt$" ; MS Power Point
"application" "vnd.ms-powerpoint" nil
"base64"
("\\.ppt$" ; MS Power Point
"application" "vnd.ms-powerpoint" nil
"base64"
@@
-334,13
+342,18
@@
To insert a signature file automatically, call the function
)
("\\.ps$"
"application" "postscript" nil
)
("\\.ps$"
"application" "postscript" nil
- "quoted-printable"
+ "base64"
+ "attachment" (("filename" . file))
+ )
+ ("\\.pdf$"
+ "application" "pdf" nil
+ "base64"
"attachment" (("filename" . file))
)
;; Pure binary
"attachment" (("filename" . file))
)
;; Pure binary
- ("\\.jpg$"
+ ("\\.jpg$\\|\\.jpeg$"
"image" "jpeg" nil
"base64"
"inline" (("filename" . file))
"image" "jpeg" nil
"base64"
"inline" (("filename" . file))
@@
-498,6
+511,8
@@
If encoding is nil, it is determined from its contents."
(iso-8859-7 8 "quoted-printable")
(iso-8859-8 8 "quoted-printable")
(iso-8859-9 8 "quoted-printable")
(iso-8859-7 8 "quoted-printable")
(iso-8859-8 8 "quoted-printable")
(iso-8859-9 8 "quoted-printable")
+ (iso-8859-14 8 "quoted-printable")
+ (iso-8859-15 8 "quoted-printable")
(iso-2022-jp 7 "base64")
(iso-2022-jp-3 7 "base64")
(iso-2022-kr 7 "base64")
(iso-2022-jp 7 "base64")
(iso-2022-jp-3 7 "base64")
(iso-2022-kr 7 "base64")
@@
-651,7
+666,10
@@
If it is not specified for a major-mode,
(if (fboundp 'apel-version)
(concat (apel-version) " "))
(if (featurep 'xemacs)
(if (fboundp 'apel-version)
(concat (apel-version) " "))
(if (featurep 'xemacs)
- (concat (cond ((featurep 'utf-2000)
+ (concat (cond ((and (featurep 'chise)
+ (boundp 'xemacs-chise-version))
+ (concat "CHISE-MULE/" xemacs-chise-version))
+ ((featurep 'utf-2000)
(concat "UTF-2000-MULE/" utf-2000-version))
((featurep 'mule) "MULE"))
" XEmacs"
(concat "UTF-2000-MULE/" utf-2000-version))
((featurep 'mule) "MULE"))
" XEmacs"
@@
-670,7
+688,14
@@
If it is not specified for a major-mode,
;; XEmacs versions earlier than 21.1.1.
(format " (patch %d)" emacs-patch-level))
(t ""))
;; XEmacs versions earlier than 21.1.1.
(format " (patch %d)" emacs-patch-level))
(t ""))
- " (" xemacs-codename ") ("
+ " (" xemacs-codename ")"
+ ;; `xemacs-extra-name' has appeared in the
+ ;; development version of XEmacs 21.5-b8.
+ (if (and (boundp 'xemacs-extra-name)
+ (symbol-value 'xemacs-extra-name))
+ (concat " " (symbol-value 'xemacs-extra-name))
+ "")
+ " ("
system-configuration ")")
" (" emacs-version ")"))
(let ((ver (if (string-match "\\.[0-9]+$" emacs-version)
system-configuration ")")
" (" emacs-version ")"))
(let ((ver (if (string-match "\\.[0-9]+$" emacs-version)
@@
-711,9
+736,9
@@
Tspecials means any character that matches with it in header must be quoted.")
(defconst mime-edit-mime-version-field-for-message/partial
(concat "MIME-Version:"
(defconst mime-edit-mime-version-field-for-message/partial
(concat "MIME-Version:"
- (eword-encode-field-body
+ (mime-encode-field-body
(concat " 1.0 (split by " mime-edit-version ")\n")
(concat " 1.0 (split by " mime-edit-version ")\n")
- "MIME-Version:"))
+ "MIME-Version"))
"MIME version field for message/partial.")
"MIME version field for message/partial.")
@@
-798,9
+823,9
@@
Tspecials means any character that matches with it in header must be quoted.")
(encrypted "Enclose as encrypted" mime-edit-enclose-pgp-encrypted-region)
(quote "Verbatim region" mime-edit-enclose-quote-region)
(key "Insert Public Key" mime-edit-insert-key)
(encrypted "Enclose as encrypted" mime-edit-enclose-pgp-encrypted-region)
(quote "Verbatim region" mime-edit-enclose-quote-region)
(key "Insert Public Key" mime-edit-insert-key)
- (split "About split" mime-edit-set-split)
- (sign "About sign" mime-edit-set-sign)
- (encrypt "About encryption" mime-edit-set-encrypt)
+ (split "Set splitting" mime-edit-set-split)
+ (sign "PGP sign" mime-edit-set-sign)
+ (encrypt "PGP encrypt" mime-edit-set-encrypt)
(preview "Preview Message" mime-edit-preview-message)
(level "Toggle transfer-level" mime-edit-toggle-transfer-level)
)
(preview "Preview Message" mime-edit-preview-message)
(level "Toggle transfer-level" mime-edit-toggle-transfer-level)
)
@@
-1051,6
+1076,7
@@
User customizable variables (not documented all of them):
paragraph-separate))
(run-hooks 'mime-edit-mode-hook)
(message
paragraph-separate))
(run-hooks 'mime-edit-mode-hook)
(message
+ "%s"
(substitute-command-keys
"Type \\[mime-edit-exit] to exit MIME mode, and type \\[mime-edit-help] to get help."))
))
(substitute-command-keys
"Type \\[mime-edit-exit] to exit MIME mode, and type \\[mime-edit-help] to get help."))
))
@@
-1496,7
+1522,7
@@
Nil if no such parameter."
;; Change value
(concat (substring ctype 0 (match-beginning 1))
parameter "=" value
;; Change value
(concat (substring ctype 0 (match-beginning 1))
parameter "=" value
- (substring contype (match-end 1))
+ (substring ctype (match-end 1))
opt-fields)
(concat ctype "; " parameter "=" value opt-fields)
)))
opt-fields)
(concat ctype "; " parameter "=" value opt-fields)
)))
@@
-1594,7
+1620,7
@@
Optional DELIMITER specifies parameter delimiter (';' by default)."
(defun mime-prompt-for-parameter (parameter)
"Ask for PARAMETER.
(defun mime-prompt-for-parameter (parameter)
"Ask for PARAMETER.
-Parameter must be '(PROMPT CHOICE1 (CHOISE2 ...))."
+Parameter must be '(PROMPT CHOICE1 (CHOICE2...))."
(let* ((prompt (car parameter))
(choices (mapcar (function
(lambda (e)
(let* ((prompt (car parameter))
(choices (mapcar (function
(lambda (e)
@@
-1648,9
+1674,8
@@
Parameter must be '(PROMPT CHOICE1 (CHOISE2 ...))."
(defun mime-edit-translate-header ()
"Encode the message header into network representation."
(defun mime-edit-translate-header ()
"Encode the message header into network representation."
- (eword-encode-header 'code-conversion)
- (run-hooks 'mime-edit-translate-header-hook)
- )
+ (mime-encode-header-in-buffer 'code-conversion)
+ (run-hooks 'mime-edit-translate-header-hook))
(defun mime-edit-translate-buffer ()
"Encode the tagged MIME message in current buffer in MIME compliant message."
(defun mime-edit-translate-buffer ()
"Encode the tagged MIME message in current buffer in MIME compliant message."
@@
-1708,6
+1733,7
@@
Parameter must be '(PROMPT CHOICE1 (CHOISE2 ...))."
)
(delete-region beg end)
(or (looking-at mime-edit-beginning-tag-regexp)
)
(delete-region beg end)
(or (looking-at mime-edit-beginning-tag-regexp)
+ (looking-at mime-edit-multipart-end-regexp)
(eobp)
(insert (concat (mime-make-text-tag) "\n"))
)))
(eobp)
(insert (concat (mime-make-text-tag) "\n"))
)))
@@
-1767,6
+1793,13
@@
Parameter must be '(PROMPT CHOICE1 (CHOISE2 ...))."
(defvar mime-edit-pgp-user-id nil)
(defvar mime-edit-pgp-user-id nil)
+(defun mime-edit-delete-trailing-whitespace ()
+ (save-match-data
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward "[ \t]+$" nil t)
+ (delete-region (match-beginning 0) (match-end 0))))))
+
(defun mime-edit-sign-pgp-mime (beg end boundary)
(save-excursion
(save-restriction
(defun mime-edit-sign-pgp-mime (beg end boundary)
(save-excursion
(save-restriction
@@
-1778,6
+1811,7
@@
Parameter must be '(PROMPT CHOICE1 (CHOISE2 ...))."
(encoding (nth 1 ret))
(pgp-boundary (concat "pgp-sign-" boundary))
micalg)
(encoding (nth 1 ret))
(pgp-boundary (concat "pgp-sign-" boundary))
micalg)
+ (mime-edit-delete-trailing-whitespace) ; RFC3156
(goto-char beg)
(insert (format "Content-Type: %s\n" ctype))
(if encoding
(goto-char beg)
(insert (format "Content-Type: %s\n" ctype))
(if encoding
@@
-1788,7
+1822,8
@@
Parameter must be '(PROMPT CHOICE1 (CHOISE2 ...))."
(or mime-edit-pgp-user-id
(if from
(nth 1 (std11-extract-address-components from))
(or mime-edit-pgp-user-id
(if from
(nth 1 (std11-extract-address-components from))
- pgg-default-user-id))))
+ pgg-default-user-id)))
+ (pgg-text-mode t))
(pgg-sign-region (point-min)(point-max)))
(throw 'mime-edit-error 'pgp-error)
)
(pgg-sign-region (point-min)(point-max)))
(throw 'mime-edit-error 'pgp-error)
)
@@
-1874,12
+1909,13
@@
Content-Transfer-Encoding: 7bit
(insert (format "Content-Transfer-Encoding: %s\n" encoding))
)
(insert "\n")
(insert (format "Content-Transfer-Encoding: %s\n" encoding))
)
(insert "\n")
- (eword-encode-header)
+ (mime-encode-header-in-buffer)
(or (let ((pgg-default-user-id
(or mime-edit-pgp-user-id
(if from
(nth 1 (std11-extract-address-components from))
(or (let ((pgg-default-user-id
(or mime-edit-pgp-user-id
(if from
(nth 1 (std11-extract-address-components from))
- pgg-default-user-id))))
+ pgg-default-user-id)))
+ (pgg-text-mode t))
(pgg-encrypt-region
(point-min) (point-max)
(mapcar (lambda (recipient)
(pgg-encrypt-region
(point-min) (point-max)
(mapcar (lambda (recipient)
@@
-2122,8
+2158,7
@@
Content-Description: S/MIME Encrypted Message][base64]]\n")
(insert "Content-Type: " contype "\n")
(if encoding
(insert "Content-Transfer-Encoding: " encoding "\n"))
(insert "Content-Type: " contype "\n")
(if encoding
(insert "Content-Transfer-Encoding: " encoding "\n"))
- (eword-encode-header)
- )
+ (mime-encode-header-in-buffer))
(cons (and contype
(downcase contype))
(and encoding
(cons (and contype
(downcase contype))
(and encoding
@@
-2291,7
+2326,13
@@
Content-Description: S/MIME Encrypted Message][base64]]\n")
(narrow-to-region beg (mime-edit-content-end))
(goto-char beg)
(while (re-search-forward "\\(\\=\\|[^\r]\\)\n" nil t)
(narrow-to-region beg (mime-edit-content-end))
(goto-char beg)
(while (re-search-forward "\\(\\=\\|[^\r]\\)\n" nil t)
- (replace-match "\\1\r\n"))))
+ ;; In a certain period, `replace-match' with "\\N"
+ ;; converted 8-bit characters into multibyte string,
+ ;; but it has been fixed at 2004-01-15.
+ ;;(replace-match "\\1\r\n"))))
+ (backward-char 1)
+ (insert "\r")
+ (forward-char 1))))
(goto-char beg)
(mime-encode-region beg (mime-edit-content-end)
(or encoding "7bit"))
(goto-char beg)
(mime-encode-region beg (mime-edit-content-end)
(or encoding "7bit"))
@@
-2601,14
+2642,10
@@
Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n"
(or (cdr (assq major-mode mime-edit-message-max-lines-alist))
mime-edit-message-default-max-lines))
)
(or (cdr (assq major-mode mime-edit-message-max-lines-alist))
mime-edit-message-default-max-lines))
)
- (let* ((mime-edit-draft-file-name
- (or (buffer-file-name)
- (make-temp-name
- (expand-file-name "mime-draft" temporary-file-directory))))
- (separator mail-header-separator)
- (id (concat "\""
- (replace-space-with-underline (current-time-string))
- "@" (system-name) "\"")))
+ (let ((separator mail-header-separator)
+ (id (concat "\""
+ (replace-space-with-underline (current-time-string))
+ "@" (system-name) "\"")))
(run-hooks 'mime-edit-before-split-hook)
(let ((the-buf (current-buffer))
(copy-buf (get-buffer-create " *Original Message*"))
(run-hooks 'mime-edit-before-split-hook)
(let ((the-buf (current-buffer))
(copy-buf (get-buffer-create " *Original Message*"))
@@
-2666,7
+2703,7
@@
Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n"
(message (format "Sending %d/%d..."
mime-edit-partial-number total))
(call-interactively command)
(message (format "Sending %d/%d..."
mime-edit-partial-number total))
(call-interactively command)
- (message (format "Sending %d/%d... done"
+ (message (format "Sending %d/%d...done"
mime-edit-partial-number total))
)
(setq mime-edit-partial-number
mime-edit-partial-number total))
)
(setq mime-edit-partial-number
@@
-2684,7
+2721,7
@@
Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n"
(save-excursion
(message (format "Sending %d/%d..."
mime-edit-partial-number total))
(save-excursion
(message (format "Sending %d/%d..."
mime-edit-partial-number total))
- (message (format "Sending %d/%d... done"
+ (message (format "Sending %d/%d...done"
mime-edit-partial-number total))
)
)))
mime-edit-partial-number total))
)
)))
@@
-2707,6
+2744,7
@@
Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n"
;;;
(defvar mime-edit-buffer nil) ; buffer local variable
;;;
(defvar mime-edit-buffer nil) ; buffer local variable
+(defvar mime-edit-temp-message-buffer nil) ; buffer local variable
(defun mime-edit-preview-message ()
"preview editing MIME message."
(defun mime-edit-preview-message ()
"preview editing MIME message."
@@
-2933,7
+2971,8
@@
Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n"
(setq encoded t
encoding nil)
)))))))
(setq encoded t
encoding nil)
)))))))
- (if (or encoded (not not-decode-text))
+ (if (and (eq type 'text)
+ (or encoded (not not-decode-text)))
(progn
(save-excursion
(goto-char (point-min))
(progn
(save-excursion
(goto-char (point-min))