* start-process: nil check on arg program
@ 2016-08-25 6:06 Tino Calancha
2016-08-25 6:43 ` Andreas Schwab
0 siblings, 1 reply; 4+ messages in thread
From: Tino Calancha @ 2016-08-25 6:06 UTC (permalink / raw)
To: Emacs developers; +Cc: tino.calancha
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: start-process: nil check on arg program
2016-08-25 6:06 start-process: nil check on arg program Tino Calancha
@ 2016-08-25 6:43 ` Andreas Schwab
2016-08-25 6:58 ` Tino Calancha
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2016-08-25 6:43 UTC (permalink / raw)
To: Tino Calancha; +Cc: Emacs developers
On Aug 25 2016, Tino Calancha <tino.calancha@gmail.com> wrote:
> * 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.
nil is explicitly documented as a meaningful argument.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: start-process: nil check on arg program
2016-08-25 6:43 ` Andreas Schwab
@ 2016-08-25 6:58 ` Tino Calancha
2016-08-25 7:11 ` Andreas Röhler
0 siblings, 1 reply; 4+ messages in thread
From: Tino Calancha @ 2016-08-25 6:58 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Emacs developers, Tino Calancha
On Thu, 25 Aug 2016, Andreas Schwab wrote:
> On Aug 25 2016, Tino Calancha <tino.calancha@gmail.com> wrote:
>
>> * 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.
>
> nil is explicitly documented as a meaningful argument.
You are right. Thanks!
Maybe in my example has no much sense, i mean, just
(start-process "foo" "buf" nil)
but with additional arguments,
i.e.
(start-process "foo" "buf" nil args)
it might have sense.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: start-process: nil check on arg program
2016-08-25 6:58 ` Tino Calancha
@ 2016-08-25 7:11 ` Andreas Röhler
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Röhler @ 2016-08-25 7:11 UTC (permalink / raw)
To: emacs-devel; +Cc: Tino Calancha
On 25.08.2016 08:58, Tino Calancha wrote:
>
>
> On Thu, 25 Aug 2016, Andreas Schwab wrote:
>
>> On Aug 25 2016, Tino Calancha <tino.calancha@gmail.com> wrote:
>>
>>> * 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.
>>
>> nil is explicitly documented as a meaningful argument.
> You are right. Thanks!
> Maybe in my example has no much sense, i mean, just
> (start-process "foo" "buf" nil)
> but with additional arguments,
> i.e.
> (start-process "foo" "buf" nil args)
> it might have sense.
>
Don't understand the additional arguments here at stake:
Doku says WRT program-slot in question:
If nil, just associate a pty with the buffer.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-25 7:11 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:06 start-process: nil check on arg program Tino Calancha
2016-08-25 6:43 ` Andreas Schwab
2016-08-25 6:58 ` Tino Calancha
2016-08-25 7:11 ` Andreas Röhler
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.