With Emacs 27.2, I want to generate a list of stuff with em- bedded Emacs Lisp scripts to work on it. The Emacs Lisp scripts have newlines as string literals in them.
When I evaluate: | #+BEGIN_SRC elisp :results raw :var number-of-lines=1 | (mapconcat | (lambda (i) | (concat | (org-link-make-string (concat "elisp:" (prin1-to-string `(message "Hello, World %d!\n" ,i))) (format "Test #1.%d" i)) | "\n")) | (number-sequence 1 number-of-lines) | "") | #+END_SRC for the first time with C-c C-c, I get: | #+RESULTS: | [[elisp:(message "Hello, World %d! | " 1)][Test #1.1]] which, if shown in org-mode, is and works exactly correct. (When I rerun C-C C-c, I get: | #+RESULTS: | [[elisp:(message "Hello, World %d! | " 1)][Test #1.1]] | " 1)][Test #1.1]] which is not correct, but does not bother me much.) When I evalute: | #+BEGIN_SRC elisp :results raw :var number-of-lines=10 | (mapconcat | (lambda (i) | (concat | (org-link-make-string (concat "elisp:" (prin1-to-string `(message "Hello, World %d!\n" ,i))) (format "Test #1.%d" i)) | "\n")) | (number-sequence 1 number-of-lines) | "") | #+END_SRC I get: | #+RESULTS: | [[elisp:(message "Hello, World %d! | " 1)][Test #1.1]] | [[elisp:(message "Hello, World %d! | " 2)][Test #1.2]] | [[elisp:(message "Hello, World %d! | " 3)][Test #1.3]] | [[elisp:(message "Hello, World %d! | " 4)][Test #1.4]] | [[elisp:(message "Hello, World %d! | " 5)][Test #1.5]] | [[elisp:(message "Hello, World %d! | " 6)][Test #1.6]] | [[elisp:(message "Hello, World %d! | " 7)][Test #1.7]] | [[elisp:(message "Hello, World %d! | " 8)][Test #1.8]] | [[elisp:(message "Hello, World %d! | " 9)][Test #1.9]] | [[elisp:(message "Hello, World %d! | " 10)][Test #1.10]] where the last link ("Test #1.10") is not recognized by org-mode and not clickable. My guess is that org-link-make-string should escape new- lines, but does not, and the org-mode parser is liberal enough to "fix" some links, but not all.