;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; 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).
;;;
(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))
;;;
(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]")
(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:\\)")
"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."
"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))
(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
(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")
(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)
)
)
(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)
(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)
(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)
(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)
(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