* 'C-q C-j' looks ugly in code
@ 2013-07-26 8:25 Thorsten Jolitz
2013-07-26 8:46 ` Eli Zaretskii
2013-07-26 8:49 ` Eric Abrahamsen
0 siblings, 2 replies; 5+ messages in thread
From: Thorsten Jolitz @ 2013-07-26 8:25 UTC (permalink / raw)
To: help-gnu-emacs
Hi List,
assume I write elisp code to replace occurences of "^J" in a string with
the actual line-feeds, i.e. with C-q C-j.
That works, but looks really ugly in the code:
#+begin_src emacs-lisp
(if A
(if B
(if C
;; deeply indented code
(replace-string "^J" "
" nil beg end)
(message "C"))
(message "B"))
(message "A"))
#+end_src
Is there a way to write C-q C-j in source code that does not actually
inserts the line-feeds?
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 'C-q C-j' looks ugly in code
2013-07-26 8:25 'C-q C-j' looks ugly in code Thorsten Jolitz
@ 2013-07-26 8:46 ` Eli Zaretskii
2013-07-26 8:49 ` Eric Abrahamsen
1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2013-07-26 8:46 UTC (permalink / raw)
To: help-gnu-emacs
> From: Thorsten Jolitz <tjolitz@gmail.com>
> Date: Fri, 26 Jul 2013 10:25:30 +0200
>
> Is there a way to write C-q C-j in source code that does not actually
> inserts the line-feeds?
I'd use \n.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 'C-q C-j' looks ugly in code
2013-07-26 8:25 'C-q C-j' looks ugly in code Thorsten Jolitz
2013-07-26 8:46 ` Eli Zaretskii
@ 2013-07-26 8:49 ` Eric Abrahamsen
2013-07-26 10:39 ` Thorsten Jolitz
1 sibling, 1 reply; 5+ messages in thread
From: Eric Abrahamsen @ 2013-07-26 8:49 UTC (permalink / raw)
To: help-gnu-emacs
Thorsten Jolitz <tjolitz@gmail.com> writes:
> Hi List,
>
> assume I write elisp code to replace occurences of "^J" in a string with
> the actual line-feeds, i.e. with C-q C-j.
>
> That works, but looks really ugly in the code:
>
> #+begin_src emacs-lisp
> (if A
> (if B
> (if C
> ;; deeply indented code
> (replace-string "^J" "
> " nil beg end)
> (message "C"))
> (message "B"))
> (message "A"))
> #+end_src
>
> Is there a way to write C-q C-j in source code that does not actually
> inserts the line-feeds?
I just tested this in scratch, and it looks like (replace-string "^J" "\n")
works as expected...
Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 'C-q C-j' looks ugly in code
2013-07-26 8:49 ` Eric Abrahamsen
@ 2013-07-26 10:39 ` Thorsten Jolitz
2013-07-26 13:39 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Jolitz @ 2013-07-26 10:39 UTC (permalink / raw)
To: help-gnu-emacs
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>> Is there a way to write C-q C-j in source code that does not actually
>> inserts the line-feeds?
>
> I just tested this in scratch, and it looks like (replace-string "^J" "\n")
> works as expected...
Of course, I used "\n" so often, forgot that its just another way to
enter ^J ... well, thanks anyway.
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 'C-q C-j' looks ugly in code
2013-07-26 10:39 ` Thorsten Jolitz
@ 2013-07-26 13:39 ` Stefan Monnier
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2013-07-26 13:39 UTC (permalink / raw)
To: help-gnu-emacs
> Of course, I used "\n" so often, forgot that its just another way to
> enter ^J ... well, thanks anyway.
You can also use "\^j" or "\C-j" or "\x0a" or "\012".
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-26 13:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-26 8:25 'C-q C-j' looks ugly in code Thorsten Jolitz
2013-07-26 8:46 ` Eli Zaretskii
2013-07-26 8:49 ` Eric Abrahamsen
2013-07-26 10:39 ` Thorsten Jolitz
2013-07-26 13:39 ` Stefan Monnier
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.