1

When run ls to print the file list

#+begin_src ipython :session sql :results output
! ls | head -n 5


#+end_src

#+RESULTS:
: create.txt^M
: Lesson 10. Grouping Data.md^M
: Lesson 11. Working with Subqueries.md^M
: Lesson 12. Joining Tables.md^M
: Lesson 13. Creating Advanced Joins.md^M

There are always ^M characters appended,

My machine info:

$ uname -a
Linux alpha 5.3.0-24-generic #26-Ubuntu SMP Thu Nov 14 01:33:18 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

How can I disable such a line-ending representation?

My machine is " Distributor ID: Ubuntu Description: Ubuntu 19.10 Release: 19.10 Codename: eoan "

2

Those Control-M characters (^M) are no doubt end-of-line chars used by your OS - probably MS Windows.

(Please provide your OS/platform in the question. And if it's Windows then state how you are using OS command ls - e.g., Cygwin, ls-lisp.el, or something else.)

You can control this ^M display using the buffer coding for line endings. Something like this might be all you need:

(setq-default buffer-file-coding-system (coding-system-change-eol-conversion
                                         (default-value 'buffer-file-coding-system)
                                         'unix))

But for more information, see these nodes in the Emacs manual:

  • My machine is " Distributor ID: Ubuntu Description: Ubuntu 19.10 Release: 19.10 Codename: eoan " – Alice Dec 22 '19 at 2:24
  • Please put all such info in the question itself. Comments can be deleted at any time. Thx. – Drew Dec 22 '19 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.