emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Cannot insert multiple multi-line elisp links [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]
@ 2021-08-08  8:13 Tim Landscheidt
  2021-08-08 14:08 ` Tim Landscheidt
  2021-08-09  8:27 ` Eric S Fraga
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Landscheidt @ 2021-08-08  8:13 UTC (permalink / raw)
  To: emacs-orgmode

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.


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

* Re: Bug: Cannot insert multiple multi-line elisp links [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]
  2021-08-08  8:13 Bug: Cannot insert multiple multi-line elisp links [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)] Tim Landscheidt
@ 2021-08-08 14:08 ` Tim Landscheidt
  2021-08-09  8:27 ` Eric S Fraga
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Landscheidt @ 2021-08-08 14:08 UTC (permalink / raw)
  To: emacs-orgmode

(Sidenote: The issue can be worked around by replacing "\n"
with (make-string 1 10).)



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

* Re: Bug: Cannot insert multiple multi-line elisp links [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]
  2021-08-08  8:13 Bug: Cannot insert multiple multi-line elisp links [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)] Tim Landscheidt
  2021-08-08 14:08 ` Tim Landscheidt
@ 2021-08-09  8:27 ` Eric S Fraga
  2021-08-09  8:36   ` Tim Landscheidt
  1 sibling, 1 reply; 4+ messages in thread
From: Eric S Fraga @ 2021-08-09  8:27 UTC (permalink / raw)
  To: Tim Landscheidt; +Cc: emacs-orgmode

What if you escape the \n, i.e. \\n?
-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-607-g185706
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

* Re: Bug: Cannot insert multiple multi-line elisp links [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]
  2021-08-09  8:27 ` Eric S Fraga
@ 2021-08-09  8:36   ` Tim Landscheidt
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Landscheidt @ 2021-08-09  8:36 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> What if you escape the \n, i.e. \\n?

Then org-mode's display is correct, but the message call
will not output a newline, but a backslash and an "n" :-).

Tim


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

end of thread, other threads:[~2021-08-09  8:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-08  8:13 Bug: Cannot insert multiple multi-line elisp links [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)] Tim Landscheidt
2021-08-08 14:08 ` Tim Landscheidt
2021-08-09  8:27 ` Eric S Fraga
2021-08-09  8:36   ` Tim Landscheidt

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).