From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.devel Subject: start-process: nil check on arg program Date: Thu, 25 Aug 2016 15:06:53 +0900 (JST) Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1472105261 27653 195.159.176.226 (25 Aug 2016 06:07:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 25 Aug 2016 06:07:41 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: tino.calancha@gmail.com To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 25 08:07:37 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bcnpB-0006jj-7D for ged-emacs-devel@m.gmane.org; Thu, 25 Aug 2016 08:07:37 +0200 Original-Received: from localhost ([::1]:54636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcnpB-0001gY-SL for ged-emacs-devel@m.gmane.org; Thu, 25 Aug 2016 02:07:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcnoc-0001gP-GW for emacs-devel@gnu.org; Thu, 25 Aug 2016 02:07:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bcnoY-0002DK-3N for emacs-devel@gnu.org; Thu, 25 Aug 2016 02:07:01 -0400 Original-Received: from mail-pa0-x244.google.com ([2607:f8b0:400e:c03::244]:34998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcnoX-0002DD-SL for emacs-devel@gnu.org; Thu, 25 Aug 2016 02:06:58 -0400 Original-Received: by mail-pa0-x244.google.com with SMTP id cf3so2511347pad.2 for ; Wed, 24 Aug 2016 23:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:user-agent:mime-version; bh=h/mOF1+59XtIE0ST4is3z59cPhxhqEBt3HjGO4S5yb0=; b=Aa09SmDwyUPFchn+FLsnSNKjWOoM6KyGE0mYEtcqZVzGaRgA8dgdOac6JMhNXRTWZT dvUOaF7bhAP8zhG6bLvVxg6AxW0nS1PgKEAZdr+X3J+FijjOSNDOhSXSSvQEIGarXbBN PYfIRC7Hk3n0MQ6D+ekm75RiBMhFRAMNWhayyzLz+rvcS9aPG9oPcwpfz+FWBr8z7zug 8etolNOW9ULN33mgEO2zekwtMqi0aZg3HvTrt708dGOW6KC6wOqe5/Oj5EcNBUzO6Po6 35Ayamxt2n3vdOk2coTRNDxd4Ym53ya7J3CdiDzQzoJFNrt5ITaY7kZNDzntxUybItOU b2PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:message-id:user-agent :mime-version; bh=h/mOF1+59XtIE0ST4is3z59cPhxhqEBt3HjGO4S5yb0=; b=EKPUtatFWQnDLIqdEo5Af7H6iyBzRcWCqCkxnaBbMI0OZQJ7a2HxtkUZDRf+SXsdJX /5JNA7sKTUWU9StnxkhnsQX3ftd4fHt+X2vIyF/biAN+SfC1vFoeIo9pL6mdSwib3iiX yOJ2rnoCT+pQ6DCzWf2ljr6l3v8D5xYjxl6HDG+B/G5QnIRMDw3BFzb4c4wOO5P7Kw3o uMEN/iZTLgwFNYuWfuU5+4MTl0zxyI20jmtK0WblI8/26i0t/xZk/HbrFI2LTrX3Er6o HsVMHHTmRsPaflaFPYagJ22ENtVXlF8CRaTNgzYdD5QhFVbeOhrrAsGiXX5LR2Em2huN u2wA== X-Gm-Message-State: AE9vXwNTPIKtFBvMU43bwJoS+mAYQjKGSr+lWksP6hEK0eER440Op4Aw2mlSQI/eKw1D5g== X-Received: by 10.66.54.132 with SMTP id j4mr12990522pap.110.1472105216760; Wed, 24 Aug 2016 23:06:56 -0700 (PDT) Original-Received: from calancha-pc ([103.5.140.183]) by smtp.gmail.com with ESMTPSA id cp11sm17918863pac.28.2016.08.24.23.06.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 23:06:56 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::244 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206790 Archived-At: 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