unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Use specific functions to create shell processes
@ 2016-08-25  6:52 Tino Calancha
  2016-08-25 14:35 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Tino Calancha @ 2016-08-25  6:52 UTC (permalink / raw)
  To: Emacs developers; +Cc: tino.calancha


Hi,

we have in subr.el, specific funtions to create processes
when the program is a shell, e.g., call-process-shell-command.
Using these funtions when appropiate, i.e., when the program
is a shell, results in a more readable code.
I have noticed that not all the code in the Emacs tree use these 
functions.

I propose a patch to replace calls to general functions creating
processes with the shell specific ones, when the program is a shell.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From c036272adeb7268c0d496e40d6cd4410e9ecac7d Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Thu, 25 Aug 2016 15:45:46 +0900
Subject: [PATCH] Use specific functions to create shell processes

subr.el define specific functions to create processes when
the program is a shell.  Replace calls to the general
functions creating processes with calls to
the shell specific if the program is a shell.
(lisp/calc/calc-graph.el, lisp/gnus/gnus-art.el)
(lisp/gnus/gnus-dired.el, lisp/gnus/gnus-fun.el)
(lisp/gnus/gnus-sum.el, lisp/gnus/gnus-uu.el)
(lisp/gnus/mail-source.el, lisp/gnus/mm-decode.el)
(lisp/ibuf-ext.el, lisp/image-dired.el)
(lisp/mail/mailalias.el, lisp/man.el)
(lisp/mh-e/mh-print.el, lisp/net/network-stream.el)
(lisp/org/ob-eval.el, lisp/progmodes/ada-xref.el)
(lisp/progmodes/compile.el, lisp/progmodes/gdb-mi.el)
(lisp/progmodes/verilog-mode.el, lisp/simple.el)
(lisp/vc/diff.el):
Use 'process-file-shell-command', 'call-process-shell-command',
'start-process-shell-command', and 'start-file-process-shell-command'
instead of 'process-file', 'call-process', 'start-process'
and 'start-file-process' if the program is a shell.
---
  lisp/calc/calc-graph.el        |  6 +++---
  lisp/gnus/gnus-art.el          | 10 ++++------
  lisp/gnus/gnus-dired.el        |  8 +++-----
  lisp/gnus/gnus-fun.el          |  3 +--
  lisp/gnus/gnus-sum.el          |  6 ++----
  lisp/gnus/gnus-uu.el           | 16 +++++++++-------
  lisp/gnus/mail-source.el       |  6 ++----
  lisp/gnus/mm-decode.el         | 11 ++++-------
  lisp/ibuf-ext.el               |  4 +---
  lisp/image-dired.el            | 23 ++++++++++-------------
  lisp/mail/mailalias.el         |  5 ++---
  lisp/man.el                    | 12 ++++++------
  lisp/mh-e/mh-print.el          |  9 +++++----
  lisp/net/network-stream.el     | 15 ++++++++-------
  lisp/org/ob-eval.el            |  9 ++++-----
  lisp/progmodes/ada-xref.el     |  5 ++---
  lisp/progmodes/compile.el      |  3 +--
  lisp/progmodes/gdb-mi.el       |  9 +++++----
  lisp/progmodes/verilog-mode.el |  2 +-
  lisp/simple.el                 | 10 ++++------
  lisp/vc/diff.el                |  6 ++----
  21 files changed, 79 insertions(+), 99 deletions(-)

diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el
index 6357c97..a9f2d4e 100644
--- a/lisp/calc/calc-graph.el
+++ b/lisp/calc/calc-graph.el
@@ -908,9 +908,9 @@ calc-graph-kill-hook
  (defun calc-graph-show-tty (output)
    "Default calc-gnuplot-plot-command for \"tty\" output mode.
  This is useful for tek40xx and other graphics-terminal types."
-  (call-process shell-file-name nil calc-gnuplot-buffer nil
-                shell-command-switch
-                (format "cat %s >/dev/tty; rm %s" output output)))
+  (call-process-shell-command
+   (format "cat %s >/dev/tty; rm %s" output output)
+   nil calc-gnuplot-buffer))

  (defvar calc-dumb-map nil
    "The keymap for the \"dumb\" terminal plot.")
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index d7737ce..2eff6ed 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -5279,12 +5279,10 @@ gnus-mime-print-part
  	    (unwind-protect
  		(progn
  		  (mm-save-part-to-file handle file)
-		  (call-process shell-file-name nil
-				(generate-new-buffer " *mm*")
-				nil
-				shell-command-switch
-				(mm-mailcap-command
-				 printer file (mm-handle-type handle))))
+		  (call-process-shell-command
+           (mm-mailcap-command
+            printer file (mm-handle-type handle))
+           nil (generate-new-buffer " *mm*")))
  	      (delete-file file))
  	  (with-temp-buffer
  	    (insert contents)
diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el
index f7eae94..91813b7 100644
--- a/lisp/gnus/gnus-dired.el
+++ b/lisp/gnus/gnus-dired.el
@@ -230,11 +230,9 @@ gnus-dired-print
  	       (stringp
  		(setq method (mailcap-mime-info mime-type "print"
  						'no-decode))))
-	  (call-process shell-file-name nil
-			(generate-new-buffer " *mm*")
-			nil
-			shell-command-switch
-			(mm-mailcap-command method file-name mime-type))
+	  (call-process-shell-command
+       (mm-mailcap-command method file-name mime-type)
+       nil (generate-new-buffer " *mm*"))
  	(with-temp-buffer
  	  (insert-file-contents file-name)
  	  (if (eq gnus-dired-mail-mode 'gnus-user-agent)
diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el
index 0ffd243..4d1a8b1 100644
--- a/lisp/gnus/gnus-fun.el
+++ b/lisp/gnus/gnus-fun.el
@@ -95,8 +95,7 @@ gnus-convert-image-to-face-command
  (defun gnus-shell-command-to-string (command)
    "Like `shell-command-to-string' except not mingling ERROR."
    (with-output-to-string
-    (call-process shell-file-name nil (list standard-output nil)
-		  nil shell-command-switch command)))
+    (call-process-shell-command command nil (list standard-output nil))))

  ;;;###autoload
  (defun gnus--random-face-with-type (dir ext omit fun)
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 910c796..21cc9ee 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -12412,10 +12412,8 @@ gnus-execute-command
        (erase-buffer)
        (insert "$ " command "\n\n")
        (if gnus-view-pseudo-asynchronously
-	  (start-process "gnus-execute" (current-buffer) shell-file-name
-			 shell-command-switch command)
-	(call-process shell-file-name nil t nil
-		      shell-command-switch command)))))
+	  (start-process-shell-command "gnus-execute" (current-buffer) 
command)
+	(call-process-shell-command command nil t)))))

  ;; Summary kill commands.

diff --git a/lisp/gnus/gnus-uu.el b/lisp/gnus/gnus-uu.el
index d09210d..2ed3d4b 100644
--- a/lisp/gnus/gnus-uu.el
+++ b/lisp/gnus/gnus-uu.el
@@ -1661,9 +1661,9 @@ gnus-uu-treat-archive

      (gnus-message 5 "Unpacking: %s..." (gnus-uu-command action 
file-path))

