help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Convert the shell command used in emacs init-file into its normal ve


From: Jean Louis
Subject: Re: Convert the shell command used in emacs init-file into its normal version.
Date: Wed, 9 Jun 2021 11:26:22 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* 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/



reply via email to

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