[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to set the name of a source code block programatically?

From: Rodrigo Morales
Subject: How to set the name of a source code block programatically?
Date: Mon, 15 Feb 2021 13:56:00 -0500
User-agent: mu4e 1.4.14; emacs 27.1

At a first glance, this task seems to be easy:

1. Go to the top of the source code block
2. Insert "#+NAME: <<name>>" or replace the current name.
3. Done.

However, there are multiple scenarios. The attached file =main.org=
contains the possible scenarios that the function must cover in order to
be considered usable.

Anyway, I could write the function but before spending time doing that I
was wondering if there exist some solutions out there.

The motivation for this question is to make names of code blocks include
the ID of the current heading so that name clashes doesn'tf occur in Orgf
mode files. Recall that =M-x org-lint= complains when there are two code
blocks with the same name in the same file. This means that if you have
a code block with name =generate-data=, you can't use that same name in
that specific file.

Attachment: main.org
Description: Text document

Rodrigo Morales.

IRC: rdrg109 (freenode)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]