emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Luis Osa <luis.osa.gdc@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Problem when tangling source blocks with custom coderefs
Date: Tue, 18 Jan 2022 23:20:11 +0100	[thread overview]
Message-ID: <CAHf_bEO7TuOA6aa-DjYb3PWTfvBybvncDGa1iQ+6dBsTQ1ShdA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]

Dear all,

I would like to tangle source code blocks that contain coderefs. I have
found that the coderefs are correctly filtered out from the tangled files
if they follow the default format, i.e. "(ref:%s)", but not if I try to
customize the format using the documented "-l" switch [1] to change them to
something else, e.g. "|%s|".

Here is an example:

    #+begin_src python -r -l "|%s|" :tangle example.py
    except:            |\label{line:except}\ding{182}|

    In line \ref{line:except}, marked \ding{182}, we are catching all
exceptions ...

After using `org-babel-tangle`, I would expect `example.py` to not have any
of the text between the `||` characters, but it is there and it makes the
file invalid to run.

I have found a thread in this mail list [2] where the coderef format used
during tangle is streamlined to use the function `org-src-coderef-regexp`.
That seems to be correct, but the behavior I am seeing does not recognize
the custom format correctly. Can someone please tell me if I am doing
something wrong? Or is that function not doing what it is intended to do?

I am running Org mode version 9.6 on top of GNU Emacs 27.2.

Thank you,

[1] https://orgmode.org/manual/Literal-Examples.html

[-- Attachment #2: Type: text/html, Size: 2124 bytes --]

             reply	other threads:[~2022-01-18 22:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 22:20 Luis Osa [this message]
2022-01-19  1:33 ` Problem when tangling source blocks with custom coderefs Tom Gillespie
2022-01-19 21:00   ` Luis Osa
2022-10-23  5:37   ` Ihor Radchenko
2022-11-10  6:27 ` Ihor Radchenko

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=CAHf_bEO7TuOA6aa-DjYb3PWTfvBybvncDGa1iQ+6dBsTQ1ShdA@mail.gmail.com \
    --to=luis.osa.gdc@gmail.com \
    --cc=emacs-orgmode@gnu.org \


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