From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Convert the shell command used in emacs init-file into its normal version. Date: Wed, 9 Jun 2021 14:23:07 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22159"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Hongyi Zhao Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 09 09:23:45 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqsYy-0005bd-Ss for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 09 Jun 2021 09:23:44 +0200 Original-Received: from localhost ([::1]:45208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqsYx-0001o2-V5 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 09 Jun 2021 03:23:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqsYd-0001nV-FW for help-gnu-emacs@gnu.org; Wed, 09 Jun 2021 03:23:23 -0400 Original-Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]:43836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqsYa-0000Gp-4P for help-gnu-emacs@gnu.org; Wed, 09 Jun 2021 03:23:23 -0400 Original-Received: by mail-vs1-xe33.google.com with SMTP id s22so12331553vsl.10 for ; Wed, 09 Jun 2021 00:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=RAzIXGc1DQnkbwFZIj3472Rl8KET3UsgLZVcQR3dJf4=; b=EMOl5loPRcR4JJuKPr3R+lGRb5EtyuneW0LmTeNtedVV4A0gT3/WAzX7QD5UiaydwM g6tMvu6DTv+sV0jroQBQPvLhumO0jbyqYUWuuk/IoMxaGjBkO8/uueNnkT9jcseMmxWF bp0967dF9uPdmqf1clonidkQGyB3xQ3BBPYDa/I5SimNcyYPpcdxIr+yC033IBDZDp5Y HpMaQOZI6lxbC3yRaIut+rBr1Zol7PSIQxZB7MJA0iBAVcfKqAp8Kb7cfg1JiOsmSl4t z6av2GtW9UsxAZH9+59fEh58NZF6z5KgPMZrj95jpkVUegTcBb8mwtYvudCwdVjCcrWN Q4HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RAzIXGc1DQnkbwFZIj3472Rl8KET3UsgLZVcQR3dJf4=; b=FyM1JV+lYTpTlDaDrxXlCQJ/mpq8ALRewHeqg4UG/Hr/0XOX9E+QiOmcwlA2xcA9ra 7K3rYO+gtHgyhKVAAWUhUMF62BVPpIaZ0QK8dWykpFIiFfrqymvXiNm3xFlFK8fbsTdS WWA4h+G3ariJh9DtpUV3F9FEpER7oslVOvYfgnVIasXkETMDd+KvFXOeEXBxU0fAFxSr JDo5aqJjL4FFx7X/wDQA51uSNwg+du9OtYmWD+XjW9t1gadfYAmgO/8ll4psOvyV2/ft dD7gDwo7KNrh6vVpneNM8u20PwoB4nzSm8sd+mz5e2gonpPCNkGpDjIt0XPNoqkbJfLQ LG4g== X-Gm-Message-State: AOAM533f9spcMDAA+QH28mmOdSoYJFg/tgPRQZku9t/e6hDHXr7RpfsC 0vV6jkOcqYF1sVWEGSaNDFoUdVXxalxTbp0j+3Y= X-Google-Smtp-Source: ABdhPJxTxlSEGanveWe4ah66jtm172FVJqS3W2rXaCW8XjPfN4i1rqZ1ZvAlc3Jx2oQS33GEMCbkC4BCrWUzZb44igw= X-Received: by 2002:a67:1087:: with SMTP id 129mr3762634vsq.42.1623223398686; Wed, 09 Jun 2021 00:23:18 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::e33; envelope-from=yurivkhan@gmail.com; helo=mail-vs1-xe33.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:130656 Archived-At: On Wed, 9 Jun 2021 at 13:49, Hongyi Zhao wrote: > I found the following command from > : > > "curl -s https://api.mathpix.com/v3/latex -X POST -H \"app_id: %s\" -H > \"app_key: %s\" -H \"Content-Type: application/json\" --data > \"{\\\"src\\\":\\\"%s\\\",\\\"formats\\\": > [\\\"latex_styled\\\"],\\\"format_options\\\":{\\\"latex_styled\\\": > {\\\"transforms\\\": [\\\"rm_spaces\\\"]}}}\"" > > I want to obtain its normal version and test it under the system's > shell terminal. Any hints for deleting the escape characters correctly > from the above command in Emacs way? You have basically two options: 1. Knowing the string syntax rules, you can interpret the escapes in your head, removing the double quotes at start and end and replacing each \" =E2=86=92 " and \\ =E2=86=92 \. 2. Or you can use an Emacs function that accepts a string and causes its interpreted contents to be inserted into some buffer, e.g. (message "=E2=80=A6") or (insert "=E2=80=A6"). $ emacs -Q (insert "curl -s https://api.mathpix.com/v3/latex -X POST -H \"app_id: %s\" -H \"app_key: %s\" -H \"Content-Type: application/json\" --data \"{\\\"src\\\":\\\"%s\\\",\\\"formats\\\":[\\\"latex_styled\\\"],\\\"format= _options\\\":{\\\"latex_styled\\\":{\\\"transforms\\\": [\\\"rm_spaces\\\"]}}}\"") Either way, you get: curl -s https://api.mathpix.com/v3/latex -X POST -H "app_id: %s" -H "app_key: %s" -H "Content-Type: application/json" --data "{\"src\":\"%s\",\"formats\":[\"latex_styled\"],\"format_options\":{\"latex= _styled\":{\"transforms\": [\"rm_spaces\"]}}}" Before you can try this in your terminal, you=E2=80=99ll need to substitute the %s placeholders.