-    (if (eq 0 (call-process shell-file-name nil
-			   (gnus-get-buffer-create 
gnus-uu-output-buffer-name)
-			   nil shell-command-switch command))
+    (if (eq 0 (call-process-shell-command
+               command
+               nil (gnus-get-buffer-create gnus-uu-output-buffer-name)))
  	(message "")
        (gnus-message 2 "Error during unpacking of archive")
        (setq did-unpack nil))
@@ -1938,8 +1938,9 @@ gnus-uu-post-encode-mime-uuencode

  ;; Encodes with base64 and adds MIME headers
  (defun gnus-uu-post-encode-mime (path file-name)
-  (when (eq 0 (call-process shell-file-name nil t nil 
shell-command-switch
-			    (format "%s %s -o %s" "mmencode" path 
file-name)))
+  (when (eq 0 (call-process-shell-command
+               (format "%s %s -o %s" "mmencode" path file-name)
+               nil t))
      (gnus-uu-post-make-mime file-name "base64")
      t))

@@ -1964,8 +1965,9 @@ gnus-uu-post-make-mime
  ;; Encodes a file PATH with COMMAND, leaving the result in the
  ;; current buffer.
  (defun gnus-uu-post-encode-file (command path file-name)
-  (eq 0 (call-process shell-file-name nil t nil shell-command-switch
-		      (format "%s %s %s" command path file-name))))
+  (eq 0 (call-process-shell-command
+		      (format "%s %s %s" command path file-name)
+              nil t)))

  (defun gnus-uu-post-news-inews ()
    "Posts the composed news article and encoded file.
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 59a97db..48a5550 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -728,8 +728,7 @@ mail-source-movemail
        to)))

  (defun mail-source-fetch-with-program (program)
-  (eq 0 (call-process shell-file-name nil nil nil
-		      shell-command-switch program)))
+  (eq 0 (call-process-shell-command program)))

  (defun mail-source-run-script (script spec &optional delay)
    (when script
@@ -748,8 +747,7 @@ mail-source-call-script
        (setq script (substring script 0 (match-beginning 0))
  	    background 0))
      (setq result
-	  (call-process shell-file-name nil stderr nil
-			shell-command-switch script))
+	  (call-process-shell-command script nil stderr))
      (if (and result
               (not (zerop result)))
          (progn
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 4b3f10c..4c6c54a 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -1001,13 +1001,10 @@ mm-display-external
  	       handle
  	       (unwind-protect
  		   (progn
-		     (call-process shell-file-name nil
-				   (setq buffer
-					 (generate-new-buffer " *mm*"))
-				   nil
-				   shell-command-switch
-				   (mm-mailcap-command
-				    method file (mm-handle-type handle)))
+		     (call-process-shell-command
+              (mm-mailcap-command
+               method file (mm-handle-type handle))
+              nil (setq buffer (generate-new-buffer " *mm*")))
  		     (if (buffer-live-p buffer)
  			 (with-current-buffer buffer
  			   (buffer-string))))
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index f93957e..6ed397e 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1387,9 +1387,7 @@ ibuffer-diff-buffer-with-file-1
  	      (let ((inhibit-read-only t))
  		(insert command "\n")
  		(diff-sentinel
-		 (call-process shell-file-name nil
-			       (current-buffer) nil
-			       shell-command-switch command))
+		 (call-process-shell-command command nil 
(current-buffer)))
  		(insert "\n")))))
        (sit-for 0)
        (when (file-exists-p tempfile)
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 67b023d..dabc5c5 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -639,7 +639,7 @@ image-dired-create-thumb
                  (setq thumbnail-dir (file-name-directory 
thumbnail-file))))
        (message "Creating thumbnail directory.")
        (make-directory thumbnail-dir))
-    (call-process shell-file-name nil nil nil shell-command-switch 
command)))
+    (call-process-shell-command command)))

  ;;;###autoload
  (defun image-dired-dired-toggle-marked-thumbs (&optional arg)
@@ -1737,16 +1737,16 @@ image-dired-thumbnail-display-external
          (message "No thumbnail at point")
        (if (not file)
            (message "No original file name found")
-        (call-process shell-file-name nil nil nil shell-command-switch
-		      (format "%s \"%s\"" image-dired-external-viewer 
file))))))
+        (call-process-shell-command
+         (format "%s \"%s\"" image-dired-external-viewer file))))))

  ;;;###autoload
  (defun image-dired-dired-display-external ()
    "Display file at point using an external viewer."
    (interactive)
    (let ((file (dired-get-filename)))
-    (call-process shell-file-name nil nil nil shell-command-switch
-		  (format "%s \"%s\"" image-dired-external-viewer file))))
+    (call-process-shell-command
+     (format "%s \"%s\"" image-dired-external-viewer file))))

  (defun image-dired-window-width-pixels (window)
    "Calculate WINDOW width in pixels."
@@ -1819,8 +1819,7 @@ image-dired-display-image
                    (cons ?h height)
                    (cons ?f file)
                    (cons ?t new-file))))
