comparison lisp/gnus/mml.el @ 49598:0d8b17d428b5

Trailing whitepace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 13:24:35 +0000
parents aa31e3865857
children 695cf19ef79e d7ddb3e565de
comparison
equal deleted inserted replaced
49597:e88404e8f2cf 49598:0d8b17d428b5
37 (autoload 'message-posting-charset "message")) 37 (autoload 'message-posting-charset "message"))
38 38
39 (defvar mml-generate-multipart-alist nil 39 (defvar mml-generate-multipart-alist nil
40 "*Alist of multipart generation functions. 40 "*Alist of multipart generation functions.
41 Each entry has the form (NAME . FUNCTION), where 41 Each entry has the form (NAME . FUNCTION), where
42 NAME is a string containing the name of the part (without the 42 NAME is a string containing the name of the part (without the
43 leading \"/multipart/\"), 43 leading \"/multipart/\"),
44 FUNCTION is a Lisp function which is called to generate the part. 44 FUNCTION is a Lisp function which is called to generate the part.
45 45
46 The Lisp function has to supply the appropriate MIME headers and the 46 The Lisp function has to supply the appropriate MIME headers and the
47 contents of this part.") 47 contents of this part.")
73 with unknown encoding; `multipart': always send messages with more than 73 with unknown encoding; `multipart': always send messages with more than
74 one charsets.") 74 one charsets.")
75 75
76 (defvar mml-generate-mime-preprocess-function nil 76 (defvar mml-generate-mime-preprocess-function nil
77 "A function called before generating a mime part. 77 "A function called before generating a mime part.
78 The function is called with one parameter, which is the part to be 78 The function is called with one parameter, which is the part to be
79 generated.") 79 generated.")
80 80
81 (defvar mml-generate-mime-postprocess-function nil 81 (defvar mml-generate-mime-postprocess-function nil
82 "A function called after generating a mime part. 82 "A function called after generating a mime part.
83 The function is called with one parameter, which is the generated part.") 83 The function is called with one parameter, which is the generated part.")
84 84
85 (defvar mml-generate-default-type "text/plain") 85 (defvar mml-generate-default-type "text/plain")
86 86
87 (defvar mml-buffer-list nil) 87 (defvar mml-buffer-list nil)
88 88
89 (defun mml-generate-new-buffer (name) 89 (defun mml-generate-new-buffer (name)
90 (let ((buf (generate-new-buffer name))) 90 (let ((buf (generate-new-buffer name)))
91 (push buf mml-buffer-list) 91 (push buf mml-buffer-list)
92 buf)) 92 buf))
93 93
94 (defun mml-destroy-buffers () 94 (defun mml-destroy-buffers ()
126 no-markup-p t 126 no-markup-p t
127 warn t)) 127 warn t))
128 (setq raw (cdr (assq 'raw tag)) 128 (setq raw (cdr (assq 'raw tag))
129 point (point) 129 point (point)
130 contents (mml-read-part (eq 'mml (car tag))) 130 contents (mml-read-part (eq 'mml (car tag)))
131 charsets (if raw nil 131 charsets (if raw nil
132 (mm-find-mime-charset-region point (point)))) 132 (mm-find-mime-charset-region point (point))))
133 (when (and (not raw) (memq nil charsets)) 133 (when (and (not raw) (memq nil charsets))
134 (if (or (memq 'unknown-encoding mml-confirmation-set) 134 (if (or (memq 'unknown-encoding mml-confirmation-set)
135 (prog1 (y-or-n-p 135 (prog1 (y-or-n-p
136 "\ 136 "\
137 Message contains characters with unknown encoding. Really send?") 137 Message contains characters with unknown encoding. Really send?")
138 (set (make-local-variable 'mml-confirmation-set) 138 (set (make-local-variable 'mml-confirmation-set)
139 (push 'unknown-encoding mml-confirmation-set)))) 139 (push 'unknown-encoding mml-confirmation-set))))
140 (if (setq use-ascii 140 (if (setq use-ascii
141 (or (memq 'use-ascii mml-confirmation-set) 141 (or (memq 'use-ascii mml-confirmation-set)
142 (y-or-n-p "Use ASCII as charset?"))) 142 (y-or-n-p "Use ASCII as charset?")))
143 (setq charsets (delq nil charsets)) 143 (setq charsets (delq nil charsets))
144 (setq warn nil)) 144 (setq warn nil))
145 (error "Edit your message to remove those characters"))) 145 (error "Edit your message to remove those characters")))
167 (setq struct (nconc nstruct struct))))))) 167 (setq struct (nconc nstruct struct)))))))
168 (unless (eobp) 168 (unless (eobp)
169 (forward-line 1)) 169 (forward-line 1))
170 (nreverse struct))) 170 (nreverse struct)))
171 171
172 (defun mml-parse-singlepart-with-multiple-charsets 172 (defun mml-parse-singlepart-with-multiple-charsets
173 (orig-tag beg end &optional use-ascii) 173 (orig-tag beg end &optional use-ascii)
174 (save-excursion 174 (save-excursion
175 (save-restriction 175 (save-restriction
176 (narrow-to-region beg end) 176 (narrow-to-region beg end)
177 (goto-char (point-min)) 177 (goto-char (point-min))
259 (progn 259 (progn
260 (while (and (> count 0) (not (eobp))) 260 (while (and (> count 0) (not (eobp)))
261 (if (re-search-forward "<#\\(/\\)?mml." nil t) 261 (if (re-search-forward "<#\\(/\\)?mml." nil t)
262 (setq count (+ count (if (match-beginning 1) -1 1))) 262 (setq count (+ count (if (match-beginning 1) -1 1)))
263 (goto-char (point-max)))) 263 (goto-char (point-max))))
264 (buffer-substring-no-properties beg (if (> count 0) 264 (buffer-substring-no-properties beg (if (> count 0)
265 (point) 265 (point)
266 (match-beginning 0)))) 266 (match-beginning 0))))
267 (if (re-search-forward 267 (if (re-search-forward
268 "<#\\(/\\)?\\(multipart\\|part\\|external\\|mml\\)." nil t) 268 "<#\\(/\\)?\\(multipart\\|part\\|external\\|mml\\)." nil t)
269 (prog1 269 (prog1
323 (goto-char (point-min)) 323 (goto-char (point-min))
324 (while (re-search-forward 324 (while (re-search-forward
325 "<#!+/?\\(part\\|multipart\\|external\\|mml\\)" nil t) 325 "<#!+/?\\(part\\|multipart\\|external\\|mml\\)" nil t)
326 (delete-region (+ (match-beginning 0) 2) 326 (delete-region (+ (match-beginning 0) 2)
327 (+ (match-beginning 0) 3)))))) 327 (+ (match-beginning 0) 3))))))
328 (cond 328 (cond
329 ((eq (car cont) 'mml) 329 ((eq (car cont) 'mml)
330 (let ((mml-boundary (funcall mml-boundary-function 330 (let ((mml-boundary (funcall mml-boundary-function
331 (incf mml-multipart-number))) 331 (incf mml-multipart-number)))
332 (mml-generate-default-type "text/plain")) 332 (mml-generate-default-type "text/plain"))
333 (mml-to-mime)) 333 (mml-to-mime))
336 (setq encoding (mm-body-7-or-8)))) 336 (setq encoding (mm-body-7-or-8))))
337 ((string= (car (split-string type "/")) "message") 337 ((string= (car (split-string type "/")) "message")
338 (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b"))) 338 (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b")))
339 ;; ignore 0x1b, it is part of iso-2022-jp 339 ;; ignore 0x1b, it is part of iso-2022-jp
340 (setq encoding (mm-body-7-or-8)))) 340 (setq encoding (mm-body-7-or-8))))
341 (t 341 (t
342 (setq charset (mm-encode-body)) 342 (setq charset (mm-encode-body))
343 (setq encoding (mm-body-encoding 343 (setq encoding (mm-body-encoding
344 charset (cdr (assq 'encoding cont)))))) 344 charset (cdr (assq 'encoding cont))))))
345 (setq coded (buffer-string))) 345 (setq coded (buffer-string)))
346 (mml-insert-mime-headers cont type charset encoding) 346 (mml-insert-mime-headers cont type charset encoding)
577 (unless (stringp (car handle)) 577 (unless (stringp (car handle))
578 (unless (setq textp (equal (mm-handle-media-supertype handle) "text")) 578 (unless (setq textp (equal (mm-handle-media-supertype handle) "text"))
579 (save-excursion 579 (save-excursion
580 (set-buffer (setq buffer (mml-generate-new-buffer " *mml*"))) 580 (set-buffer (setq buffer (mml-generate-new-buffer " *mml*")))
581 (mm-insert-part handle) 581 (mm-insert-part handle)
582 (if (setq mmlp (equal (mm-handle-media-type handle) 582 (if (setq mmlp (equal (mm-handle-media-type handle)
583 "message/rfc822")) 583 "message/rfc822"))
584 (mime-to-mml))))) 584 (mime-to-mml)))))
585 (if mmlp 585 (if mmlp
586 (mml-insert-mml-markup handle nil t t) 586 (mml-insert-mml-markup handle nil t t)
587 (unless (and no-markup 587 (unless (and no-markup
588 (equal (mm-handle-media-type handle) "text/plain")) 588 (equal (mm-handle-media-type handle) "text/plain"))
589 (mml-insert-mml-markup handle buffer textp))) 589 (mml-insert-mml-markup handle buffer textp)))
590 (cond 590 (cond
591 (mmlp 591 (mmlp
592 (insert-buffer buffer) 592 (insert-buffer buffer)
593 (goto-char (point-max)) 593 (goto-char (point-max))
594 (insert "<#/mml>\n")) 594 (insert "<#/mml>\n"))
595 ((stringp (car handle)) 595 ((stringp (car handle))
596 (mapcar 'mml-insert-mime (cdr handle)) 596 (mapcar 'mml-insert-mime (cdr handle))
826 (defun mml-preview (&optional raw) 826 (defun mml-preview (&optional raw)
827 "Display current buffer with Gnus, in a new buffer. 827 "Display current buffer with Gnus, in a new buffer.
828 If RAW, don't highlight the article." 828 If RAW, don't highlight the article."
829 (interactive "P") 829 (interactive "P")
830 (let ((buf (current-buffer)) 830 (let ((buf (current-buffer))
831 (message-posting-charset (or (gnus-setup-posting-charset 831 (message-posting-charset (or (gnus-setup-posting-charset
832 (save-restriction 832 (save-restriction
833 (message-narrow-to-headers-or-head) 833 (message-narrow-to-headers-or-head)
834 (message-fetch-field "Newsgroups"))) 834 (message-fetch-field "Newsgroups")))
835 message-posting-charset))) 835 message-posting-charset)))
836 (switch-to-buffer (get-buffer-create 836 (switch-to-buffer (get-buffer-create
837 (concat (if raw "*Raw MIME preview of " 837 (concat (if raw "*Raw MIME preview of "
838 "*MIME preview of ") (buffer-name)))) 838 "*MIME preview of ") (buffer-name))))
839 (erase-buffer) 839 (erase-buffer)
840 (insert-buffer buf) 840 (insert-buffer buf)
841 (if (re-search-forward 841 (if (re-search-forward