(require 'mm-bodies)
(require 'mm-encode)
(require 'mm-decode)
-(require 'gnus-ems)
(require 'mml-sec)
(eval-when-compile (require 'cl))
(eval-and-compile
(autoload 'message-make-message-id "message")
(autoload 'gnus-setup-posting-charset "gnus-msg")
+ (autoload 'gnus-add-minor-mode "gnus-ems")
(autoload 'message-fetch-field "message")
(autoload 'message-posting-charset "message"))
(defun mml-parse ()
"Parse the current buffer as an MML document."
- (goto-char (point-min))
- (let ((table (syntax-table)))
- (unwind-protect
- (progn
- (set-syntax-table mml-syntax-table)
- (mml-parse-1))
- (set-syntax-table table))))
+ (save-excursion
+ (goto-char (point-min))
+ (let ((table (syntax-table)))
+ (unwind-protect
+ (progn
+ (set-syntax-table mml-syntax-table)
+ (mml-parse-1))
+ (set-syntax-table table)))))
(defun mml-parse-1 ()
"Parse the current buffer as an MML document."
(mm-find-mime-charset-region point (point))))
(when (and (not raw) (memq nil charsets))
(if (or (memq 'unknown-encoding mml-confirmation-set)
- (y-or-n-p
- "Message contains characters with unknown encoding. Really send?"))
+ (prog1 (y-or-n-p
+ "\
+Message contains characters with unknown encoding. Really send?")
+ (set (make-local-variable 'mml-confirmation-set)
+ (push 'unknown-encoding mml-confirmation-set))))
(if (setq use-ascii
(or (memq 'use-ascii mml-confirmation-set)
(y-or-n-p "Use ASCII as charset?")))
(when (and warn
(not (memq 'multipart mml-confirmation-set))
(not
- (y-or-n-p
- (format
- "Warning: Your message contains more than %d parts. Really send? "
- (length nstruct)))))
+ (prog1 (y-or-n-p
+ (format
+ "\
+A message part needs to be split into %d charset parts. Really send? "
+ (length nstruct)))
+ (set (make-local-variable 'mml-confirmation-set)
+ (push 'multipart mml-confirmation-set)))))
(error "Edit your message to use only one charset"))
(setq struct (nconc nstruct struct)))))))
(unless (eobp)
(defun mml-read-tag ()
"Read a tag and return the contents."
- (let (contents name elem val)
+ (let ((orig-point (point))
+ contents name elem val)
(forward-char 2)
(setq name (buffer-substring-no-properties
(point) (progn (forward-sexp 1) (point))))
(goto-char (match-end 0))
;; Don't skip the leading space.
;;(skip-chars-forward " \t\n")
+ ;; Put the tag location into the returned contents
+ (setq contents (append (list (cons 'tag-location orig-point)) contents))
(cons (intern name) (nreverse contents))))
(defun mml-read-part (&optional mml)
(with-temp-buffer
(setq charset (mm-charset-to-coding-system
(cdr (assq 'charset cont))))
- (if (eq charset 'ascii) (setq charset nil))
+ (when (eq charset 'ascii)
+ (setq charset nil))
(cond
((cdr (assq 'buffer cont))
(insert-buffer-substring (cdr (assq 'buffer cont))))
;; Remove quotes from quoted tags.
(goto-char (point-min))
(while (re-search-forward
- "<#!+/?\\(part\\|multipart\\|external\\|mml\\)" nil t)
+ "<#!+/?\\(part\\|multipart\\|external\\|mml\\)"
+ nil t)
(delete-region (+ (match-beginning 0) 2)
(+ (match-beginning 0) 3))))))
(cond