-          (setq ret (call-process shell-file-name nil nil nil
-				  shell-command-switch command))
+          (setq ret (call-process-shell-command command))
            (if (not (= 0 ret))
                (error "Could not resize image")))
        (setq image-type (image-type-from-file-name file))
@@ -1876,7 +1875,7 @@ image-dired-rotate-thumbnail
                        (cons ?p image-dired-cmd-rotate-thumbnail-program)
                        (cons ?d degrees)
                        (cons ?t (expand-file-name file)))))
-      (call-process shell-file-name nil nil nil shell-command-switch 
command)
+      (call-process-shell-command command)
        ;; Clear the cache to refresh image. I wish I could just refresh
        ;; the current file but I do not know how to do that. Yet...
        (clear-image-cache))))
@@ -1921,8 +1920,7 @@ image-dired-rotate-original
                        (cons ?d degrees)
                        (cons ?o (expand-file-name file))
                        (cons ?t image-dired-temp-rotate-image-file))))
-      (if (not (= 0 (call-process shell-file-name nil nil nil
-				  shell-command-switch command)))
+      (if (not (= 0 (call-process-shell-command command)))
            (error "Could not rotate image")
          (image-dired-display-image image-dired-temp-rotate-image-file)
          (if (or (and image-dired-rotate-original-ask-before-overwrite
@@ -1995,7 +1993,7 @@ image-dired-set-exif-data
                      (cons ?f (expand-file-name file))
                      (cons ?t tag-name)
                      (cons ?v tag-value))))
-    (call-process shell-file-name nil nil nil shell-command-switch 
command)))
+    (call-process-shell-command command)))

  (defun image-dired-get-exif-data (file tag-name)
    "From FILE, return EXIF tag TAG-NAME."
@@ -2009,8 +2007,7 @@ image-dired-get-exif-data
                      (cons ?t tag-name))))
      (with-current-buffer buf
        (delete-region (point-min) (point-max))
-      (if (not (eq (call-process shell-file-name nil t nil
-				 shell-command-switch command) 0))
+      (if (not (eq (call-process-shell-command command nil t) 0))
            (error "Could not get EXIF tag")
          (goto-char (point-min))
          ;; Clean buffer from newlines and carriage returns before
diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el
index 59670a7..479fb1e 100644
--- a/lisp/mail/mailalias.el
+++ b/lisp/mail/mailalias.el
@@ -479,9 +479,8 @@ mail-get-names
  	  (while files
  	    (insert-file-contents (car files) nil nil nil t)
  	    (setq files (cdr files))))
-	(if mail-passwd-command
-	    (call-process shell-file-name nil t nil
-			  shell-command-switch mail-passwd-command))
+	(when mail-passwd-command
+          (call-process-shell-command mail-passwd-command nil t))
  	(goto-char (point-min))
  	(setq mail-local-names nil)
  	(while (not (eobp))
diff --git a/lisp/man.el b/lisp/man.el
index d127dec..b6236c5 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1092,9 +1092,9 @@ Man-getpage-in-background
  	       (set-process-filter proc 'Man-bgproc-filter))
  	   (let* ((inhibit-read-only t)
  		  (exit-status
-		   (call-process shell-file-name nil (list buffer nil) nil
-				 shell-command-switch
-				 (format (Man-build-man-command) 
man-args)))
+		   (call-process-shell-command
+                    (format (Man-build-man-command) man-args)
+                    nil (list buffer nil)))
  		  (msg ""))
  	     (or (and (numberp exit-status)
  		      (= exit-status 0))
@@ -1122,9 +1122,9 @@ Man-update-manpage
  	(buffer-read-only nil))
       (erase-buffer)
       (Man-start-calling
-      (call-process shell-file-name nil (list (current-buffer) nil) nil
-		    shell-command-switch
-		    (format (Man-build-man-command) Man-arguments)))
+      (call-process-shell-command
+       (format (Man-build-man-command) Man-arguments)
+       nil (list (current-buffer) nil)))
       (if Man-fontify-manpage-flag
  	 (Man-fontify-manpage)
         (Man-cleanup-manpage))
diff --git a/lisp/mh-e/mh-print.el b/lisp/mh-e/mh-print.el
index 5aa7297..b7f8d72 100644
--- a/lisp/mh-e/mh-print.el
+++ b/lisp/mh-e/mh-print.el
@@ -220,8 +220,8 @@ mh-print-msg
                 (scan-command
                  (format "scan %s | %s" msgs-string lpr-command)))
            (if mh-print-background-flag
-              (mh-exec-cmd-daemon shell-file-name nil "-c" scan-command)
-            (call-process shell-file-name nil nil nil "-c" 
scan-command))))
+              (mh-exec-cmd-daemon shell-file-name nil 
shell-command-switch scan-command)
+            (call-process-shell-command scan-command))))
      ;; Print the messages
      (dolist (msg msgs)
        (let* ((mhl-command (format "%s %s %s"
@@ -236,8 +236,9 @@ mh-print-msg
               (print-command
                (format "%s | %s" mhl-command lpr-command)))
          (if mh-print-background-flag
-            (mh-exec-cmd-daemon shell-file-name nil "-c" print-command)
-          (call-process shell-file-name nil nil nil "-c" 
print-command)))))
+            (mh-exec-cmd-daemon
+             shell-file-name nil shell-command-switch print-command)
+          (call-process-shell-command print-command)))))
    (message "Printing...done"))

  (provide 'mh-print)
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index c2845d9..90ac77d 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -407,13 +407,14 @@ network-stream-open-shell
  	 (eoc 		     (plist-get parameters :end-of-command))
  	 (start (with-current-buffer buffer (point)))
  	 (stream (let ((process-connection-type nil))
-		   (start-process name buffer shell-file-name
-				  shell-command-switch
-				  (format-spec
-				   (plist-get parameters :shell-command)
-				   (format-spec-make
-				    ?s host
-				    ?p service))))))
+		   (start-process-shell-command
+                    name
+                    buffer
+                    (format-spec
+                     (plist-get parameters :shell-command)
+                     (format-spec-make
+                      ?s host
+                      ?p service))))))
      (list stream
  	  (network-stream-get-response stream start eoc)
  	  (network-stream-command stream capability-command
diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el
index 1050eaa..0cab038 100644
--- a/lisp/org/ob-eval.el
+++ b/lisp/org/ob-eval.el
@@ -99,11 +99,10 @@ org-babel--shell-command-on-region
        (write-region start end input-file)
        (delete-region start end)
        (setq exit-status
-	    (process-file shell-file-name input-file
-			  (if error-file
-			      (list t error-file)
-			    t)
-			  nil shell-command-switch command))
+	    (process-file-shell-command
+             command input-file (if error-file
+                                    (list t error-file)
+                                  t)))
        (when swap (exchange-point-and-mark)))

      (when (and input-file (file-exists-p input-file)
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index b3248d3..5acfcbd 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -1313,8 +1313,7 @@ ada-run-application
        (setq buffer-read-only nil)

        (erase-buffer)
-      (start-process "run" (current-buffer) shell-file-name
-		     "-c" command)
+      (start-process-shell-command "run" (current-buffer) command)
        (comint-mode)
        ;;  Set these two variables to their default values, since 
otherwise
        ;;  the output buffer is scrolled so that only the last output line
@@ -2324,7 +2323,7 @@ ada-make-body-gnatstub
        (newline)
        )

-    (call-process shell-file-name nil buffer nil "-c" gnatstub-cmd)
+    (call-process-shell-command gnatstub-cmd nil buffer)

      ;; clean up the output

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index f2e397a..97e3eeeb 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1797,8 +1797,7 @@ compilation-start
  	    (goto-char (point-max))
  	    (let* ((inhibit-read-only t) ; call-process needs to modify 
outbuf
  		   (compilation-filter-start (point))
-		   (status (call-process shell-file-name nil outbuf nil 
"-c"
-					 command)))
+		   (status (call-process-shell-command command nil 
outbuf)))
  	      (run-hooks 'compilation-filter-hook)
  	      (cond ((numberp status)
  		     (compilation-handle-exit
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 8047e20..99654f3 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1008,10 +1008,11 @@ gdb-create-define-alist
  		   (file-exists-p file)
   		   ;; call-process doesn't work with remote file names.
  		   (not (file-remote-p default-directory))
- 		   (call-process shell-file-name file
-				 (list t nil) nil "-c"
-				 (concat gdb-cpp-define-alist-program " "
-					 gdb-cpp-define-alist-flags))))))
+		   (call-process-shell-command
+                    (concat gdb-cpp-define-alist-program " "
+                            gdb-cpp-define-alist-flags)
+                    file
+                    (list t nil))))))
           (define-list (split-string output "\n" t))
           (name))
      (setq gdb-define-alist nil)
