emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bruno Barbier <brubar.cs@gmail.com>
To: Rodrigo Morales <rodrigo-mailing-lists@morales.pe>,
	emacs-orgmode@gnu.org
Subject: Re: Why Emacs shows ^M at the end of some lines in sh code blocks that use curl?
Date: Thu, 17 Oct 2024 20:14:58 +0200	[thread overview]
Message-ID: <67115424.df0a0220.20f4.03e0@mx.google.com> (raw)
In-Reply-To: <87r08eepm4.fsf@morales.pe>


Hi Rodrigo,

Rodrigo Morales <rodrigo-mailing-lists@morales.pe> writes:

> I saved the contents of the code block below to the file =/tmp/a.org=.
>
>
> I wish those ^M were not shown in the sh code blocks in the Org Mode
> buffer. Does anyone know how to accomplish this behavior?
>

Your result is mixing different "end-of-line" conventions.  If you
redirect the result into a file and open it with Emacs, you will get the
same result: it's not related to Org (HTTP headers use '\r\n', your JSON
'\n').

You could include a translation step. For example, using 'tr':
   #+begin_src shell :results raw
     curl --include --silent https://filesampleshub.com/download/code/json/sample1.json | tr -d '\r'
   #+end_src
   
If you are fetching arbitrary data, you do not want to do that though.
You may ask curl to dump the headers in a file, and translate only
that file (using --dump-header).

Note that getting any JSON file out there should give the same result;
i.e. no need to install Flask :)


HTH,

Bruno



      reply	other threads:[~2024-10-17 18:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 15:05 Why Emacs shows ^M at the end of some lines in sh code blocks that use curl? Rodrigo Morales
2024-10-17 18:14 ` Bruno Barbier [this message]

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.orgmode.org/

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

  git send-email \
    --in-reply-to=67115424.df0a0220.20f4.03e0@mx.google.com \
    --to=brubar.cs@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rodrigo-mailing-lists@morales.pe \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).