diff -Nru flim-1.14.9+0.20120428/debian/changelog flim-1.14.9+0.20120428/debian/changelog --- flim-1.14.9+0.20120428/debian/changelog 2014-06-27 22:10:36.000000000 +0000 +++ flim-1.14.9+0.20120428/debian/changelog 2014-09-16 14:04:47.000000000 +0000 @@ -1,3 +1,10 @@ +flim (1:1.14.9+0.20120428-9) unstable; urgency=medium + + * Sync 010_flim-1_14-wl.patch on 2014-09-15 + - Workaround to handle '%s' in /etc/mailcap (closes: #572993) + + -- Tatsuya Kinoshita Tue, 16 Sep 2014 23:03:24 +0900 + flim (1:1.14.9+0.20120428-8) unstable; urgency=medium * Sync 010_flim-1_14-wl.patch on 2014-06-26 diff -Nru flim-1.14.9+0.20120428/debian/patches/010_flim-1_14-wl.patch flim-1.14.9+0.20120428/debian/patches/010_flim-1_14-wl.patch --- flim-1.14.9+0.20120428/debian/patches/010_flim-1_14-wl.patch 2014-06-26 00:09:26.000000000 +0000 +++ flim-1.14.9+0.20120428/debian/patches/010_flim-1_14-wl.patch 2014-09-15 15:08:38.000000000 +0000 @@ -2,10 +2,51 @@ Origin: https://github.com/wanderlust/flim/commits/flim-1_14-wl diff --git a/ChangeLog b/ChangeLog -index fd529ed..db9eef4 100644 +index fd529ed..b4cfff9 100644 --- a/ChangeLog +++ b/ChangeLog -@@ -1,3 +1,138 @@ +@@ -1,3 +1,179 @@ ++2014-09-15 Kazuhiro Ito ++ ++ * mime-conf.el (mime-format-mailcap-command): Minor refactoring. ++ ++2014-09-13 Erik Hetzner ++ ++ * mime-conf.el (mime-format-mailcap-command): Add quotes for ++ quoted file name to unquote. ++ Cf. https://github.com/wanderlust/flim/pull/3 ++ ++2014-08-31 Kazuhiro Ito ++ ++ * mime-parse.el (mime-decode-parameter-value) ++ (mime-decode-parameters): Use string-to-number instead of ++ string-to-int. ++ ++2014-08-31 Kazuhiro Ito ++ ++ * eword-encode.el (eword-encode-char-type): Defined as macro. ++ ++2014-08-31 Kazuhiro Ito ++ ++ * lunit.el (lunit-generate-template): Use `with-current-buffer' ++ rather than save-excursion+set-buffer. ++ ++ * mmbuffer.el (initialize-instance, mime-write-entity) ++ (mime-entity-body, mime-write-entity-body, mime-entity-content) ++ (mime-write-entity-content, mime-entity-fetch-field): Likewise. ++ ++ * mmcooked.el (write-entity-content, write-entity) ++ (write-entity-body): Likewise. ++ ++ * mmgeneric.el (mime-insert-header-from-buffer): Likewise. ++ ++ * qmtp.el (qmtp-send-buffer): Likewise. ++ ++ * smtp.el (smtp-package-buffer-internal-size, smtp-send-buffer) ++ (smtp-send-buffer-by-myself, smtp-primitive-data) ++ (smtp-process-filter, smtp-send-command) ++ (smtp-deduce-address-list): Likewise. ++ +2014-06-20 Kazuhiro Ito + + Un-encoded garbage handling is available when built-in base64 @@ -144,7 +185,7 @@ 2012-04-28 MORIOKA Tomohiko * README.ja, README.en (Bug reports): Use "Emacs-MIME" instead of -@@ -12,6 +147,94 @@ +@@ -12,6 +188,94 @@ * README.ja, README.en (Bug reports): Modify for emacs-mime-{en|ja}@lists.chise.org. @@ -239,7 +280,7 @@ 2010-08-05 Tetsurou Okazaki * smtp.el (smtp-submit-package): Handle the case that -@@ -25,17 +248,26 @@ +@@ -25,17 +289,26 @@ 2010-03-10 Kazuhiro Ito * mel-q-ccl.el (quoted-printable-ccl-decode-string) @@ -269,7 +310,7 @@ 2010-02-18 Kazuhiro Ito * mel-q-ccl.el (quoted-printable-ccl-encode-string) -@@ -64,6 +296,9 @@ +@@ -64,6 +337,9 @@ 2010-01-24 Kazuhiro Ito @@ -279,7 +320,7 @@ * mel-q.el (quoted-printable-quote-char) (quoted-printable-internal-encode-region): Support Emacs 23 raw-byte characters in multibyte string. -@@ -97,7 +332,7 @@ +@@ -97,7 +373,7 @@ 2007-11-28 MORIOKA Tomohiko @@ -288,7 +329,7 @@ 2006-12-20 MORIOKA Tomohiko -@@ -183,7 +418,7 @@ +@@ -183,7 +459,7 @@ 2005-12-25 MORIOKA Tomohiko @@ -297,7 +338,7 @@ 2005-12-25 MORIOKA Tomohiko -@@ -208,7 +443,7 @@ +@@ -208,7 +484,7 @@ 2004-10-01 MORIOKA Tomohiko @@ -306,7 +347,7 @@ 2004-10-01 MORIOKA Tomohiko -@@ -496,7 +731,7 @@ +@@ -496,7 +772,7 @@ 2002-06-03 MORIOKA Tomohiko @@ -315,7 +356,7 @@ 2002-01-16 Hiroya Murata -@@ -547,7 +782,7 @@ +@@ -547,7 +823,7 @@ 2001-06-01 MORIOKA Tomohiko @@ -324,7 +365,7 @@ 2001-06-01 Katsumi Yamaoka -@@ -1609,7 +1844,7 @@ +@@ -1609,7 +1885,7 @@ 2000-07-12 MORIOKA Tomohiko @@ -333,7 +374,7 @@ 2000-07-10 MORIOKA Tomohiko -@@ -2227,7 +2462,7 @@ +@@ -2227,7 +2503,7 @@ 1999-05-31 MORIOKA Tomohiko @@ -342,7 +383,7 @@ 1999-05-31 MORIOKA Tomohiko -@@ -2402,7 +2637,7 @@ +@@ -2402,7 +2678,7 @@ 1999-05-11 MORIOKA Tomohiko @@ -351,7 +392,7 @@ 1999-04-27 Shuhei KOBAYASHI -@@ -2519,7 +2754,7 @@ +@@ -2519,7 +2795,7 @@ 1999-01-23 MORIOKA Tomohiko @@ -360,7 +401,7 @@ 1999-01-23 MORIOKA Tomohiko -@@ -2562,7 +2797,7 @@ +@@ -2562,7 +2838,7 @@ 1999-01-21 MORIOKA Tomohiko @@ -369,7 +410,7 @@ 1999-01-16 MORIOKA Tomohiko -@@ -2748,7 +2983,7 @@ +@@ -2748,7 +3024,7 @@ 1998-12-02 MORIOKA Tomohiko @@ -378,7 +419,7 @@ 1998-11-30 MORIOKA Tomohiko -@@ -2966,7 +3201,7 @@ +@@ -2966,7 +3242,7 @@ 1998-10-26 MORIOKA Tomohiko @@ -387,7 +428,7 @@ * NEWS (Abolish variable `mime-temp-directory'): New subsection. -@@ -3246,7 +3481,7 @@ +@@ -3246,7 +3522,7 @@ 1998-10-12 MORIOKA Tomohiko @@ -396,7 +437,7 @@ 1998-10-12 Katsumi Yamaoka -@@ -3431,7 +3666,7 @@ +@@ -3431,7 +3707,7 @@ 1998-09-29 MORIOKA Tomohiko @@ -405,7 +446,7 @@ * README.en (What's FLIM): Add mel-ccl.el. -@@ -3718,7 +3953,7 @@ +@@ -3718,7 +3994,7 @@ 1998-08-31 MORIOKA Tomohiko @@ -414,7 +455,7 @@ * mime-en.sgml (mm-backend): Translate a little. -@@ -3861,7 +4096,7 @@ +@@ -3861,7 +4137,7 @@ 1998-07-07 MORIOKA Tomohiko @@ -423,7 +464,7 @@ 1998-07-07 MORIOKA Tomohiko -@@ -3973,7 +4208,7 @@ +@@ -3973,7 +4249,7 @@ 1998-07-01 MORIOKA Tomohiko @@ -432,7 +473,7 @@ * README.en: Delete `How to use'. -@@ -4098,7 +4333,7 @@ +@@ -4098,7 +4374,7 @@ 1998-06-28 MORIOKA Tomohiko @@ -441,7 +482,7 @@ 1998-06-26 MORIOKA Tomohiko -@@ -4357,7 +4592,7 @@ +@@ -4357,7 +4633,7 @@ 1998-06-19 MORIOKA Tomohiko @@ -450,7 +491,7 @@ 1998-06-18 MORIOKA Tomohiko -@@ -4477,7 +4712,7 @@ +@@ -4477,7 +4753,7 @@ 1998-05-06 MORIOKA Tomohiko @@ -459,7 +500,7 @@ * README.en (What's FLIM): Delete description about std11-parse.el; add description about mailcap.el. -@@ -4528,7 +4763,7 @@ +@@ -4528,7 +4804,7 @@ 1998-05-05 MORIOKA Tomohiko @@ -468,7 +509,7 @@ 1998-05-04 MORIOKA Tomohiko -@@ -4564,7 +4799,7 @@ +@@ -4564,7 +4840,7 @@ 1998-04-17 MORIOKA Tomohiko @@ -597,7 +638,7 @@ default-mime-charset)) ;;(substring string end) diff --git a/eword-encode.el b/eword-encode.el -index 1efb97d..d34aad7 100644 +index 1efb97d..2c5aadc 100644 --- a/eword-encode.el +++ b/eword-encode.el @@ -74,6 +74,8 @@ @@ -609,17 +650,32 @@ (eword-encode-unstructured-field-body))) ;;; @ encoded-text encoder -@@ -95,6 +97,9 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is +@@ -95,12 +97,20 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is ;;; @ charset word ;;; +-(defsubst eword-encode-char-type (character) +- (if (memq character '(? ?\t ?\n)) +- nil +- (char-charset character) ++(eval-when-compile ++ (unless (and (boundp 'mule-version) ++ (null (string< mule-version "6.0")) ++ (fboundp 'detect-mime-charset-string)) ++ (defmacro eword-encode-char-type (character) ++ `(if (memq ,character '(? ?\t ?\n)) ++ nil ++ (char-charset ,character) ++ )) + )) + +(unless (and (boundp 'mule-version) + (null (string< mule-version "6.0")) + (fboundp 'detect-mime-charset-string)) - (defsubst eword-encode-char-type (character) - (if (memq character '(? ?\t ?\n)) - nil -@@ -122,11 +127,15 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is + (defun eword-encode-divide-into-charset-words (string) + (let ((len (length string)) + dest) +@@ -122,11 +132,15 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is string (substring string i) len (- len i)))) (nreverse dest))) @@ -635,7 +691,7 @@ (defun eword-encode-charset-words-to-words (charset-words) (let (dest) (while charset-words -@@ -156,22 +165,26 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is +@@ -156,22 +170,26 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is )))) (nreverse dest) )) @@ -667,7 +723,7 @@ (defun ew-find-charset-rule (charsets) (if charsets (let* ((charset (find-mime-charset-by-charsets charsets)) -@@ -179,11 +192,27 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is +@@ -179,11 +197,27 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (cdr (or (assq charset mime-header-charset-encoding-alist) (cons charset mime-header-default-charset-encoding))))) (list charset encoding)))) @@ -696,7 +752,7 @@ ;; for CHISE Architecture (defun tm-eword::words-to-ruled-words (wl &optional mode) (let (mcs) -@@ -198,7 +227,15 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is +@@ -198,7 +232,15 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is mode) )) wl))) @@ -712,7 +768,7 @@ ;; for legacy Mule (defun tm-eword::words-to-ruled-words (wl &optional mode) (mapcar (function -@@ -207,6 +244,46 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is +@@ -207,6 +249,46 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (make-ew-rword (cdr word) (car ret)(nth 1 ret) mode) ))) wl)) @@ -759,7 +815,7 @@ ) (defun ew-space-process (seq) -@@ -246,11 +323,7 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is +@@ -246,11 +328,7 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is )) (defun eword-encode-split-string (str &optional mode) @@ -772,7 +828,7 @@ ;;; @ length -@@ -263,11 +336,11 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is +@@ -263,11 +341,11 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is ret) (setq ret (cond ((string-equal encoding "B") @@ -786,7 +842,7 @@ (Q-encoded-text-length string (ew-rword-type rword)) ))) (if ret -@@ -410,8 +483,7 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is +@@ -410,8 +488,7 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (setq dest (append dest (list @@ -796,7 +852,7 @@ (make-ew-rword str (car ret)(nth 1 ret) 'phrase) ) -@@ -421,22 +493,16 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is +@@ -421,22 +498,16 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (setq dest (append dest '(("(" nil nil special)) @@ -823,7 +879,7 @@ )) (setq phrase (cdr phrase)) ) -@@ -630,6 +696,84 @@ Optional argument COLUMN is start-position of the field." +@@ -630,6 +701,84 @@ Optional argument COLUMN is start-position of the field." (or column eword-encode-default-start-column) (eword-encode-split-string string 'text)))) @@ -1093,6 +1149,20 @@ (defun sha1-binary (string) "Return the SHA1 of STRING in binary form." (decode-hex-string (sha1 string))))) +diff --git a/lunit.el b/lunit.el +index 0d5749a..6591941 100644 +--- a/lunit.el ++++ b/lunit.el +@@ -301,8 +301,7 @@ TESTS holds a number of instances of `lunit-test'." + + (defun lunit-generate-template (file) + (interactive "fGenerate lunit template for: ") +- (save-excursion +- (set-buffer (find-file-noselect file)) ++ (with-current-buffer (find-file-noselect file) + (let ((index-alist + (lunit-create-index-function))) + (with-output-to-temp-buffer "*Lunit template*" diff --git a/mailcap.el b/mailcap.el deleted file mode 100644 index a2c40ae..0000000 @@ -1506,6 +1576,118 @@ (write-region-as-binary (point-min) (point-max) filename)))) ;; (mel-define-method-function (encoded-text-encode-string string (nil "B")) +diff --git a/mime-conf.el b/mime-conf.el +index 67f613b..7bb858a 100644 +--- a/mime-conf.el ++++ b/mime-conf.el +@@ -213,56 +213,57 @@ may be: + dest) + (while (< i len) + (let ((chr (aref mtext i))) +- (cond ((eq chr ?%) +- (setq i (1+ i) +- chr (aref mtext i)) +- (cond ((eq chr ?s) +- (let ((file (cdr (assq 'filename situation)))) +- (if (null file) +- (error "'filename is not specified in situation.") +- (setq dest (concat dest +- (substring mtext p (1- i)) +- (shell-quote-argument file)) +- i (1+ i) +- p i) +- ))) +- ((eq chr ?t) +- (let ((type (or (mime-type/subtype-string +- (cdr (assq 'type situation)) +- (cdr (assq 'subtype situation))) +- "text/plain"))) +- (setq dest (concat dest +- (substring mtext p (1- i)) +- type) +- i (1+ i) +- p i) +- )) +- ((eq chr ?\{) +- (setq i (1+ i)) +- (if (not (string-match "}" mtext i)) +- (error "parse error!!!") +- (let* ((me (match-end 0)) +- (attribute (substring mtext i (1- me))) +- (parameter (cdr (assoc attribute situation)))) +- (if (null parameter) +- (error "\"%s\" is not specified in situation." +- attribute) +- (setq dest (concat dest +- (substring mtext p (- i 2)) +- parameter) +- i me +- p i) +- ) +- ))) +- (t (error "Invalid sequence `%%%c'." chr)) +- )) +- ((eq chr ?\\) +- (setq dest (concat dest (substring mtext p i)) +- p (1+ i) +- i (+ i 2)) +- ) +- (t (setq i (1+ i))) +- ))) ++ (cond ++ ((eq chr ?%) ++ (setq i (1+ i) ++ chr (aref mtext i)) ++ (cond ++ ((eq chr ?s) ++ (let ((file (cdr (assq 'filename situation)))) ++ (if file ++ (setq file (shell-quote-argument file)) ++ (error "'filename is not specified in situation.")) ++ (setq dest (concat dest ++ (substring mtext p (1- i)) ++ ;; if the situation (wrongly) quotes ++ ;; the argument, fix it. ++ (if (eq ?' (aref mtext (- i 2))) ++ (concat "'" file "'") ++ file)) ++ i (1+ i) ++ p i) ++ )) ++ ((eq chr ?t) ++ (let ((type (or (mime-type/subtype-string ++ (cdr (assq 'type situation)) ++ (cdr (assq 'subtype situation))) ++ "text/plain"))) ++ (setq dest (concat dest (substring mtext p (1- i)) type) ++ i (1+ i) ++ p i) ++ )) ++ ((eq chr ?\{) ++ (setq i (1+ i)) ++ (unless (string-match "}" mtext i) ++ (error "parse error!!!")) ++ (let* ((me (match-end 0)) ++ (attribute (substring mtext i (1- me))) ++ (parameter (cdr (assoc attribute situation)))) ++ (unless parameter ++ (error "\"%s\" is not specified in situation." attribute)) ++ (setq dest (concat dest (substring mtext p (- i 2)) parameter) ++ i me ++ p i) ++ )) ++ (t (error "Invalid sequence `%%%c'." chr)) ++ )) ++ ((eq chr ?\\) ++ (setq dest (concat dest (substring mtext p i)) ++ p (1+ i) ++ i (+ i 2)) ++ ) ++ (t (setq i (1+ i))) ++ ))) + (concat dest (substring mtext p)) + )) + diff --git a/mime-def.el b/mime-def.el index 9ee7781..131b25a 100644 --- a/mime-def.el @@ -1575,10 +1757,17 @@ ;;; @ end ;;; diff --git a/mime-parse.el b/mime-parse.el -index 5f34c07..87cc1a5 100644 +index 5f34c07..b36eba3 100644 --- a/mime-parse.el +++ b/mime-parse.el -@@ -103,11 +103,7 @@ be the result." +@@ -97,17 +97,13 @@ be the result." + (insert text) + (goto-char (point-min)) + (while (re-search-forward "%[0-9A-Fa-f][0-9A-Fa-f]" nil t) +- (insert (prog1 (string-to-int ++ (insert (prog1 (string-to-number + (buffer-substring (point)(- (point) 2)) + 16) (delete-region (point)(- (point) 3))))) (setq text (buffer-string)) (when charset @@ -1591,6 +1780,15 @@ (when language (put-text-property 0 (length text) 'mime-language language text)) text)) +@@ -147,7 +143,7 @@ property of the decoded-value." + (let* ((attribute (downcase + (substring (car params) 0 (match-end 1)))) + (section (if (match-beginning 2) +- (string-to-int ++ (string-to-number + (substring (car params) + (1+ (match-beginning 2)) + (match-end 2))) @@ -239,6 +235,207 @@ property of the decoded-value." (defalias 'mime-parse-parameters-from-list 'mime-decode-parameters) (make-obsolete 'mime-parse-parameters-from-list 'mime-decode-parameters) @@ -1858,6 +2056,144 @@ (defsubst mime-entity-media-type (entity) +diff --git a/mmbuffer.el b/mmbuffer.el +index c605a59..fb2acd4 100644 +--- a/mmbuffer.el ++++ b/mmbuffer.el +@@ -43,8 +43,7 @@ + (or (mime-buffer-entity-buffer-internal entity) + (mime-buffer-entity-set-buffer-internal + entity (get-buffer (mime-entity-location-internal entity)))) +- (save-excursion +- (set-buffer (mime-buffer-entity-buffer-internal entity)) ++ (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (let ((header-start + (or (mime-buffer-entity-header-start-internal entity) + (mime-buffer-entity-set-header-start-internal +@@ -94,8 +93,7 @@ + ) + + (luna-define-method mime-write-entity ((entity mime-buffer-entity) filename) +- (save-excursion +- (set-buffer (mime-buffer-entity-buffer-internal entity)) ++ (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (let ((coding-system-for-write 'raw-text-dos)) + (write-region (mime-buffer-entity-header-start-internal entity) + (mime-buffer-entity-body-end-internal entity) +@@ -110,8 +108,7 @@ + ;;; + + (luna-define-method mime-entity-body ((entity mime-buffer-entity)) +- (save-excursion +- (set-buffer (mime-buffer-entity-buffer-internal entity)) ++ (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (buffer-substring (mime-buffer-entity-body-start-internal entity) + (mime-buffer-entity-body-end-internal entity)))) + +@@ -123,8 +120,7 @@ + + (luna-define-method mime-write-entity-body ((entity mime-buffer-entity) + filename) +- (save-excursion +- (set-buffer (mime-buffer-entity-buffer-internal entity)) ++ (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (binary-write-decoded-region + (mime-buffer-entity-body-start-internal entity) + (mime-buffer-entity-body-end-internal entity) +@@ -135,8 +131,7 @@ + ;;; + + (luna-define-method mime-entity-content ((entity mime-buffer-entity)) +- (save-excursion +- (set-buffer (mime-buffer-entity-buffer-internal entity)) ++ (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (mime-decode-string + (buffer-substring (mime-buffer-entity-body-start-internal entity) + (mime-buffer-entity-body-end-internal entity)) +@@ -151,8 +146,7 @@ + + (luna-define-method mime-write-entity-content ((entity mime-buffer-entity) + filename) +- (save-excursion +- (set-buffer (mime-buffer-entity-buffer-internal entity)) ++ (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (mime-write-decoded-region (mime-buffer-entity-body-start-internal entity) + (mime-buffer-entity-body-end-internal entity) + filename +@@ -166,8 +160,7 @@ + (luna-define-method mime-entity-fetch-field :around + ((entity mime-buffer-entity) field-name) + (or (luna-call-next-method) +- (save-excursion +- (set-buffer (mime-buffer-entity-buffer-internal entity)) ++ (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (save-restriction + (narrow-to-region (mime-buffer-entity-header-start-internal entity) + (mime-buffer-entity-header-end-internal entity)) +diff --git a/mmcooked.el b/mmcooked.el +index c2b3066..b1c1fd1 100644 +--- a/mmcooked.el ++++ b/mmcooked.el +@@ -31,8 +31,7 @@ + (mm-define-method entity-cooked-p ((entity cooked)) t) + + (mm-define-method write-entity-content ((entity cooked) filename) +- (save-excursion +- (set-buffer (mime-buffer-entity-buffer-internal entity)) ++ (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (let ((encoding (or (mime-entity-encoding entity) "7bit"))) + (if (member encoding '("7bit" "8bit" "binary")) + (write-region (mime-buffer-entity-body-start-internal entity) +@@ -44,16 +43,14 @@ + )))) + + (mm-define-method write-entity ((entity cooked) filename) +- (save-excursion +- (set-buffer (mime-buffer-entity-buffer-internal entity)) ++ (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (write-region (mime-buffer-entity-header-start-internal entity) + (mime-buffer-entity-body-end-internal entity) + filename) + )) + + (mm-define-method write-entity-body ((entity cooked) filename) +- (save-excursion +- (set-buffer (mime-buffer-entity-buffer-internal entity)) ++ (with-current-buffer (mime-buffer-entity-buffer-internal entity) + (write-region (mime-buffer-entity-body-start-internal entity) + (mime-buffer-entity-body-end-internal entity) + filename) +diff --git a/mmgeneric.el b/mmgeneric.el +index d215dc6..d4615e9 100644 +--- a/mmgeneric.el ++++ b/mmgeneric.el +@@ -142,8 +142,7 @@ + (mode-obj (mime-find-field-presentation-method 'wide)) + field-decoder + f-b p f-e field-name len field field-body) +- (save-excursion +- (set-buffer buffer) ++ (with-current-buffer buffer + (save-restriction + (narrow-to-region start end) + (goto-char start) +diff --git a/qmtp.el b/qmtp.el +index b1f1072..e7ebd17 100644 +--- a/qmtp.el ++++ b/qmtp.el +@@ -116,10 +116,8 @@ called from `qmtp-via-qmtp' with arguments SENDER and RECIPIENTS.") + + ;;;###autoload + (defun qmtp-send-buffer (sender recipients buffer) +- (save-excursion +- (set-buffer +- (get-buffer-create +- (format "*trace of QMTP session to %s*" qmtp-server))) ++ (with-current-buffer (get-buffer-create ++ (format "*trace of QMTP session to %s*" qmtp-server)) + (buffer-disable-undo) + (erase-buffer) + (make-local-variable 'qmtp-read-point) diff --git a/sasl-cram.el b/sasl-cram.el index caaaa73..8218e5f 100644 --- a/sasl-cram.el @@ -2067,9 +2403,18 @@ (file-exists-p sha1-dl-module)) (require 'sha1-dl)) diff --git a/smtp.el b/smtp.el -index fe511e9..b65aaef 100644 +index fe511e9..2b31272 100644 --- a/smtp.el +++ b/smtp.el +@@ -79,7 +79,7 @@ don't define this value." + :group 'smtp) + + (defcustom smtp-fqdn nil +- "Fully qualified domain name used for Message-ID." ++ "Fully qualified domain name used for SMTP HELO/EHLO." + :type '(choice (const nil) string) + :group 'smtp) + @@ -98,17 +98,15 @@ don't define this value." :type 'boolean :group 'smtp-extensions) @@ -2094,7 +2439,17 @@ :group 'smtp-extensions) (defcustom smtp-use-sasl nil -@@ -276,9 +274,20 @@ Return a newly allocated connection-object. +@@ -186,8 +184,7 @@ BUFFER may be a buffer or a buffer name which contains mail message." + + (defun smtp-package-buffer-internal-size (package) + "Return the size of PACKAGE, an integer." +- (save-excursion +- (set-buffer (smtp-package-buffer-internal package)) ++ (with-current-buffer (smtp-package-buffer-internal package) + (let ((size + (+ (buffer-size) + ;; Add one byte for each change-of-line +@@ -276,9 +273,20 @@ Return a newly allocated connection-object. BUFFER is the buffer to associate with the connection. SERVER is name of the host to connect to. SERVICE is name of the service desired." (let ((process @@ -2117,7 +2472,7 @@ (when process (setq connection (smtp-make-connection process server service)) (set-process-filter process 'smtp-process-filter) -@@ -357,13 +366,7 @@ BUFFER may be a buffer or a buffer name which contains mail message." +@@ -357,17 +365,9 @@ BUFFER may be a buffer or a buffer name which contains mail message." (or smtp-server (error "`smtp-server' not defined")))) (package @@ -2128,11 +2483,17 @@ - (if smtp-use-starttls - #'starttls-open-stream - smtp-open-connection-function))) +- (save-excursion +- (set-buffer +- (get-buffer-create +- (format "*trace of SMTP session to %s*" server))) + (smtp-make-package sender recipients buffer))) - (save-excursion - (set-buffer - (get-buffer-create -@@ -384,7 +387,7 @@ BUFFER may be a buffer or a buffer name which contains mail message." ++ (with-current-buffer (get-buffer-create ++ (format "*trace of SMTP session to %s*" server)) + (erase-buffer) + (buffer-disable-undo) + (unless (smtp-find-connection (current-buffer)) +@@ -384,7 +384,7 @@ BUFFER may be a buffer or a buffer name which contains mail message." (smtp-primitive-ehlo package) (smtp-response-error (smtp-primitive-helo package))) @@ -2141,7 +2502,7 @@ (if (assq 'starttls (smtp-connection-extensions-internal (smtp-find-connection (current-buffer)))) -@@ -412,10 +415,6 @@ RECIPIENTS is a list of envelope recipient addresses. +@@ -412,10 +412,6 @@ RECIPIENTS is a list of envelope recipient addresses. BUFFER may be a buffer or a buffer name which contains mail message." (let ((servers (smtp-find-server recipients)) @@ -2152,7 +2513,74 @@ server package) (while (car servers) (setq server (caar servers)) -@@ -749,6 +748,20 @@ BUFFER may be a buffer or a buffer name which contains mail message." +@@ -426,10 +422,8 @@ BUFFER may be a buffer or a buffer name which contains mail message." + (mapconcat 'concat recipients ">,<")))) + (setq package + (smtp-make-package sender recipients buffer)) +- (save-excursion +- (set-buffer +- (get-buffer-create +- (format "*trace of SMTP session to %s*" server))) ++ (with-current-buffer (get-buffer-create ++ (format "*trace of SMTP session to %s*" server)) + (erase-buffer) + (buffer-disable-undo) + (unless (smtp-find-connection (current-buffer)) +@@ -590,8 +584,7 @@ BUFFER may be a buffer or a buffer name which contains mail message." + (setq response (smtp-read-response connection)) + (if (/= (car response) 354) + (smtp-response-error response)) +- (save-excursion +- (set-buffer (smtp-package-buffer-internal package)) ++ (with-current-buffer (smtp-package-buffer-internal package) + (goto-char (point-min)) + (while (not (eobp)) + (smtp-send-data +@@ -614,8 +607,7 @@ BUFFER may be a buffer or a buffer name which contains mail message." + ;;; @ low level process manipulating function + ;;; + (defun smtp-process-filter (process output) +- (save-excursion +- (set-buffer (process-buffer process)) ++ (with-current-buffer (process-buffer process) + (goto-char (point-max)) + (insert output))) + +@@ -663,12 +655,11 @@ BUFFER may be a buffer or a buffer name which contains mail message." + response)) + + (defun smtp-send-command (connection command) +- (save-excursion +- (let ((process +- (smtp-connection-process-internal connection)) +- (encoder +- (smtp-connection-encoder-internal connection))) +- (set-buffer (process-buffer process)) ++ (let ((process ++ (smtp-connection-process-internal connection)) ++ (encoder ++ (smtp-connection-encoder-internal connection))) ++ (with-current-buffer (process-buffer process) + (goto-char (point-max)) + (setq command (concat command "\r\n")) + (insert command) +@@ -698,13 +689,10 @@ BUFFER may be a buffer or a buffer name which contains mail message." + addr-regexp + (smtp-address-buffer (generate-new-buffer " *smtp-mail*"))) + (unwind-protect +- (save-excursion +- ;; +- (set-buffer smtp-address-buffer) ++ (with-current-buffer smtp-address-buffer + (setq case-fold-search t) + (erase-buffer) +- (insert (save-excursion +- (set-buffer smtp-text-buffer) ++ (insert (with-current-buffer smtp-text-buffer + (buffer-substring-no-properties header-start header-end))) + (goto-char (point-min)) + ;; RESENT-* fields should stop processing of regular fields. +@@ -749,6 +737,20 @@ BUFFER may be a buffer or a buffer name which contains mail message." recipient-address-list)) (kill-buffer smtp-address-buffer))))