all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Make Emacs print "^J" instead of "\n" with `print-escape-newlines'?
@ 2013-11-20 19:57 Thorsten Jolitz
  2013-11-20 20:35 ` Thorsten Jolitz
       [not found] ` <mailman.6684.1384979733.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2013-11-20 19:57 UTC (permalink / raw)
  To: help-gnu-emacs


Hi List, 

is there any way to make Emacs print "^J" instead of "\n" with
(print-escape-newlines t)?

If not, how can I replace the newlines in a string with the string "^J"?

-- 
cheers,
Thorsten





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Make Emacs print "^J" instead of "\n" with `print-escape-newlines'?
  2013-11-20 19:57 Make Emacs print "^J" instead of "\n" with `print-escape-newlines'? Thorsten Jolitz
@ 2013-11-20 20:35 ` Thorsten Jolitz
       [not found] ` <mailman.6684.1384979733.10748.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2013-11-20 20:35 UTC (permalink / raw)
  To: help-gnu-emacs

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Hi List, 
>
> is there any way to make Emacs print "^J" instead of "\n" with
> (print-escape-newlines t)?
>
> If not, how can I replace the newlines in a string with the string "^J"?

Ok, forget the second part of the question, thats easy ... I forgot
somehow. 

But I would still be interested in the first part.

-- 
cheers,
Thorsten




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Make Emacs print "^J" instead of "\n" with `print-escape-newlines'?
       [not found] ` <mailman.6684.1384979733.10748.help-gnu-emacs@gnu.org>
@ 2013-11-20 20:48   ` Damien Wyart
  2013-11-20 23:41     ` Thorsten Jolitz
  0 siblings, 1 reply; 4+ messages in thread
From: Damien Wyart @ 2013-11-20 20:48 UTC (permalink / raw)
  To: help-gnu-emacs

* Thorsten Jolitz <tjolitz@gmail.com> in gnu.emacs.help:
> > is there any way to make Emacs print "^J" instead of "\n" with
> > (print-escape-newlines t)?

> But I would still be interested in the first part.

I think you would need to modify the following part of src/print.c:

          if (c == '\n' && print_escape_newlines)
        {
          PRINTCHAR ('\\');
          PRINTCHAR ('n');
        }

(not sure how to tell PRINTCHAR to print ^J) and recompile Emacs.

-- 
DW


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Make Emacs print "^J" instead of "\n" with `print-escape-newlines'?
  2013-11-20 20:48   ` Damien Wyart
@ 2013-11-20 23:41     ` Thorsten Jolitz
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2013-11-20 23:41 UTC (permalink / raw)
  To: help-gnu-emacs

Damien Wyart <damien.wyart@free.fr> writes:

> * Thorsten Jolitz <tjolitz@gmail.com> in gnu.emacs.help:
>> > is there any way to make Emacs print "^J" instead of "\n" with
>> > (print-escape-newlines t)?
>
>> But I would still be interested in the first part.
>
> I think you would need to modify the following part of src/print.c:
>
>           if (c == '\n' && print_escape_newlines)
>         {
>           PRINTCHAR ('\\');
>           PRINTCHAR ('n');
>         }
>
> (not sure how to tell PRINTCHAR to print ^J) and recompile Emacs.

I see, although thats probably a bit too low-level for me. But thanks
for the hint, it motivated me to finally download the Emacs sources, the
C code seems to be quite readable - even when not knowing much about C
at all.

-- 
cheers,
Thorsten




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-20 23:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 19:57 Make Emacs print "^J" instead of "\n" with `print-escape-newlines'? Thorsten Jolitz
2013-11-20 20:35 ` Thorsten Jolitz
     [not found] ` <mailman.6684.1384979733.10748.help-gnu-emacs@gnu.org>
2013-11-20 20:48   ` Damien Wyart
2013-11-20 23:41     ` Thorsten Jolitz

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.