[Mew-dist 12914] mew-start-process (was RE: make-frame-on-display)

KOIE Hidetaka ( 鯉江英隆 ) hide at example.com
2000年 4月 21日 (金) 14:59:04 JST


From: Kazu Yamamoto (山本和彦) <kazu at example.com>
Subject: [Mew-dist 12908] Re: make-frame-on-display
Date: Thu, 20 Apr 2000 21:25:16 +0900

  | うーん。process-environment をコピーしただけで大丈夫なんでしょうか?
  | 
  | /bin/sh DISPLAY=xxx xv ...
  | 
  | として、呼び出した方がよくないでしょうかね。

あるいは/usr/bin/env DISPLAY=xxx xv ..とか
そっちの方が正気のような気もしますが、

  | いずれにせよ、パッチになっていると嬉しいです。

copy process-environment方式で実装しました。
mew-start-process()がstart-process()のラッパになっています。
よくわからないので片っ端から置換しました。
#emacs-20.5/src/callproc.cをみるかぎりは期待した動作するようです。

パッチはmew-1.95b34に対するものです。

--- ./mew-ext.el.org	Fri Apr 21 13:41:37 2000
+++ ./mew-ext.el	Fri Apr 21 13:41:37 2000
@@ -446,7 +446,7 @@ (defun mew-ext-url (begin end params exe
 			  (mapconcat
 			   (function append)(append (list prog) args) " ")))
 	 (save-excursion ;; XXX this is necessary for other places
-	   (apply (function start-process)
+	   (apply (function mew-start-process)
 		  (format "*mew %s*" prog) mew-buffer-tmp prog args)))
 	(t (message "Program list error.")))))))
 
--- ./mew-func.el.org	Fri Apr 21 13:41:37 2000
+++ ./mew-func.el	Fri Apr 21 13:53:19 2000
@@ -877,7 +877,7 @@ (defun mew-im-call-process-no-output (ms
       nil)))
 
 (defun mew-im-start-process (prog name cbufp &rest arg)
-  (apply (function start-process)
+  (apply (function mew-start-process)
 	 name (if cbufp (current-buffer) nil) prog
 	 (append arg mew-prog-im-arg)))
 
@@ -931,7 +931,7 @@ (defun mew-summary-im-start2 (imprg src 
     (setq mew-summary-buffer-string nil)
     (setq mew-summary-buffer-config mew-config-input)
     (setq mew-summary-buffer-begin nil)
-    (setq mew-summary-buffer-process (apply (function start-process)
+    (setq mew-summary-buffer-process (apply (function mew-start-process)
 					    imprg (current-buffer) imprg
 					    (format "--src=%s" src)
 					    (append imarg dsts msgs)))
@@ -1114,6 +1114,14 @@ (defmacro mew-time-month () '(substring 
 (defmacro mew-time-day   () '(substring s (match-beginning 3) (match-end 3)))
 (defmacro mew-time-time  () '(substring s (match-beginning 4) (match-end 4)))
 (defmacro mew-time-year  () '(substring s (match-beginning 5) (match-end 5)))
+
+(defun mew-start-process (name buffer program &rest program-args)
+  (let ((disp (if (and mew-xemacs-p (eq (device-type) 'x))
+                  (device-connection)
+                (cdr (assq 'display (frame-parameters)))))
+        (process-environment (copy-sequence process-environment)))
+    (setenv "DISPLAY" disp)
+    (apply (function start-process) name buffer program program-args)))
 
 (provide 'mew-func)
 
--- ./mew-mime.el.org	Fri Apr 21 13:41:37 2000
+++ ./mew-mime.el	Fri Apr 21 13:41:37 2000
@@ -19,7 +19,7 @@ (defvar mew-process-file-alist nil)
 (defun mew-mime-start-process (program options file)
   (let ((process-connection-type mew-connection-type1) pro)
     (message "Starting %s ..." program)
-    (setq pro (apply (function start-process)
+    (setq pro (apply (function mew-start-process)
 		     (format "*mew %s*" program)
 		     nil
 		     program
@@ -248,7 +248,7 @@ (defun mew-mime-text/html (begin end &op
 	       (mew-frwlet
 		mew-cs-dummy mew-cs-outfile
 		(write-region begin end file nil 'no-msg)
-		(apply (function start-process)
+		(apply (function mew-start-process)
 		       mew-prog-text/html mew-buffer-tmp mew-prog-text/html
 		       arg))))))))))
 
--- ./mew-pgp.el.org	Fri Apr 21 13:41:37 2000
+++ ./mew-pgp.el	Fri Apr 21 13:41:37 2000
@@ -375,7 +375,7 @@ (defun mew-pgp-decrypt (file1 file2)
     (setq file3 (mew-make-temp-name))
     (setq process
 	  (apply
-	   (function start-process)
+	   (function mew-start-process)
 	   "PGP decrypt"
 	   (current-buffer)
 	   (mew-pgp-get mew-prog-pgpd)
@@ -426,7 +426,7 @@ (defun mew-pgp-sign (file1)
     ;; not perfectly unique but OK
     (setq process
 	  (apply
-	   (function start-process)
+	   (function mew-start-process)
 	   "PGP sign"
 	   (current-buffer)
 	   (mew-pgp-get mew-prog-pgps)
@@ -860,7 +860,7 @@ (defun mew-pgp-fetch-key (arg)
 	  (mew-piolet
 	   mew-cs-autoconv mew-cs-autoconv
            (setq mew-pgp-fetch-key-process
-                 (start-process "Get PGP Key" buf mew-prog-imcat uri)))
+                 (mew-start-process "Get PGP Key" buf mew-prog-imcat uri)))
 	  (set-process-sentinel mew-pgp-fetch-key-process 
 				'mew-pgp-fetch-process-sentinel)))
     (if (y-or-n-p "Fetching process is running. Continue fetching process? ")
--- ./mew-scan.el.org	Fri Apr 21 13:41:37 2000
+++ ./mew-scan.el	Fri Apr 21 13:41:37 2000
@@ -129,7 +129,7 @@ (defun mew-summary-scan-body (prog mode 
 	  (mew-pioalet
 	   read mew-cs-pick mew-cs-pick
 	   (setq mew-summary-buffer-process
-		 (apply (function start-process) 
+		 (apply (function mew-start-process) 
 			prog;; name
 			(current-buffer) 
 			prog;; program
--- ./mew-ssh.el.org	Fri Apr 21 13:41:37 2000
+++ ./mew-ssh.el	Fri Apr 21 13:41:37 2000
@@ -39,7 +39,7 @@ (defun mew-open-ssh-stream (server port 
       (catch 'loop
 	(while (< i N)
 	  (setq name (format "mew-process/%s/%d" sshserver localport))
-	  (setq pro (start-process
+	  (setq pro (mew-start-process
 		     name nil
 		     mew-prog-ssh "-x" "-v"
 		     "-o" (concat 

--
KOIE Hidetaka 鯉江英隆 <hide at example.com>



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