emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Lin Sun <sunlin7@hotmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: *doc/org-manual.org: Fix the description for "Internal Link" in the org-mode manual
Date: Thu, 02 Jun 2022 22:32:50 +0800	[thread overview]
Message-ID: <87ilpj9lv1.fsf@localhost> (raw)
In-Reply-To: <87mtev9mng.fsf@localhost>

Ihor Radchenko <yantar92@gmail.com> writes:

> This should not happen, AFAIU. Instead of suggesting unintuitive
> workarounds in the manual, we need to fix the original problem.

I looked into this further. Org actually behaves correctly in your
example. Please refer to 16.7 Exporting Code Blocks.

Basically, the default Org behavior when exporting blocks is :export
code. Org removes all the results of evaluation.

If you have

#+begin_src python :results table
  return 1

#+NAME: Test


then Org removes the result on export and you end up with:

#+begin_src python :results table
  return 1

#+NAME: Test


The link becomes invalid because the result block disappears and there
will be nothing to refer to.

So, you need to keep in mind that naming source block results is not a
good idea to start with. They are meant to change as you execute the
source block and the fact the your #+name: attribute was not removed
when you execute the code block manually is just a coincidence.

The right way to reference code blocks would be 

#+NAME: Test
#+begin_src python :results table
  return 1

| 1 |


Note that Org automatically assigns the correct name to results. It has
different syntax.

In summary, there is no _bug_ on Org side here. However, the behavior is
indeed not very intuitive. This kind of scenario should probably be
added to org-lint, so that users can be warned about assigning
attributes to src block results.


  reply	other threads:[~2022-06-02 14:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02  0:16 *doc/org-manual.org: Fix the description for "Internal Link" in the org-mode manual Lin Sun
2022-06-02 14:15 ` Ihor Radchenko
2022-06-02 14:32   ` Ihor Radchenko [this message]
2022-06-02 16:37     ` Lin Sun
2022-06-03  6:13       ` Ihor Radchenko
2022-06-03 15:13         ` Lin Sun

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:

  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=87ilpj9lv1.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=sunlin7@hotmail.com \


* 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


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).