all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Cc: tino.calancha@gmail.com
Subject: start-process: nil check on arg program
Date: Thu, 25 Aug 2016 15:06:53 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1608251505130.6055@calancha-pc> (raw)


Hi,

this is a question about
* lisp/subr.el (start-process)

I don't see the point for the nil check on program.

* program is a mandatory argument: if program is missing, for instance
(start-process "foo" "buf")
before the check run you already get a
'Wrong-number-of-arguments' error.

* If program is nil, for instance,
(start-process "foo" "buf" nil)
which IMO it shouldn't ever happend, that check don't
prevent the creation of a useless process.


I guess the nil check for program should be before the call to `apply'
(as in following patch) or not be included at all.
What do you think?

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/subr.el b/lisp/subr.el
index 8ab1178..632a9e6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2003,10 +2003,10 @@ start-process
  one of them using the shell syntax."
    (unless (fboundp 'make-process)
      (error "Emacs was compiled without subprocess support"))
-  (apply #'make-process
-	 (append (list :name name :buffer buffer)
-		 (if program
-		     (list :command (cons program program-args))))))
+  (when program
+    (apply #'make-process
+           (append (list :name name :buffer buffer
+                         :command (cons program program-args))))))

  (defun process-lines (program &rest args)
    "Execute PROGRAM with ARGS, returning its output as a list of lines.

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

Tino



             reply	other threads:[~2016-08-25  6:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25  6:06 Tino Calancha [this message]
2016-08-25  6:43 ` start-process: nil check on arg program Andreas Schwab
2016-08-25  6:58   ` Tino Calancha
2016-08-25  7:11     ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1608251505130.6055@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.