[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Maybe we can improve this function call-process-to-string?
From: |
Eli Zaretskii |
Subject: |
Re: Maybe we can improve this function call-process-to-string? |
Date: |
Thu, 08 Apr 2021 21:36:22 +0300 |
> Date: Thu, 8 Apr 2021 21:17:15 +0300
> From: Jean Louis <bugs@gnu.support>
> Cc: help-gnu-emacs@gnu.org
>
> * Eli Zaretskii <eliz@gnu.org> [2021-04-08 19:30]:
> > So you actually need the numbers reported by those commands? if so,
> > you can read them from the buffer into which the command's output is
> > stored, right? You don't actually need the numbers in their string
> > form, right?
>
> In that particular example numbers are just used as string, but
> sometimes I need numbers. That may not be most important. I do not
> understand your method of getting output from external command.
>
> How practically to do it?
>
> I understood reading it from buffer is different than reading from
> shell-command-to-string.
>
> Then to have output in buffer, I need call-process, but then again I
> need to enter that buffer and read string out of it.
You can use with-current-buffer for that.
> Again I have to use strings there.
Depends on what you want to do with that string. My point is:
whatever you want to do with the string, do it with buffer text
instead.
> > > I would not know how to get output from system command by using those
> > > functions without using shell-command-to-string or call-process
> >
> > You said buffer-substring doesn't take a buffer as an argument. I'm
> > suggesting something like
> >
> > (with-current-buffer (get-buffer "foo")
> > (buffer-substring ...))
>
> That again comes back as a string, right?
Yes, but only because _you_ asked a buffer-substring.
- Maybe we can improve this function call-process-to-string?, Jean Louis, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?, Eli Zaretskii, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?, Jean Louis, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?, Eli Zaretskii, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?, Jean Louis, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?, Eli Zaretskii, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?, Jean Louis, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?,
Eli Zaretskii <=
- Re: Maybe we can improve this function call-process-to-string?, Jean Louis, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?, Arthur Miller, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?, Jean Louis, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?, Arthur Miller, 2021/04/08
- Re: Maybe we can improve this function call-process-to-string?, Jean Louis, 2021/04/09
- Re: Maybe we can improve this function call-process-to-string?, tomas, 2021/04/09
Re: Maybe we can improve this function call-process-to-string?, Michael Albinus, 2021/04/08
Re: Maybe we can improve this function call-process-to-string?, Stefan Monnier, 2021/04/08