diff --git a/lisp/progmodes/verilog-mode.el 
b/lisp/progmodes/verilog-mode.el
index fd2e96a..ae1a6a0 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -5278,7 +5278,7 @@ verilog-preprocess
      (with-output-to-temp-buffer "*Verilog-Preprocessed*"
        (with-current-buffer (get-buffer "*Verilog-Preprocessed*")
  	(insert (concat "// " cmd "\n"))
-	(call-process shell-file-name nil t nil shell-command-switch cmd)
+	(call-process-shell-command cmd nil t)
  	(verilog-mode)
  	;; Without this force, it takes a few idle seconds
  	;; to get the color, which is very jarring
diff --git a/lisp/simple.el b/lisp/simple.el
index 51b24bb..d3f9616 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3401,11 +3401,10 @@ shell-command
  	    ;; "if ($?prompt) exit" before things which are not useful
  	    ;; non-interactively.  Besides, if someone wants their other
  	    ;; aliases for shell commands then they can still have them.
-	    (call-process shell-file-name nil
+	    (call-process-shell-command command nil
  			  (if error-file
  			      (list t error-file)
-			    t)
-			  nil shell-command-switch command)
+			    t))
  	    (when (and error-file (file-exists-p error-file))
  	      (if (< 0 (nth 7 (file-attributes error-file)))
  		  (with-current-buffer (get-buffer-create error-buffer)
@@ -3480,8 +3479,7 @@ shell-command
  		  (display-buffer buffer '(nil (allow-no-window . t)))
                    (shell-command--save-pos-or-erase)
  		  (setq default-directory directory)
-		  (setq proc (start-process "Shell" buffer shell-file-name
-					    shell-command-switch command))
+		  (setq proc (start-process-shell-command "Shell" buffer 
command))
  		  (setq mode-line-process '(":%s"))
  		  (require 'shell) (shell-mode)
  		  (set-process-sentinel proc 'shell-command-sentinel)
@@ -3775,7 +3773,7 @@ shell-command-to-string
    (with-output-to-string
      (with-current-buffer
        standard-output
-      (process-file shell-file-name nil t nil shell-command-switch 
command))))
+      (process-file-shell-command command nil t))))

  (defun process-file (program &optional infile buffer display &rest args)
    "Process files synchronously in a separate process.
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index 6b316c4..a09d0cd 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -168,8 +168,7 @@ diff-no-select
        (let ((inhibit-read-only t))
  	(insert command "\n"))
        (if (and (not no-async) (fboundp 'make-process))
-	  (let ((proc (start-process "Diff" buf shell-file-name
-                                     shell-command-switch command)))
+	  (let ((proc (start-process-shell-command "Diff" buf command)))
  	    (set-process-filter proc 'diff-process-filter)
              (set-process-sentinel
               proc (lambda (proc _msg)
@@ -179,8 +178,7 @@ diff-no-select
  	;; Async processes aren't available.
  	(let ((inhibit-read-only t))
  	  (diff-sentinel
-	   (call-process shell-file-name nil buf nil
-			 shell-command-switch command)
+	   (call-process-shell-command command nil buf)
             old-alt new-alt))))
      buf))

-- 
2.9.3


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In GNU Emacs 25.1.50.6 (x86_64-pc-linux-gnu, GTK+ Version 3.20.7)
  of 2016-08-25 built on calancha-pc
Repository revision: 70cfe9df957bd2f0699f62fe5e69176313f7c8f0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-26 10:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-25  6:52 Use specific functions to create shell processes Tino Calancha
2016-08-25 14:35 ` Eli Zaretskii
2016-08-26 10:25   ` Tino Calancha
2016-08-26 10:35     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).