From: Jean Louis <bugs@gnu.support>
To: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Maybe we can improve this function call-process-to-string?
Date: Thu, 08 Apr 2021 10:40:17 +0300 [thread overview]
Message-ID: <courier.00000000606EB36D.00004722@stw1.rcdrun.com> (raw)
Hello,
There is function `shell-command-to-string' which is very handy. But
when there are problems with quoting it is better to use
`call-process'. Yet there is no function `call-process-to-string',
which I have made as below.
Maybe people can tell me how to improve this function?
(defun call-process-to-string (program &optional infile display &rest args)
(let* ((buffer-name "Output")
(buffer (generate-new-buffer buffer-name))
(status (apply #'call-process program infile buffer display args))
(current-buffer (current-buffer))
(output (if status
(progn
(switch-to-buffer buffer)
(buffer-string))
"")))
(switch-to-buffer current-buffer)
output))
(call-process-to-string "identify" nil nil "/home/data1/protected/2021-03-27-10:02:52.png")
Is there maybe some other function that can give me string from
buffer?
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://rms-support-letter.github.io/
next reply other threads:[~2021-04-08 7:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 7:40 Jean Louis [this message]
2021-04-08 7:55 ` Maybe we can improve this function call-process-to-string? Eli Zaretskii
2021-04-08 11:53 ` Jean Louis
2021-04-08 13:39 ` Eli Zaretskii
2021-04-08 15:56 ` Jean Louis
2021-04-08 16:25 ` Eli Zaretskii
2021-04-08 18:17 ` Jean Louis
2021-04-08 18:36 ` Eli Zaretskii
2021-04-08 18:44 ` Jean Louis
2021-04-08 17:18 ` Arthur Miller
2021-04-08 18:32 ` Jean Louis
2021-04-08 19:41 ` Arthur Miller
2021-04-09 8:52 ` Jean Louis
2021-04-09 10:07 ` tomas
2021-04-08 13:08 ` Michael Albinus
2021-04-08 15:50 ` Jean Louis
2021-04-08 17:49 ` Stefan Monnier
2021-04-08 18:33 ` Jean Louis
2021-04-08 18:40 ` Jean Louis
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=courier.00000000606EB36D.00004722@stw1.rcdrun.com \
--to=bugs@gnu.support \
--cc=help-gnu-emacs@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.