2005-02-27 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+ * 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 <okazaki@be.to>
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))
(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)
(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)
(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.
"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
(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
(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."
2005-02-27 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+ * 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 <lapis-lazuli@pop06.odn.ne.jp>
(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)
)))
(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)
"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)
(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.