X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mime-partial.el;h=7d3e23de7775f1221463b66016edfcac7d2945d7;hb=c7f7bd09b488c2aa461893dae421e5ae50dc18e5;hp=c240070342dbc54b5893d70ed7e4cea82850ff2f;hpb=048bf288c1605cab5b0fcb22f1db7d6f649daba8;p=elisp%2Fsemi.git diff --git a/mime-partial.el b/mime-partial.el index c240070..7d3e23d 100644 --- a/mime-partial.el +++ b/mime-partial.el @@ -20,39 +20,28 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Code: (require 'mime-view) (require 'mime-play) -(defvar mime-view-partial-message-method-alist nil - "Alist major-mode vs. function to view partial message for mime-partial.") - -;; display Article at the cursor in Subject buffer. -(defsubst mime-view-partial-message (target) - (save-window-excursion - (let ((f (assq target mime-view-partial-message-method-alist))) - (if f - (funcall (cdr f)) - (error "Fatal. Unsupported mode") - )))) - -(defun mime-method-to-combine-message/partial-pieces (beg end cal) +(defun mime-combine-message/partial-pieces-automatically (entity situation) "Internal method for mime-view to combine message/partial messages -automatically. This function refers variable -`mime-view-partial-message-method-alist' to select function to display -partial messages using mime-view." +automatically." (interactive) - (let* ((id (cdr (assoc "id" cal))) - (target (cdr (assq 'major-mode cal))) - (article-buffer (buffer-name (current-buffer))) - (subject-buf (eval (cdr (assq 'summary-buffer-exp cal)))) + (let* ((id (cdr (assoc "id" situation))) + (target (cdr (assq 'major-mode situation))) + (subject-buf (eval (cdr (assq 'summary-buffer-exp situation)))) + (mother (current-buffer)) subject-id (root-dir (expand-file-name - (concat "m-prts-" (user-login-name)) mime-temp-directory)) + (concat "m-prts-" (user-login-name)) + temporary-file-directory)) + (request-partial-message-method + (cdr (assq 'request-partial-message-method situation))) full-file) (setq root-dir (concat root-dir "/" (replace-as-filename id))) (setq full-file (concat root-dir "/FULL")) @@ -65,41 +54,38 @@ partial messages using mime-view." (if (or (file-exists-p full-file) (not (y-or-n-p "Merge partials?")) ) - (mime-method-to-store-message/partial beg end cal) - (let (the-id parameters) - (setq subject-id (std11-field-body "Subject")) - (if (string-match "[0-9\n]+" subject-id) - (setq subject-id (substring subject-id 0 (match-beginning 0))) - ) - (save-excursion - (set-buffer subject-buf) - (while (search-backward subject-id nil t)) - (catch 'tag - (while t - (mime-view-partial-message target) - (set-buffer article-buffer) - (setq parameters - (mime-entity-parameters mime-raw-message-info)) - (setq the-id (cdr (assoc "id" parameters))) - (if (string= the-id id) - (progn - (mime-method-to-store-message/partial - (mime-entity-point-min mime-raw-message-info) - (mime-entity-point-max mime-raw-message-info) - parameters) - (if (file-exists-p full-file) - (throw 'tag nil) - ) - )) + (mime-store-message/partial-piece entity situation) + (setq subject-id (mime-entity-read-field entity 'Subject)) + (if (string-match "[0-9\n]+" subject-id) + (setq subject-id (substring subject-id 0 (match-beginning 0))) + ) + (save-excursion + (set-buffer subject-buf) + (while (search-backward subject-id nil t)) + (catch 'tag + (while t + (let* ((message + ;; request message at the cursor in Subject buffer. + (save-window-excursion + (funcall request-partial-message-method) + )) + (situation (mime-entity-situation message)) + (the-id (cdr (assoc "id" situation)))) + (when (string= the-id id) + (with-current-buffer mother + (mime-store-message/partial-piece message situation) + ) + (if (file-exists-p full-file) + (throw 'tag nil) + )) (if (not (progn - (set-buffer subject-buf) (end-of-line) (search-forward subject-id nil t) )) (error "not found") ) - ) - )))))) + )) + ))))) ;;; @ end