X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=tm-edit.el;h=6846e07c703f559c01f62ec78ae1b5bf7cbf36d2;hb=ac78557ec302b6e9158b28b531bcb51b332adfdd;hp=2601a39c76ef3176dfdfdf1d64c6b12a7f1d55bc;hpb=aed61f4327f3bc83b99966079471ca4160e76960;p=elisp%2Ftm.git diff --git a/tm-edit.el b/tm-edit.el index 2601a39..6846e07 100644 --- a/tm-edit.el +++ b/tm-edit.el @@ -6,7 +6,7 @@ ;; MORIOKA Tomohiko ;; Maintainer: MORIOKA Tomohiko ;; Created: 1994/08/21 renamed from mime.el -;; Version: $Revision: 7.87 $ +;; Version: $Revision: 7.93 $ ;; Keywords: mail, news, MIME, multimedia, multilingual ;; This file is part of tm (Tools for MIME). @@ -121,7 +121,7 @@ ;;; (defconst mime-editor/RCS-ID - "$Id: tm-edit.el,v 7.87 1996/09/23 19:53:58 morioka Exp $") + "$Id: tm-edit.el,v 7.93 1996/10/31 15:17:33 morioka Exp $") (defconst mime-editor/version (get-version-string mime-editor/RCS-ID)) @@ -385,7 +385,8 @@ If encoding is nil, it is determined from its contents.") ;;; (defvar mime-editor/yank-ignored-field-list - '("Received" "Approved" "Path" "Replied" "Status" "X-VM-.*" "X-UIDL") + '("Received" "Approved" "Path" "Replied" "Status" + "Xref" "X-UIDL" "X-Filter" "X-Gnus-.*" "X-VM-.*") "Delete these fields from original message when it is inserted as message/rfc822 part. Each elements are regexp of field-name. [tm-edit.el]") @@ -404,11 +405,14 @@ Each elements are regexp of field-name. [tm-edit.el]") (defvar mime-editor/split-message t "*Split large message if it is non-nil. [tm-edit.el]") -(defvar mime-editor/message-default-max-length 1000 - "*Default maximum size of a message. [tm-edit.el]") +(defvar mime-editor/message-default-max-lines 1000 + "*Default maximum lines of a message. [tm-edit.el]") -(defvar mime-editor/message-max-length-alist - '((news-reply-mode . 500))) +(defvar mime-editor/message-max-lines-alist + '((news-reply-mode . 500)) + "Alist of major-mode vs maximum lines of a message. +If it is not specified for a major-mode, +`mime-editor/message-default-max-lines' is used. [tm-edit.el]") (defconst mime-editor/split-ignored-field-regexp "\\(^Content-\\|^Subject:\\|^Mime-Version:\\)") @@ -857,13 +861,22 @@ just return to previous mode." "Insert a text message. Charset is automatically obtained from the `mime/lc-charset-alist'." (interactive) - (if (and (mime-editor/insert-tag "text" nil nil) - (looking-at mime-editor/single-part-tag-regexp)) + (let ((ret (mime-editor/insert-tag "text" nil nil))) + (if ret (progn - ;; Make a space between the following message. - (insert "\n") - (forward-char -1) - ))) + (if (looking-at mime-editor/single-part-tag-regexp) + (progn + ;; Make a space between the following message. + (insert "\n") + (forward-char -1) + )) + (if (and (member (second ret) '("enriched" "richtext")) + (fboundp 'enriched-mode) + ) + (enriched-mode t) + (if (boundp 'enriched-mode) + (enriched-mode nil) + )))))) (defun mime-editor/insert-file (file) "Insert a message from a file." @@ -986,6 +999,15 @@ Charset is automatically obtained from the `mime/lc-charset-alist'." "Insert new MIME tag and return a list of PRITYPE, SUBTYPE, and PARAMETERS. If nothing is inserted, return nil." (interactive) + (let ((p (point))) + (mime-editor/goto-tag) + (if (and (re-search-forward mime-editor/tag-regexp nil t) + (< (match-beginning 0) p) + (< p (match-end 0)) + ) + (goto-char (match-beginning 0)) + (goto-char p) + )) (let ((oldtag nil) (newtag nil) (current (point)) @@ -1050,8 +1072,14 @@ Optional argument ENCODING specifies an encoding method such as base64." (progn (invisible-region (point-min) (point-max)) (goto-char (point-max)) - )) - ) + ) + (goto-char (point-max)) + )) + (or hide-p + (looking-at mime-editor/tag-regexp) + (= (point)(point-max)) + (mime-editor/insert-tag "text" "plain") + ) ;; Define encoding even if it is 7bit. (if (stringp encoding) (save-excursion @@ -1972,6 +2000,14 @@ Content-Transfer-Encoding: 7bit (point))) (end (mime-editor/content-end)) ) + ;; Patch for hard newlines + ;; (save-excursion + ;; (goto-char beg) + ;; (while (search-forward "\n" end t) + ;; (put-text-property (match-beginning 0) + ;; (point) + ;; 'hard t))) + ;; End patch for hard newlines (enriched-encode beg end) (goto-char beg) (if (search-forward "\n\n") @@ -2029,6 +2065,8 @@ Content-Transfer-Encoding: 7bit (defun mime-editor/voice-recorder-for-sun (encoding) "Record voice in a buffer using Sun audio device, and insert data encoded as ENCODING. [tm-edit.el]" + (message "Start the recording on %s. Type C-g to finish the recording..." + (system-name)) (mime-insert-encoded-file "/dev/audio" encoding) ) @@ -2281,8 +2319,8 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" ) (or mime-editor/message-max-length (setq mime-editor/message-max-length - (or (cdr (assq major-mode mime-editor/message-max-length-alist)) - mime-editor/message-default-max-length)) + (or (cdr (assq major-mode mime-editor/message-max-lines-alist)) + mime-editor/message-default-max-lines)) ) (let* ((mime-editor/draft-file-name (or (buffer-file-name) @@ -2295,7 +2333,7 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" (run-hooks 'mime-editor/before-split-hook) (let ((the-buf (current-buffer)) (copy-buf (get-buffer-create " *Original Message*")) - (header (rfc822/get-header-string-except + (header (std11-header-string-except mime-editor/split-ignored-field-regexp separator)) (subject (mail-fetch-field "subject")) (total (+ (/ lines mime-editor/message-max-length) @@ -2306,6 +2344,11 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" (cdr (assq major-mode mime-editor/split-message-sender-alist)) + (function + (lambda () + (interactive) + (error "Split sender is not specified for `%s'." major-mode) + )) )) (mime-editor/partial-number 1) data) @@ -2371,8 +2414,8 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" (interactive) (run-hooks 'mime-editor/before-send-hook) (let ((mime-editor/message-max-length - (or (cdr (assq major-mode mime-editor/message-max-length-alist)) - mime-editor/message-default-max-length)) + (or (cdr (assq major-mode mime-editor/message-max-lines-alist)) + mime-editor/message-default-max-lines)) (lines (count-lines (point-min) (point-max))) ) (if (and (> lines mime-editor/message-max-length) @@ -2578,7 +2621,7 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" (end (std11-field-end))) (setq encoding (eliminate-top-spaces - (rfc822/unfolding-string + (std11-unfold-string (buffer-substring hbeg end)))) (if (or charset (string-equal type "text")) (progn