[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mml fix still needed
From: |
Dave Love |
Subject: |
mml fix still needed |
Date: |
06 Feb 2002 20:49:48 +0000 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.90 |
mml.el on the release branch hasn't had a fix applied in
mml-generate-mime-1 to avoid encoding problems. I don't follow what's
been done on the development branch.
As far as I remember, I originally had the problem when posting a
non-ASCII attachment with MIME type application/emacs-lisp.
Sorry that's conflated here with whitespace changes and a change to
previewing which probably doesn't count as a bug fix.
2002-02-06 Dave Love <fx@gnu.org>
* mml.el (mml-parse-1, mml-insert-mime-headers): Message fixes.
(mml-generate-mime-1): Use mm-with-unibyte-current-buffer.
(mml-preview): If not raw, use gnus-article mode and suppress the
keymap.
Index: mml.el
===================================================================
RCS file: /cvs/emacs/lisp/gnus/mml.el,v
retrieving revision 1.10
diff -u -p -c -r1.10 mml.el
cvs server: conflicting specifications of output style
*** mml.el 15 Jul 2001 17:42:53 -0000 1.10
--- mml.el 6 Feb 2002 20:39:33 -0000
***************
*** 39,45 ****
(defvar mml-generate-multipart-alist nil
"*Alist of multipart generation functions.
Each entry has the form (NAME . FUNCTION), where
! NAME is a string containing the name of the part (without the
leading \"/multipart/\"),
FUNCTION is a Lisp function which is called to generate the part.
--- 39,45 ----
(defvar mml-generate-multipart-alist nil
"*Alist of multipart generation functions.
Each entry has the form (NAME . FUNCTION), where
! NAME is a string containing the name of the part (without the
leading \"/multipart/\"),
FUNCTION is a Lisp function which is called to generate the part.
*************** one charsets.")
*** 75,81 ****
(defvar mml-generate-mime-preprocess-function nil
"A function called before generating a mime part.
! The function is called with one parameter, which is the part to be
generated.")
(defvar mml-generate-mime-postprocess-function nil
--- 75,81 ----
(defvar mml-generate-mime-preprocess-function nil
"A function called before generating a mime part.
! The function is called with one parameter, which is the part to be
generated.")
(defvar mml-generate-mime-postprocess-function nil
*************** The function is called with one paramete
*** 86,92 ****
(defvar mml-buffer-list nil)
! (defun mml-generate-new-buffer (name)
(let ((buf (generate-new-buffer name)))
(push buf mml-buffer-list)
buf))
--- 86,92 ----
(defvar mml-buffer-list nil)
! (defun mml-generate-new-buffer (name)
(let ((buf (generate-new-buffer name)))
(push buf mml-buffer-list)
buf))
*************** The function is called with one paramete
*** 128,145 ****
(setq raw (cdr (assq 'raw tag))
point (point)
contents (mml-read-part (eq 'mml (car tag)))
! charsets (if raw nil
(mm-find-mime-charset-region point (point))))
(when (and (not raw) (memq nil charsets))
(if (or (memq 'unknown-encoding mml-confirmation-set)
(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?")))
(setq charsets (delq nil charsets))
(setq warn nil))
(error "Edit your message to remove those characters")))
--- 128,145 ----
(setq raw (cdr (assq 'raw tag))
point (point)
contents (mml-read-part (eq 'mml (car tag)))
! charsets (if raw nil
(mm-find-mime-charset-region point (point))))
(when (and (not raw) (memq nil charsets))
(if (or (memq 'unknown-encoding mml-confirmation-set)
(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? ")))
(setq charsets (delq nil charsets))
(setq warn nil))
(error "Edit your message to remove those characters")))
*************** A message part needs to be split into %d
*** 169,175 ****
(forward-line 1))
(nreverse struct)))
! (defun mml-parse-singlepart-with-multiple-charsets
(orig-tag beg end &optional use-ascii)
(save-excursion
(save-restriction
--- 169,175 ----
(forward-line 1))
(nreverse struct)))
! (defun mml-parse-singlepart-with-multiple-charsets
(orig-tag beg end &optional use-ascii)
(save-excursion
(save-restriction
*************** If MML is non-nil, return the buffer up
*** 261,267 ****
(if (re-search-forward "<#\\(/\\)?mml." nil t)
(setq count (+ count (if (match-beginning 1) -1 1)))
(goto-char (point-max))))
! (buffer-substring-no-properties beg (if (> count 0)
(point)
(match-beginning 0))))
(if (re-search-forward
--- 261,267 ----
(if (re-search-forward "<#\\(/\\)?mml." nil t)
(setq count (+ count (if (match-beginning 1) -1 1)))
(goto-char (point-max))))
! (buffer-substring-no-properties beg (if (> count 0)
(point)
(match-beginning 0))))
(if (re-search-forward
*************** If MML is non-nil, return the buffer up
*** 324,330 ****
"<#!+/?\\(part\\|multipart\\|external\\|mml\\)" nil t)
(delete-region (+ (match-beginning 0) 2)
(+ (match-beginning 0) 3))))))
! (cond
((eq (car cont) 'mml)
(let ((mml-boundary (funcall mml-boundary-function
(incf mml-multipart-number)))
--- 324,330 ----
"<#!+/?\\(part\\|multipart\\|external\\|mml\\)" nil t)
(delete-region (+ (match-beginning 0) 2)
(+ (match-beginning 0) 3))))))
! (cond
((eq (car cont) 'mml)
(let ((mml-boundary (funcall mml-boundary-function
(incf mml-multipart-number)))
*************** If MML is non-nil, return the buffer up
*** 337,343 ****
(let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
;; ignore 0x1b, it is part of iso-2022-jp
(setq encoding (mm-body-7-or-8))))
! (t
(setq charset (mm-encode-body))
(setq encoding (mm-body-encoding
charset (cdr (assq 'encoding cont))))))
--- 337,343 ----
(let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
;; ignore 0x1b, it is part of iso-2022-jp
(setq encoding (mm-body-7-or-8))))
! (t
(setq charset (mm-encode-body))
(setq encoding (mm-body-encoding
charset (cdr (assq 'encoding cont))))))
*************** If MML is non-nil, return the buffer up
*** 356,362 ****
coded (buffer-string))))
(mml-insert-mime-headers cont type charset encoding)
(insert "\n")
! (insert coded)))
((eq (car cont) 'external)
(insert "Content-Type: message/external-body")
(let ((parameters (mml-parameter-string
--- 356,367 ----
coded (buffer-string))))
(mml-insert-mime-headers cont type charset encoding)
(insert "\n")
! ;; Fixme: I don't see any reason not to insert the text
! ;; directly into this buffer, then insert the header before
! ;; it, rather than using buffer-string of a new buffer above.
! ;; -- fx
! (mm-with-unibyte-current-buffer
! (insert coded))))
((eq (car cont) 'external)
(insert "Content-Type: message/external-body")
(let ((parameters (mml-parameter-string
*************** If MML is non-nil, return the buffer up
*** 378,384 ****
(concat "access-type="
(if (member (nth 0 name) '("ftp@" "anonymous@"))
"anon-ftp"
! "ftp")))))
(when parameters
(mml-insert-parameter-string
cont '(expiration size permission))))
--- 383,389 ----
(concat "access-type="
(if (member (nth 0 name) '("ftp@" "anonymous@"))
"anon-ftp"
! "ftp")))))
(when parameters
(mml-insert-parameter-string
cont '(expiration size permission))))
*************** If MML is non-nil, return the buffer up
*** 463,469 ****
(not (equal type mml-generate-default-type)))
(when (consp charset)
(error
! "Can't encode a part with several charsets."))
(insert "Content-Type: " type)
(when charset
(insert "; " (mail-header-encode-parameter
--- 468,474 ----
(not (equal type mml-generate-default-type)))
(when (consp charset)
(error
! "Can't encode a part with several charsets"))
(insert "Content-Type: " type)
(when charset
(insert "; " (mail-header-encode-parameter
*************** If MML is non-nil, return the buffer up
*** 574,580 ****
(save-excursion
(set-buffer (setq buffer (mml-generate-new-buffer " *mml*")))
(mm-insert-part handle)
! (if (setq mmlp (equal (mm-handle-media-type handle)
"message/rfc822"))
(mime-to-mml)))))
(if mmlp
--- 579,585 ----
(save-excursion
(set-buffer (setq buffer (mml-generate-new-buffer " *mml*")))
(mm-insert-part handle)
! (if (setq mmlp (equal (mm-handle-media-type handle)
"message/rfc822"))
(mime-to-mml)))))
(if mmlp
*************** If MML is non-nil, return the buffer up
*** 583,589 ****
(equal (mm-handle-media-type handle) "text/plain"))
(mml-insert-mml-markup handle buffer textp)))
(cond
! (mmlp
(insert-buffer buffer)
(goto-char (point-max))
(insert "
\n"))
--- 588,594 ----
(equal (mm-handle-media-type handle) "text/plain"))
(mml-insert-mml-markup handle buffer textp)))
(cond
! (mmlp
(insert-buffer buffer)
(goto-char (point-max))
(insert "
\n"))
*************** TYPE is the MIME type to use."
*** 823,834 ****
If RAW, don't highlight the article."
(interactive "P")
(let ((buf (current-buffer))
! (message-posting-charset (or (gnus-setup-posting-charset
(save-restriction
(message-narrow-to-headers-or-head)
(message-fetch-field "Newsgroups")))
message-posting-charset)))
! (switch-to-buffer (get-buffer-create
(concat (if raw "*Raw MIME preview of "
"*MIME preview of ") (buffer-name))))
(erase-buffer)
--- 828,839 ----
If RAW, don't highlight the article."
(interactive "P")
(let ((buf (current-buffer))
! (message-posting-charset (or (gnus-setup-posting-charset
(save-restriction
(message-narrow-to-headers-or-head)
(message-fetch-field "Newsgroups")))
message-posting-charset)))
! (switch-to-buffer (get-buffer-create
(concat (if raw "*Raw MIME preview of "
"*MIME preview of ") (buffer-name))))
(erase-buffer)
*************** If RAW, don't highlight the article."
*** 843,854 ****
;; Insert the content into unibyte buffer.
(erase-buffer)
(mm-disable-multibyte)
(insert s)))
(let ((gnus-newsgroup-charset (car message-posting-charset)))
(run-hooks 'gnus-article-decode-hook)
(let ((gnus-newsgroup-name "dummy"))
(gnus-article-prepare-display))))
- (fundamental-mode)
(setq buffer-read-only t)
(goto-char (point-min))))
--- 848,866 ----
;; Insert the content into unibyte buffer.
(erase-buffer)
(mm-disable-multibyte)
+ (fundamental-mode)
(insert s)))
(let ((gnus-newsgroup-charset (car message-posting-charset)))
+ (gnus-article-mode)
+ (use-local-map
+ (let ((map (make-sparse-keymap)))
+ (gnus-suppress-keymap map)
+ (set-keymap-parent map widget-keymap)
+ (define-key map "q" 'kill-this-buffer) ; more?
+ map))
(run-hooks 'gnus-article-decode-hook)
(let ((gnus-newsgroup-name "dummy"))
(gnus-article-prepare-display))))
(setq buffer-read-only t)
(goto-char (point-min))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- mml fix still needed,
Dave Love <=