emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: emacs-orgmode@gnu.org
Subject: Bug: Cannot insert multiple multi-line elisp links [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]
Date: Sun, 08 Aug 2021 08:13:41 +0000	[thread overview]
Message-ID: <87h7g0xsju.fsf@vagabond.tim-landscheidt.de> (raw)

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.


             reply	other threads:[~2021-08-08  8:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-08  8:13 Tim Landscheidt [this message]
2021-08-08 14:08 ` 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-09  8:27 ` Eric S Fraga
2021-08-09  8:36   ` Tim Landscheidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7g0xsju.fsf@vagabond.tim-landscheidt.de \
    --to=tim@tim-landscheidt.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).