In common-lisp we have the library cl-heredoc, is there an equivalent in EmacsLisp?
Ordinary Emacs Lisp strings are multi-line-capable. You can simply put newlines in them.
cl-heredoc, it sounds like what you are looking for is "raw" strings. There was a proposal to add these to elisp a while back, but unfortunately it was rejected. (I hope rather than expect it could be resurrected.) Nor does elisp have the reader extensibility features needed to implement this oneself.
If you are configuring emacs via an init.el file you might want to consider using an init.org instead.
Then you can use constructs like the following:
#+NAME: arbitrary-text #+begin_src xml <some> <random src="xml">or whatever... includes syntax highlighting!</random> </some> #+end_src #+begin_src emacs-lisp :var arb-text=arbitrary-text (eval `(defun a-test () (format "whoop there it is: %S" ,arb-text))) #+end_src
If you look in the generated
.el file you will see something like:
(let ((arb-text "escaped text here...")) (eval `(defun a-test () (format "whoop there it is: %S" ,arb-text))))
You can put the text and the code in any order. You can add names to Org lists, tables etc.
If this is for a library where you may not want to force collaborators to also use 'literate programming' then you could put the bulk of the code into an
.el file and generate an auxiliary
.el file using Org -- check the generated code into revision control.