X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=wl%2Fwl-summary.el;h=68d13565d212995ac8687fc9df8536f1bc4a3bb1;hb=9e39553b80115a949a7f04ddced4459a7797f8bd;hp=651966c62a1ca064b7618886654c1f736b2f04a4;hpb=77bda77cdad0967d6a175b5b1c89166f7f46ab39;p=elisp%2Fwanderlust.git diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 651966c..68d1356 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -564,6 +564,29 @@ wl-summary-buffer-unread-count unread)) (+ new unread))) +(defun wl-summary-message-string (&optional use-cache) + "Return full body string of current message. +If optional USE-CACHE is non-nil, use cache if exists." + (let ((number (wl-summary-message-number)) + (folder wl-summary-buffer-elmo-folder)) + (if (null number) + (message "No message.") + (elmo-set-work-buf + (elmo-message-fetch folder + number + (elmo-make-fetch-strategy + 'entire + use-cache ; use cache + nil ; save cache (should `t'?) + (and + use-cache + (elmo-file-cache-get-path + (elmo-message-field folder number 'message-id)))) + nil + (current-buffer) + 'unread) + (buffer-string))))) + (defun wl-summary-reedit (&optional arg) "Re-edit current message. If ARG is non-nil, Supersedes message" @@ -578,13 +601,7 @@ If ARG is non-nil, Supersedes message" (mail-position-on-field "Newsgroups") (mail-position-on-field "To")) (delete-other-windows))) - (save-excursion - (let ((mmelmo-force-fetch-entire-message t)) - (if (null (wl-summary-message-number)) - (message "No message.") - (set-buffer (wl-summary-get-original-buffer)) - (wl-draft-edit-string (buffer-substring (point-min) - (point-max))))))))) + (wl-draft-edit-string (wl-summary-message-string))))) (defun wl-summary-resend-bounced-mail () "Re-mail the current message. @@ -593,37 +610,36 @@ contains some mail you have written but has been bounced back to you." (interactive) (save-excursion - (let ((mmelmo-force-fetch-entire-message t)) - (wl-summary-set-message-buffer-or-redisplay) - (set-buffer (wl-message-get-original-buffer)) - (goto-char (point-min)) - (let ((case-fold-search nil)) - (cond - ((and - (re-search-forward - (concat "^\\($\\|[Cc]ontent-[Tt]ype:[ \t]+multipart/\\(report\\|mixed\\)\\)") nil t) - (not (bolp)) - (re-search-forward "boundary=\"\\([^\"]+\\)\"" nil t)) - (let ((boundary (buffer-substring (match-beginning 1) (match-end 1))) - start) - (cond - ((and (setq start (re-search-forward - (concat "^--" boundary "\n" - "\\([Cc]ontent-[Dd]escription:.*\n\\)?" - "[Cc]ontent-[Tt]ype:[ \t]+" - "\\(message/rfc822\\|text/rfc822-headers\\)\n" - "\\(.+\n\\)*\n") nil t)) - (re-search-forward - (concat "\n\\(--" boundary "\\)--\n") nil t)) - (wl-draft-edit-string (buffer-substring start (match-beginning 1)))) - (t - (message "Seems no message/rfc822 part."))))) - ((let ((case-fold-search t)) - (re-search-forward wl-rejected-letter-start nil t)) - (skip-chars-forward " \t\n") - (wl-draft-edit-string (buffer-substring (point) (point-max)))) - (t - (message "Does not appear to be a rejected letter."))))))) + (wl-summary-set-message-buffer-or-redisplay) + (set-buffer (wl-message-get-original-buffer)) + (goto-char (point-min)) + (let ((case-fold-search nil)) + (cond + ((and + (re-search-forward + (concat "^\\($\\|[Cc]ontent-[Tt]ype:[ \t]+multipart/\\(report\\|mixed\\)\\)") nil t) + (not (bolp)) + (re-search-forward "boundary=\"\\([^\"]+\\)\"" nil t)) + (let ((boundary (buffer-substring (match-beginning 1) (match-end 1))) + start) + (cond + ((and (setq start (re-search-forward + (concat "^--" boundary "\n" + "\\([Cc]ontent-[Dd]escription:.*\n\\)?" + "[Cc]ontent-[Tt]ype:[ \t]+" + "\\(message/rfc822\\|text/rfc822-headers\\)\n" + "\\(.+\n\\)*\n") nil t)) + (re-search-forward + (concat "\n\\(--" boundary "\\)--\n") nil t)) + (wl-draft-edit-string (buffer-substring start (match-beginning 1)))) + (t + (message "Seems no message/rfc822 part."))))) + ((let ((case-fold-search t)) + (re-search-forward wl-rejected-letter-start nil t)) + (skip-chars-forward " \t\n") + (wl-draft-edit-string (buffer-substring (point) (point-max)))) + (t + (message "Does not appear to be a rejected letter.")))))) (defun wl-summary-resend-message (address) "Resend the current message to ADDRESS." @@ -1272,7 +1288,7 @@ If ARG is non-nil, checking is omitted." "[ " (save-match-data (wl-set-string-width - wl-from-width + wl-summary-from-width (wl-summary-from-func-internal (eword-decode-string (elmo-delete-char @@ -2001,26 +2017,6 @@ If ARG is non-nil, checking is omitted." (setq diffs (cdr diffs))) (if (interactive-p) (message mes))))) -(defun wl-summary-confirm-appends (appends) - (let ((len (length appends)) - in) - (if (> len wl-summary-update-confirm-threshold) - (if (y-or-n-p (format "Too many messages(%d). Continue? " len)) - appends - (setq in wl-summary-update-confirm-threshold) - (catch 'end - (while t - (setq in (read-from-minibuffer "Update number: " - (int-to-string in)) - in (string-to-int in)) - (if (< len in) - (throw 'end len)) - (if (y-or-n-p (format "%d messages are disappeared. OK? " - (max (- len in) 0))) - (throw 'end in)))) - (nthcdr (max (- len in) 0) appends)) - appends))) - (defun wl-summary-sync-update (&optional unset-cursor sync-all no-check) "Update the summary view to the newest folder status." (interactive) @@ -2029,7 +2025,6 @@ If ARG is non-nil, checking is omitted." (elmo-mime-charset wl-summary-buffer-mime-charset) (inhibit-read-only t) (buffer-read-only nil) - (elmo-folder-update-threshold wl-summary-update-confirm-threshold) gc-message overview number-alist mark-alist curp num i new-msgdb @@ -3971,7 +3966,8 @@ If ARG, exit virtual folder." (save-excursion (goto-char (point-min)) (let ((wl-save-dir - (wl-read-directory-name "Save to directory: " wl-tmp-dir)) + (wl-read-directory-name "Save to directory: " + wl-temporary-file-directory)) (regexp (concat "^" wl-summary-buffer-number-regexp "\\(\\*\\)")) number mlist) (if (null (file-exists-p wl-save-dir)) @@ -4201,8 +4197,7 @@ If ARG, exit virtual folder." (setq linked (wl-thread-entity-get-linked thr-entity))) (if (string= thr-str "") (setq no-parent t)) ; no parent - (if (and wl-summary-width - wl-summary-indent-length-limit + (if (and wl-summary-indent-length-limit (< wl-summary-indent-length-limit (string-width thr-str))) (setq thr-str (wl-set-string-width @@ -4211,8 +4206,8 @@ If ARG, exit virtual folder." (setq from (wl-set-string-width (if children-num - (- wl-from-width (length children-num) 2) - wl-from-width) + (- wl-summary-from-width (length children-num) 2) + wl-summary-from-width) (elmo-delete-char ?\n (wl-summary-from-func-internal (elmo-msgdb-overview-entity-get-from entity))))) @@ -4254,8 +4249,8 @@ If ARG, exit virtual folder." subject parent-subject))) (wl-summary-subject-func-internal subject) "")) (if (and (not wl-summary-width) - wl-subject-length-limit) - (truncate-string subject wl-subject-length-limit) + wl-summary-subject-length-limit) + (truncate-string subject wl-summary-subject-length-limit) subject))))) (if wl-summary-width (setq line (wl-set-string-width @@ -4911,31 +4906,30 @@ When guess function return nil, challenge next guess-function.") "Write message to current FOLDER's newsgroup or mailing-list. Use function list is `wl-summary-write-current-folder-functions'." (interactive) - (let (newsgroups to cc) - ;; default FOLDER is current buffer folder - (setq folder (or folder (wl-summary-buffer-folder-name))) - (let ((flist wl-summary-write-current-folder-functions) - guess-list) - (while flist - (setq guess-list (funcall (car flist) folder)) - (cond ((null guess-list) - (setq flist (cdr flist))) - ;; To: or Newsgroups: - ((or (stringp (nth 0 guess-list)) - (stringp (nth 2 guess-list))) - (setq flist nil)) - ;; (nil X nil) or error case - (t - (setq flist (cdr flist))))) - (when (null guess-list) - (error "Can't guess by folder %s" folder)) - (wl-draft (nth 0 guess-list) nil nil ; To: - (nth 1 guess-list) nil ; Cc: - (nth 2 guess-list) ; Newsgroups: - nil nil nil nil nil nil nil - folder) - (run-hooks 'wl-mail-setup-hook) - (mail-position-on-field "Subject")))) + ;; default FOLDER is current buffer folder + (setq folder (or folder (wl-summary-buffer-folder-name))) + (let ((func-list wl-summary-write-current-folder-functions) + guess-list guess-func) + (while func-list + (setq guess-list (funcall (car func-list) folder)) + (if (null guess-list) + (setq func-list (cdr func-list)) + (setq guess-func (car func-list)) + (setq func-list nil))) + (when (null guess-func) + (error "Can't guess by folder %s" folder)) + (unless (or (stringp (nth 0 guess-list)) + (stringp (nth 1 guess-list)) + (stringp (nth 2 guess-list))) + (error "Invalid value return guess function `%s'" + (symbol-name guess-func))) + (wl-draft (nth 0 guess-list) nil nil ; To: + (nth 1 guess-list) nil ; Cc: + (nth 2 guess-list) ; Newsgroups: + nil nil nil nil nil nil nil + folder) + (run-hooks 'wl-mail-setup-hook) + (mail-position-on-field "Subject"))) (defun wl-summary-forward (&optional without-setup-hook) "" @@ -5218,7 +5212,7 @@ Use function list is `wl-summary-write-current-folder-functions'." (setq wl-summary-buffer-current-msg num) (when wl-summary-recenter (recenter (/ (- (window-height) 2) 2)) - (if (not wl-summary-width) + (if (not wl-summary-indent-length-limit) (wl-horizontal-recenter))) (wl-highlight-summary-displaying) (wl-message-buffer-prefetch-next folder num (current-buffer) @@ -5244,7 +5238,7 @@ Use function list is `wl-summary-write-current-folder-functions'." (setq wl-summary-buffer-current-msg num) (when wl-summary-recenter (recenter (/ (- (window-height) 2) 2)) - (if (not wl-summary-width) + (if (not wl-summary-indent-length-limit) (wl-horizontal-recenter))) (wl-highlight-summary-displaying) (run-hooks 'wl-summary-redisplay-hook)) @@ -5271,7 +5265,7 @@ Use function list is `wl-summary-write-current-folder-functions'." (setq wl-summary-buffer-current-msg num) (when wl-summary-recenter (recenter (/ (- (window-height) 2) 2)) - (if (not wl-summary-width) + (if (not wl-summary-indent-length-limit) (wl-horizontal-recenter))) (wl-highlight-summary-displaying) (run-hooks 'wl-summary-redisplay-hook)) @@ -5341,7 +5335,6 @@ Use function list is `wl-summary-write-current-folder-functions'." "Supersede current message." (interactive) (let ((summary-buf (current-buffer)) - (mmelmo-force-fetch-entire-message t) message-buf from) (wl-summary-set-message-buffer-or-redisplay) (if (setq message-buf (wl-message-get-original-buffer)) @@ -5375,10 +5368,9 @@ Use function list is `wl-summary-write-current-folder-functions'." (defun wl-summary-save (&optional arg wl-save-dir) (interactive) (let ((filename) - (num (wl-summary-message-number)) - (mmelmo-force-fetch-entire-message t)) + (num (wl-summary-message-number))) (if (null wl-save-dir) - (setq wl-save-dir wl-tmp-dir)) + (setq wl-save-dir wl-temporary-file-directory)) (if num (save-excursion (setq filename (expand-file-name @@ -5405,7 +5397,8 @@ Use function list is `wl-summary-write-current-folder-functions'." (narrow-to-region beg end) (goto-char (point-min)) (let ((wl-save-dir - (wl-read-directory-name "Save to directory: " wl-tmp-dir))) + (wl-read-directory-name "Save to directory: " + wl-temporary-file-directory))) (if (null (file-exists-p wl-save-dir)) (make-directory wl-save-dir)) (if (eq wl-summary-buffer-view 'thread) @@ -5562,15 +5555,15 @@ Use function list is `wl-summary-write-current-folder-functions'." (set-buffer tmp-buf) (message "Exec %s..." wl-prog-uudecode) (unwind-protect - (let ((decode-dir wl-tmp-dir)) + (let ((decode-dir wl-temporary-file-directory)) (if (not wl-prog-uudecode-no-stdout-option) (setq filename (read-file-name "Save to file: " (expand-file-name (elmo-safe-filename filename) - wl-tmp-dir))) + wl-temporary-file-directory))) (setq decode-dir (wl-read-directory-name "Save to directory: " - wl-tmp-dir)) + wl-temporary-file-directory)) (setq filename (expand-file-name filename decode-dir))) (if (file-exists-p filename) (or (yes-or-no-p (format "File %s exists. Save anyway? "