From 55514c966f65aa4806bc74c750630a14743b88bd Mon Sep 17 00:00:00 2001 From: hmurata Date: Sun, 27 Feb 2005 07:52:31 +0000 Subject: [PATCH] * wl-summary.el (wl-summary-edit-addresses-collect-candidate-fields): Use `elmo-with-enable-multibyte' instead of `elmo-set-work-buf'. * wl-draft.el (wl-draft-yank-original): Use `with-temp-buffer' instead of `elmo-set-work-buf'. * wl-address.el (wl-address-make-alist-from-alias-file): Ditto. (wl-address-make-address-list): Ditto. * elmo-util.el (elmo-with-enable-multibyte): Don't bind `default-enable-multibyte-characters'. (elmo-object-load): Use `with-temp-buffer' instead of `elmo-set-work-buf'. (elmo-object-save): Ditto. (elmo-mime-string): Use `elmo-with-enable-multibyte' instead of `elmo-set-work-buf'. (elmo-decoded-field-body): Ditto. * elmo-shimbun.el (elmo-shimbun-entity-to-header): Ditto. * elmo-sendlog.el (elmo-sendlog-folder-list-message-locations): Use `with-temp-buffer' instead of `elmo-set-work-buf'. --- elmo/ChangeLog | 14 +++++++++++ elmo/elmo-sendlog.el | 22 ++++++++--------- elmo/elmo-shimbun.el | 31 ++++++++++++------------ elmo/elmo-util.el | 64 +++++++++++++++++++++++--------------------------- wl/ChangeLog | 10 ++++++++ wl/wl-address.el | 36 ++++++++++++++-------------- wl/wl-draft.el | 15 ++++++------ wl/wl-summary.el | 23 +++++++++--------- 8 files changed, 116 insertions(+), 99 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index c521823..05bc91b 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,19 @@ 2005-02-27 Hiroya Murata + * elmo-util.el (elmo-with-enable-multibyte): Don't bind + `default-enable-multibyte-characters'. + (elmo-object-load): Use `with-temp-buffer' instead of + `elmo-set-work-buf'. + (elmo-object-save): Ditto. + (elmo-mime-string): Use `elmo-with-enable-multibyte' instead of + `elmo-set-work-buf'. + (elmo-decoded-field-body): Ditto. + + * elmo-shimbun.el (elmo-shimbun-entity-to-header): Ditto. + + * elmo-sendlog.el (elmo-sendlog-folder-list-message-locations): + Use `with-temp-buffer' instead of `elmo-set-work-buf'. + * elmo-version.el (elmo-version): Up to 2.13.3. 2005-02-27 Tetsurou Okazaki diff --git a/elmo/elmo-sendlog.el b/elmo/elmo-sendlog.el index 4187f7f..ce01c2b 100644 --- a/elmo/elmo-sendlog.el +++ b/elmo/elmo-sendlog.el @@ -59,17 +59,17 @@ result) (if (not (file-readable-p filename)) nil - (elmo-set-work-buf - (as-binary-input-file - (insert-file-contents filename)) - (goto-char (point-min)) - (catch 'done - (while t - (re-search-forward "id=\\([^@]+@[^@]+\\)$" (point-at-eol) t) - (setq result (append result (list (match-string 1)))) - (if (eq (1+ (point-at-eol)) (point-max)) - (throw 'done nil) - (beginning-of-line 2)))))) + (with-temp-buffer + (as-binary-input-file + (insert-file-contents filename)) + (goto-char (point-min)) + (catch 'done + (while t + (re-search-forward "id=\\([^@]+@[^@]+\\)$" (point-at-eol) t) + (setq result (append result (list (match-string 1)))) + (if (eq (1+ (point-at-eol)) (point-max)) + (throw 'done nil) + (beginning-of-line 2)))))) result)) (luna-define-method elmo-folder-message-file-p ((folder elmo-sendlog-folder)) diff --git a/elmo/elmo-shimbun.el b/elmo/elmo-shimbun.el index 677cbe0..bb5bc88 100644 --- a/elmo/elmo-shimbun.el +++ b/elmo/elmo-shimbun.el @@ -162,22 +162,21 @@ If it is the symbol `all', update overview for all shimbun folders." (setq shimbun-id (elmo-message-entity-field entity 'message-id)) (setq message-id (elmo-message-entity-field entity 'message-id) shimbun-id nil)) - (elmo-set-work-buf - (set-buffer-multibyte t) - (shimbun-make-header - (elmo-message-entity-number entity) - (shimbun-mime-encode-string - (elmo-message-entity-field entity 'subject 'decode)) - (shimbun-mime-encode-string - (elmo-message-entity-field entity 'from 'decode)) - (elmo-message-entity-field entity 'date) - message-id - (elmo-message-entity-field entity 'references) - 0 - 0 - (elmo-message-entity-field entity 'xref) - (and shimbun-id - (list (cons "x-shimbun-id" shimbun-id))))))) + (elmo-with-enable-multibyte + (shimbun-make-header + (elmo-message-entity-number entity) + (shimbun-mime-encode-string + (elmo-message-entity-field entity 'subject 'decode)) + (shimbun-mime-encode-string + (elmo-message-entity-field entity 'from 'decode)) + (elmo-message-entity-field entity 'date) + message-id + (elmo-message-entity-field entity 'references) + 0 + 0 + (elmo-message-entity-field entity 'xref) + (and shimbun-id + (list (cons "x-shimbun-id" shimbun-id))))))) (defsubst elmo-shimbun-folder-header-hash-setup (folder headers) (let ((hash (or (elmo-shimbun-folder-header-hash-internal folder) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 0fc2612..af42a75 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -91,10 +91,9 @@ (defconst elmo-multibyte-buffer-name " *elmo-multibyte-buffer*") (defmacro elmo-with-enable-multibyte (&rest body) - "Evaluate BODY with `enable-multibyte-character' as non-nil." - `(let ((default-enable-multibyte-characters t)) - (with-current-buffer (get-buffer-create elmo-multibyte-buffer-name) - ,@body))) + "Evaluate BODY with `default-enable-multibyte-character'." + `(with-current-buffer (get-buffer-create elmo-multibyte-buffer-name) + ,@body)) (put 'elmo-with-enable-multibyte 'lisp-indent-function 0) (def-edebug-spec elmo-with-enable-multibyte t) @@ -102,21 +101,21 @@ (defun elmo-object-load (filename &optional mime-charset no-err) "Load OBJECT from the file specified by FILENAME. File content is decoded with MIME-CHARSET." - (if (not (file-readable-p filename)) - nil - (elmo-set-work-buf - (as-binary-input-file - (insert-file-contents filename)) - (when mime-charset - (set-buffer-multibyte default-enable-multibyte-characters) - (decode-mime-charset-region (point-min) (point-max) mime-charset)) - (condition-case nil - (read (current-buffer)) - (error (unless no-err - (message "Warning: Loading object from %s failed." - filename) - (elmo-object-save filename nil)) - nil))))) + (if (not (file-readable-p filename)) + nil + (with-temp-buffer + (as-binary-input-file + (insert-file-contents filename)) + (when mime-charset + (set-buffer-multibyte default-enable-multibyte-characters) + (decode-mime-charset-region (point-min) (point-max) mime-charset)) + (condition-case nil + (read (current-buffer)) + (error (unless no-err + (message "Warning: Loading object from %s failed." + filename) + (elmo-object-save filename nil)) + nil))))) (defsubst elmo-save-buffer (filename &optional mime-charset) "Save current buffer to the file specified by FILENAME. @@ -140,11 +139,11 @@ File content is encoded with MIME-CHARSET." "Save OBJECT to the file specified by FILENAME. Directory of the file is created if it doesn't exist. File content is encoded with MIME-CHARSET." - (elmo-set-work-buf - (let (print-length print-level) - (prin1 object (current-buffer))) -;;;(princ "\n" (current-buffer)) - (elmo-save-buffer filename mime-charset))) + (with-temp-buffer + (let (print-length print-level) + (prin1 object (current-buffer))) +;;; (princ "\n" (current-buffer)) + (elmo-save-buffer filename mime-charset))) ;;; Search Condition @@ -987,15 +986,10 @@ Emacs 19.28 or earlier does not have `unintern'." (defsubst elmo-mime-string (string) "Normalize MIME encoded STRING." (and string - (elmo-set-work-buf - (set-buffer-multibyte default-enable-multibyte-characters) - (setq string - (encode-mime-charset-string - (eword-decode-and-unfold-unstructured-field-body - string) - elmo-mime-charset)) - (set-buffer-multibyte nil) - string))) + (elmo-with-enable-multibyte + (encode-mime-charset-string + (eword-decode-and-unfold-unstructured-field-body string) + elmo-mime-charset)))) (defsubst elmo-collect-field (beg end downcase-field-name) (save-excursion @@ -1258,8 +1252,8 @@ SPEC is a list as followed (LABEL MAX-VALUE [FORMAT])." (defun elmo-decoded-field-body (field-name &optional mode) (let ((field-body (elmo-field-body field-name))) (and field-body - (elmo-set-work-buf - (mime-decode-field-body field-body field-name mode))))) + (elmo-with-enable-multibyte + (mime-decode-field-body field-body field-name mode))))) (defun elmo-address-quote-specials (word) "Make quoted string of WORD if needed." diff --git a/wl/ChangeLog b/wl/ChangeLog index 453f432..4e9afcf 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,15 @@ 2005-02-27 Hiroya Murata + * wl-summary.el + (wl-summary-edit-addresses-collect-candidate-fields): Use + `elmo-with-enable-multibyte' instead of `elmo-set-work-buf'. + + * wl-draft.el (wl-draft-yank-original): Use `with-temp-buffer' + instead of `elmo-set-work-buf'. + + * wl-address.el (wl-address-make-alist-from-alias-file): Ditto. + (wl-address-make-address-list): Ditto. + * Version number is increased to 2.13.3. 2005-02-25 Hiroya Murata diff --git a/wl/wl-address.el b/wl/wl-address.el index d539d6b..2d9f845 100644 --- a/wl/wl-address.el +++ b/wl/wl-address.el @@ -524,7 +524,7 @@ Refresh `wl-address-list', `wl-address-completion-list', and (wl-address-expand-aliases alist (1+ nest-count)))))) (defun wl-address-make-alist-from-alias-file (file) - (elmo-set-work-buf + (with-temp-buffer (let ((case-fold-search t) alias expn alist) (insert-file-contents file) @@ -542,23 +542,23 @@ Refresh `wl-address-list', `wl-address-completion-list', and ))) (defun wl-address-make-address-list (path) - (if (and path (file-readable-p path)) - (elmo-set-work-buf - (let (ret - (coding-system-for-read wl-cs-autoconv)) - (insert-file-contents path) - (goto-char (point-min)) - (while (not (eobp)) - (if (looking-at - "^\\([^#\n][^ \t\n]+\\)[ \t]+\\(\".*\"\\)[ \t]+\\(\".*\"\\)[ \t]*.*$") - (setq ret - (cons - (list (wl-match-buffer 1) - (read (wl-match-buffer 2)) - (read (wl-match-buffer 3))) - ret))) - (forward-line)) - (nreverse ret))))) + (when (and path (file-readable-p path)) + (with-temp-buffer + (let (ret + (coding-system-for-read wl-cs-autoconv)) + (insert-file-contents path) + (goto-char (point-min)) + (while (not (eobp)) + (if (looking-at "\ +^\\([^#\n][^ \t\n]+\\)[ \t]+\\(\".*\"\\)[ \t]+\\(\".*\"\\)[ \t]*.*$") + (setq ret + (cons + (list (wl-match-buffer 1) + (read (wl-match-buffer 2)) + (read (wl-match-buffer 3))) + ret))) + (forward-line)) + (nreverse ret))))) (defsubst wl-address-header-extract-address (str) diff --git a/wl/wl-draft.el b/wl/wl-draft.el index a2dd943..d5e6d9d 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -717,13 +717,14 @@ Reply to author if WITH-ARG is non-nil." "Yank original message." (interactive "P") (if arg - (let (buf mail-reply-buffer) - (elmo-set-work-buf - (insert "\n") - (yank) - (setq buf (current-buffer))) - (setq mail-reply-buffer buf) - (wl-draft-yank-from-mail-reply-buffer nil)) + (let ((draft-buffer (current-buffer)) + mail-reply-buffer) + (with-temp-buffer + (insert "\n") + (yank) + (setq mail-reply-buffer (current-buffer)) + (with-current-buffer draft-buffer + (wl-draft-yank-from-mail-reply-buffer nil)))) (wl-draft-yank-current-message-entity))) (defun wl-draft-hide (editing-buffer) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 476b6f7..9275cef 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -1385,18 +1385,17 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (if body (setq candidates (append candidates body))) (setq fields (cdr fields))) (setq candidates (elmo-uniq-list candidates)) - (elmo-set-work-buf - (set-buffer-multibyte default-enable-multibyte-characters) - (mapcar (function - (lambda (x) - (setq components (std11-extract-address-components x)) - (cons (nth 1 components) - (and (car components) - (eword-decode-string - (decode-mime-charset-string - (car components) - mime-charset)))))) - candidates)))) + (elmo-with-enable-multibyte + (mapcar (function + (lambda (x) + (setq components (std11-extract-address-components x)) + (cons (nth 1 components) + (and (car components) + (eword-decode-string + (decode-mime-charset-string + (car components) + mime-charset)))))) + candidates)))) (defun wl-summary-edit-addresses-subr (the-email name-in-addr) ;; returns nil if there's no change. -- 1.7.10.4