[mew-win32 4533] Re: NTEmacs で start-process, c all-process が無限再帰する

Hayashi Masahiro (林 雅博) <[email protected]>
Newsgroups gmane.mail.mew.windows
Message-ID <[email protected]>


 mew-win32  require  advice 

call-process  optional 

mew  advice  NG 
advice 
call-process-region 

NTEmacs  bat  shell script  call-process,
start-process 

# Mew 
# info  wiki 


Index: mew-win32.el
===================================================================
RCS file: /cvsmew/mew/mew-win32.el,v
retrieving revision 1.67
diff -u -r1.67 mew-win32.el
--- mew-win32.el	21 Jan 2009 05:55:00 -0000	1.67
+++ mew-win32.el	11 Feb 2009 05:47:23 -0000
@@ -59,34 +59,42 @@
   (require 'mw32script)
   (mw32script-init))
  ((condition-case nil
-      (require 'mw32script)
+      (progn
+	(require 'mw32script)
+	(load "mw32misc"))
     (file-error nil)) ;; NTEmacs
   (mw32script-make-pathext-regexp)
-  (defalias 'call-process-original 'call-process)
-  (defun call-process (PROGRAM INFILE BUFFER DISPLAY &rest PROGRAM-ARGS)
-    (let (prog sargs)
-      (setq prog (mw32script-openp PROGRAM))
-      (unless prog
-	(setq prog (mew-which-exec PROGRAM))
-	(setq sargs (mw32script-resolve-script prog)))
-      (if sargs
-	  (apply 'call-process-original
-		 (car sargs) INFILE BUFFER DISPLAY
-		 prog PROGRAM-ARGS)
-	(apply 'call-process-original
-	       PROGRAM INFILE BUFFER DISPLAY PROGRAM-ARGS))))
-  (defalias 'start-process-original 'start-process)
-  (defun start-process (NAME BUFFER PROGRAM &rest PROGRAM-ARGS)
-    (let (prog sargs)
-      (setq prog (mw32script-openp PROGRAM))
-      (unless prog
-	(setq prog (mew-which-exec PROGRAM))
-	(setq sargs (mw32script-resolve-script prog)))
-      (if sargs
-	  (apply 'start-process-original
-		 NAME BUFFER (car sargs) prog PROGRAM-ARGS)
-	(apply 'start-process-original
-	       NAME BUFFER PROGRAM PROGRAM-ARGS))))))
+  (defun mew-w32-argument-editing-function (program args)
+    (let ((default-process-argument-editing-function 'identity)
+	  (process-argument-editing-alist nil)
+	  prog sargs)
+      (setq prog (mw32script-openp program))
+      (if (and (null prog)
+	       (setq prog (mew-which-exec program))
+	       (setq sargs (mw32script-argument-editing-function (list prog))))
+	  (cons (car sargs) (cons prog args))
+	(cons program args))))
+  (defadvice call-process 
+    (before mew-w32-call-process 
+	    (program &optional infile buffer display &rest args)
+	    activate)
+    (let ((sargs (mew-w32-argument-editing-function program args)))
+      (setq program (car sargs)
+	    args (cdr sargs))))
+  (defadvice call-process-region
+    (before mew-w32-call-process-region 
+	    (start end program &optional infile buffer display &rest args)
+	    activate)
+    (let ((sargs (mew-w32-argument-editing-function program args)))
+      (setq program (car sargs)
+	    args (cdr sargs))))
+  (defadvice start-process 
+    (before mew-w32-start-process
+	    (name buffer program &rest program-args)
+	    activate)
+    (let ((sargs (mew-w32-argument-editing-function program program-args)))
+      (setq program (car sargs)
+	    program-args (cdr sargs))))))
 
 ;; printing
 (defun mew-w32-print-buffer ()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.