unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Hongyi Zhao <hongyi.zhao@gmail.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Convert the shell command used in emacs init-file into its normal version.
Date: Wed, 9 Jun 2021 11:26:22 +0300	[thread overview]
Message-ID: <YMB7LhL23tqpTTTh@protected.localdomain> (raw)
In-Reply-To: <CAGP6POJBM3rK-4XBf-OhiggQtm-H+jLEX5H5HkSgZ7wGVVnLzg@mail.gmail.com>

* Hongyi Zhao <hongyi.zhao@gmail.com> [2021-06-09 11:04]:
> > (call-process "curl" nil nil nil "-s" "https://api.mathpix.com/v3/latex"
> >               "-X" "POST" "-H" (format "app_id: %s" id)
> >               "-H" (format "app_key: %s" key)
> >               "-H" "Content-Type: application/json"
> >               "--data" "{\"src\":\"%s\",
> >                          \"formats\": [\"latex_styled\"],
> >                          \"format_options\": {\"latex_styled\":
> >                                              {\"transforms\": [\"rm_spaces\"]}}}")
> 
> You've stripped the escaping characters out manually in the above
> code.

Yes, that is how I would use that, too much escaping is difficult

> > The data part I would format before it arrives to function `call-process'
> 
> I still can't figure out what do mean in this specific case.

The "--data" part I would format this way:

(let ((data (use function to format data here)))
     (call-process "curl" nil nil nil ................. "--data" data))

that way I would not fiddle with the data part in `call-process'
rather pass it to `call-process' and this may be what you anyway do.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



  parent reply	other threads:[~2021-06-09  8:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09  6:49 Convert the shell command used in emacs init-file into its normal version Hongyi Zhao
2021-06-09  6:58 ` Jean Louis
2021-06-09  8:03   ` Hongyi Zhao
2021-06-09  8:13     ` tomas
2021-06-09  8:22       ` Hongyi Zhao
2021-06-09  8:50         ` tomas
2021-06-09  8:26     ` Jean Louis [this message]
2021-06-09  7:23 ` Yuri Khan
2021-06-09  7:57   ` Hongyi Zhao
2021-06-09 11:37 ` Eli Zaretskii
2021-06-09 14:21   ` Hongyi Zhao
2021-06-09 17:17     ` Eli Zaretskii
2021-06-10  2:26       ` Hongyi Zhao
2021-06-10  6:59         ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YMB7LhL23tqpTTTh@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=hongyi.zhao@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).