[Mew-dist 03930] Re: patch to mew-summary-execute-external

SAKAI Kiyotaka ksakai at example.com
1998年 2月 24日 (火) 20:51:18 JST


>> In article <19980224112205Y.nishimu at example.com>, 西村=?iso-2022-jp?B?GyRCPVNJVxsoQg==? <nishimu at example.com> writes:

> 1) UNIXを使っている人でHTMLはnetscapeで見る設定

> .emacsに以下の行を追加します。

> (setq mew-ext-prog-url "rnetscape")
> (setq mew-ext-prog-url-args nil)
> (setq mew-prog-text/html "rnetscape")

> rnetscapeの内容は次のとおり。

> #!/bin/sh
> netscape -raise -remote openURL\($1\)

これですが、どうせなら browse-url も使えるようにすれば解決するだろうと
思って以下のパッチを作ったのですが、どうも仕様が汚ないので投げないでい
ました。

このパッチでは、

  (setq mew-ext-prog-url 'browse-url-of-region)
  (setq mew-ext-prog-url 'browse-url-netscape)

といった定義ができるようになっていて、関数名が -region で終わるかどう
かで file で渡すか region で渡すかを切り換えているのですが、どうするの
がいいでしょうか? (誰かきれいな仕様を定めてくれたら実装します。)
-- 
酒井 清隆 (E-mail: ksakai at example.com)


Index: mew-mime.el
===================================================================
RCS file: /home/cvsroot/mew-1.93b13/mew-mime.el,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mew-mime.el
--- mew-mime.el	1998/02/13 00:22:53	1.1.1.1
+++ mew-mime.el	1998/02/13 05:02:05
@@ -158,26 +158,26 @@
         (insert "\nTo display this text/html contents with browser, type "
                 (substitute-command-keys
                  "\\<mew-summary-mode-map>\\[mew-summary-execute-external]."))
-      (cond
-       ((and (symbolp mew-prog-text/html) (fboundp mew-prog-text/html))
-	(let (source)
-	  (set-buffer (mew-current-get 'cache))
-	  (setq source (buffer-substring begin end))
-	  (set-buffer (mew-buffer-message))
-	  (mew-erase-buffer)
-	  (insert source)
-	  (funcall mew-prog-text/html (point-min) (point-max))))
-       ((stringp mew-prog-text/html)
-	(if (> end begin)
-	    (let ((file (format "%s.html" (mew-make-temp-name))))
-	      (save-excursion
-		(set-buffer (mew-current-get 'cache))
-		(mew-frwlet
-		 mew-cs-noconv mew-cs-outfile ;; xxx anyway
-		 (write-region begin end file nil 'no-msg)
+      (if (and (symbolp mew-prog-text/html)
+	       (string-match "-region$" (symbol-name mew-prog-text/html)))
+	  (let (source)
+	    (set-buffer (mew-current-get 'cache))
+	    (setq source (buffer-substring begin end))
+	    (set-buffer (mew-buffer-message))
+	    (mew-erase-buffer)
+	    (insert source)
+	    (funcall mew-prog-text/html (point-min) (point-max)))
+	(let ((file (format "%s.html" (mew-make-temp-name))))
+	  (save-excursion
+	    (set-buffer (mew-current-get 'cache))
+	    (mew-frwlet
+	     mew-cs-noconv mew-cs-outfile ;; xxx anyway
+	     (write-region begin end file nil 'no-msg)
+	     (if (stringp mew-prog-text/html)
 		 (apply (function start-process)
 			mew-prog-text/html mew-buffer-tmp mew-prog-text/html
-			(append mew-prog-text/html-arg (list file))))))))))
+			(append mew-prog-text/html-arg (list file)))
+	       (funcall mew-prog-text/html file)))))))
     ))
 
 (defun mew-mime-message/rfc822 (part)



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