emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `call-process', to a string [Was: Re: Automatically set eww-download


From: Eli Zaretskii
Subject: Re: `call-process', to a string [Was: Re: Automatically set eww-download-directory according xdg dir]
Date: Tue, 30 Oct 2018 08:57:03 +0200

> From: "Garreau\, Alexandre" <address@hidden>
> Date: Mon, 29 Oct 2018 21:08:32 +0100
> 
> On 2018-10-29 at 20:54, Garreau, Alexandre wrote:
> >     (substring
> >      (with-temp-buffer
> >        (call-process "xdg-user-dir" nil t nil "DOWNLOAD")
> >        (buffer-string))
> >      0 -1)
> >
> > I am not sure this is the simplest way to call a process and get its
> > output as string, without using the shell (there seem to be a
> > shell-command-to-string, but no call-process-to-string, writing another
> > mail about this).
> 
> What would it be?
> 
> In the `call-process' docstring related to the argument about output,
> there’s nothing related to a string:

My advice: don't build your process-related applications around
strings, build them around buffers, temporary or otherwise.  Emacs is
much better with buffers than with strings, notably in the
memory-management department; and making a string from a (portion of
a) buffer is trivial, if you for some reason do need a string
eventually.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]