[Mew-dist 873] New external-body interface patch

SAKAI Kiyotaka ksakai at example.com
1997年 4月 14日 (月) 10:44:03 JST


このあいだの External-Body のパッチですが、先のパッチでは

・parse したを結果を buffer に保存して再利用する

という方法でインプリメントしたのですが、よくよく考えてみると、それより
は

・もう一回、part を再度解析する

とした方が仕様もコードもきれいになることに気が付いたので、この間のパッ
チは破棄して、代わりにこちらを使って下さい。
-- 
酒井 清隆 (E-mail: ksakai at example.com)

-------------- next part --------------
===================================================================
RCS file: RCS/mew-summary.el,v
retrieving revision 1.1
diff -u -r1.1 mew-summary.el
--- mew-summary.el	1997/04/14 00:44:27	1.1
+++ mew-summary.el	1997/04/14 01:31:26
@@ -122,6 +122,7 @@
   (define-key mew-summary-mode-map "|"    'mew-summary-pipe-message)
   (define-key mew-summary-mode-map "q"    'mew-summary-suspend)
   (define-key mew-summary-mode-map "Q"    'mew-summary-quit)
+  (define-key mew-summary-mode-map "\C-c\C-e" 'mew-summary-execute-external)
   (define-key mew-summary-mode-map "\C-c\C-s" 'mew-summary-isearch-forward)
   (define-key mew-summary-mode-map "\C-c\C-r" 'mew-summary-isearch-backward)
   (define-key mew-summary-mode-map "\C-c\C-o" 
@@ -861,7 +862,7 @@
     hit ;; return value
     ))
 
-(defun mew-summary-display-part (fullpart num &optional non-erase)
+(defun mew-summary-display-part (fullpart num &optional non-erase execute)
 ;; called in message buffer
 ;; return t to next part ;; xxx ???
   (let* ((syntax  (mew-syntax-get-entry-strnum fullpart num))
@@ -885,9 +886,12 @@
     ;;
     (if (symbolp program)
 	(if (fboundp program)
-	    (if (equal program 'mew-mime-message/rfc822)
-		(funcall program syntax) ;; for recursive MIME
-	      (funcall program begin end params)))
+	    (cond ((eq program 'mew-mime-message/rfc822)
+		   (funcall program syntax)) ;; for recursive MIME
+		  ((eq program 'mew-mime-external-body)
+		   (funcall program begin end params execute))
+		  (t
+		   (funcall program begin end params))))
       (save-excursion
 	(set-buffer (mew-current-get 'cache))
 	(if (not (mew-which program exec-path))
@@ -916,6 +920,24 @@
       (set-buffer-modified-p nil) ;; xxx message buffer
       )
     ))
+
+(defun mew-summary-execute-external ()
+  (interactive)
+  (let* ((ofld-msg (mew-current-get 'message))
+	 (msg (mew-summary-message-number))
+	 (part (mew-summary-part-number))
+	 (buf (buffer-name)))
+    (if (or msg (not part))
+	(message "Not a part")
+      (unwind-protect
+	  (progn
+	    (mew-summary-toggle-disp-msg 'on)
+	    (mew-window-configure buf 'message)
+	    (set-buffer (mew-buffer-message))
+	    (mew-summary-display-part
+	     (mew-cache-mime-syntax (mew-cache-hit ofld-msg)) part nil t))
+	(pop-to-buffer buf)
+	(mew-summary-underline-lines)))))
 
 (defun mew-summary-recenter ()
   (interactive)
-------------- next part --------------
===================================================================
RCS file: RCS/mew-ext.el,v
retrieving revision 1.1
diff -u -r1.1 mew-ext.el
--- mew-ext.el	1997/04/04 08:06:01	1.1
+++ mew-ext.el	1997/04/14 01:35:15
@@ -298,16 +298,16 @@
 ;; exclude
 ;;
 
-(defun mew-mime-external-body (begin end params)
+(defun mew-mime-external-body (begin end params &optional execute)
   ;; message-buffer
   (let* ((access-type (mew-syntax-get-member params "access-type"))
 	 (program (cdr (mew-assoc access-type mew-ext-switch 0 t))))
     ;; xxx expire
     (if (and (symbolp program) (fboundp program))
-	(funcall program begin end params))
+	(funcall program begin end params execute))
     ))
 
-(defun mew-ext-ftp (begin end params)
+(defun mew-ext-ftp (begin end params execute)
   (let* ((site (mew-syntax-get-member params "site"))
 	 (directory (mew-syntax-get-member params "directory"))
 	 (name (mew-syntax-get-member params "name"))
@@ -332,8 +332,9 @@
             (format "SITE:\t%s\n" site)
             (format "FILE:\t%s\n" filepath))
     (if size (insert (format "SIZE:\t%s bytes\n" size)))
-    (if (not (mew-y-or-n-p "Get the message? "))
-	()
+    (if (not (and execute
+		  (mew-y-or-n-p "Get the message? ")))
+	(insert "\nTo get this file, hit C-cC-e key.")
       (setq username (read-string (format "User name at %s: " site)
 				  (user-login-name)))
       (setq remotefile (format "/%s@%s:%s" username site filepath))
@@ -350,11 +351,11 @@
       )
     ))
 
-(defun mew-ext-tftp (begin end params)
+(defun mew-ext-tftp (begin end params execute)
   (message "access-type TFTP is not supported yet")
   )
 
-(defun mew-ext-anon-ftp (begin end params)
+(defun mew-ext-anon-ftp (begin end params execute)
   (let* ((site (mew-syntax-get-member params "site"))
 	 (directory (mew-syntax-get-member params "directory"))
 	 (name (mew-syntax-get-member params "name"))
@@ -380,8 +381,9 @@
             (format "SITE:\t%s\n" site)
             (format "FILE:\t%s\n" filepath))
     (if size (insert (format "SIZE:\t%s bytes\n" size)))
-    (if (null (mew-y-or-n-p "Get the message? "))
-	()
+    (if (null (and execute
+		   (mew-y-or-n-p "Get the message? ")))
+	(insert "\nTo get this file, hit C-cC-e key.")
       (setq remotefile (format "/%s@%s:%s" "anonymous" site filepath))
       (setq url (format "ftp://%s%s" site filepath))
       (setq localfile
@@ -407,7 +409,7 @@
       )
     ))
 
-(defun mew-ext-mail-server (begin end params)
+(defun mew-ext-mail-server (begin end params execute)
   (let ((server (mew-syntax-get-member params "server"))
 	(subject (mew-syntax-get-member params "subject"))
 	(size (mew-syntax-get-member params "size"))
@@ -437,8 +439,9 @@
 	(setq start (point))
 	))
     ;; pickd up source from 'mew-send
-    (if (null (mew-y-or-n-p (format "Send a message to %s? " server)))
-	()
+    (if (null (and execute
+		   (mew-y-or-n-p (format "Send a message to %s? " server))))
+	(insert "\nTo send this mail, hit C-cC-e key.")
       (mew-summary-send nil server nil subject)
       (insert-buffer-substring (mew-current-get 'cache) start end)
       (mew-draft-make-mime)
@@ -447,7 +450,7 @@
 	))
     ))
 
-(defun mew-ext-url (begin end params)
+(defun mew-ext-url (begin end params execute)
   (let ((url (mew-syntax-get-member params "url"))
 	(size (mew-syntax-get-member params "size"))
 	(process-connection-type mew-connection-type1)
@@ -466,10 +469,12 @@
 	    "\n"
 	    (format "URL:\t\t%s\n" url))
     (if size (insert (format "SIZE:\t%s bytes\n" size)))
-    (if (mew-y-or-n-p (format "Gain access to %s ?" url))
+    (if (and execute
+	     (mew-y-or-n-p (format "Gain access to %s ?" url)))
 	(start-process
 	 (format "*mew %s*" mew-ext-prog-url)
 	 mew-buffer-tmp mew-ext-prog-url url)
+      (insert "\nTo show this url, hit C-cC-e key.")
       )
     ))
 


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