[Mew-dist 692] Re: mew-expand-file-name & reedit/redist

OKUNISHI Fujikazu fuji0924 at example.com
1997年 3月 15日 (土) 14:58:58 JST


前にお送りしたパッチが、fld = mew-draft-folder でない場合はそれでよかっ
たんですが、fld = mew-draft-folder の時にとんでもない状態になるのに気
づいた (^_^;; ので即興でいじってみました。

mew-expand-file-name で rename を展開するまでに予め rename をフルパス
に展開してやれば、(mew-expand-file-name MSG &optional BUFFER-OR-NAME)
の第2引き数を必要としないのですから、この方向で洗練させて戴けないでしょ
うか?
#僕のは不細工ですので。(^^;

 
(defun mew-summary-reedit ()
;;
;; reedit a message in a folder or a message encapsulated in MIME
;;
  (interactive)
  (let* ((msg (mew-summary-message-number)) ;; must get msg here
	(part (mew-summary-part-number))
	(fld (mew-summary-folder-name))
	(rename nil)
	(beg)
	(cache (if part (mew-current-get 'cache)))
	(syntax (if part (mew-syntax-get-entry-strnum
			  (mew-cache-mime-syntax cache) part)))
	(ct (if syntax (capitalize (car (mew-syntax-get-ct syntax))))))
    (cond
     ((and (null msg) (null part))
      (message "No message"))
     ((and part (not (equal (capitalize mew-ct-msg) ct)))
      (message "Can't reedit %s" ct))
     (t
      (mew-current-set 'window (current-window-configuration))
      (mew-window-configure (current-buffer) 'summary)
      (unwind-protect
	  (progn
	    (cond
	     ((or part (not (equal fld mew-draft-folder)))
	      (setq rename (mew-draft-get-new)))  ;; fld \= mew-draft-folder
	     (t 
;;	      (setq rename msg))  ;; original / fld = mew-draft-folder
;	      (setq rename (mew-draft-rename msg))) ;; ダメ
	      (setq rename (mew-expand-file-name msg mew-draft-folder))) ;; fuji
	     )
	    ;; prepare draft file
;; fld = mew*draft-folder の場合、既に展開されてるのを再展開するのは不
;; 細工だが..
	    (switch-to-buffer 
	     (find-file-noselect 
;;	      (mew-expand-file-name rename mew-draft-folder))) ;; original
	      (mew-expand-file-name rename)))
	    (cond
	     (part
	      (insert-buffer-substring
	       cache
	       (mew-syntax-get-begin syntax)
	       (mew-syntax-get-end (mew-syntax-get-part syntax)))) ;;; xxxx
	     ((not (equal fld mew-draft-folder))
	      (insert-file-contents (mew-expand-file-name msg fld))
	      )
	     ;; if fld equal mew-draft-folder, message already exists.
	     )
	    (mew-draft-rename rename)
	    (mew-header-delete-lines mew-field-delete)
	    ;; delimiter setup
	    ;; Both "^$" and "----" are OK.
	    (goto-char (point-min))
	    (re-search-forward "^-*$" nil t)
	    (beginning-of-line)
	    (setq beg (point))
	    (forward-line)
	    (delete-region beg (point))
	    ;; Dcc or Fcc:
	    (if (and mew-fcc (not (mew-header-get-value "Fcc:")))
		(mew-header-insert-here "Fcc:" mew-fcc))
	    (if (and mew-dcc (not (mew-header-get-value "Dcc:"))) 
		(mew-header-insert-here "Dcc:" mew-dcc))
 	    (if (and mew-from (not (mew-header-get-value "From:")))
 		(mew-header-insert-here "From:" mew-from))
 	    (if (and mew-reply-to (not (mew-header-get-value "Reply-To:")))
 		(mew-header-insert-here "Reply-To:" mew-reply-to))
	    (if (and mew-x-mailer (not (mew-header-get-value "X-Mailer:")))
		(mew-header-insert-here "X-Mailer:" mew-x-mailer))
	    (setq mew-draft-buffer-header (point-marker))
	    (insert "----\n")
	    (mew-draft-mode)
	    )
	(save-buffer))
      (message "Draft is prepared"))
     )
    ))
----
奥西藤和 / OKUNISHI Fujikazu
mailto:fuji0924 at example.com
# PGP Public Key: mailto:pgp-public-keys at example.com /Subject:GET 0x1B8BF431



Mew-dist メーリングリストの案内