emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Tassilo Neubauer <tassilo.neubauer@gmail.com>
Cc: 50218@debbugs.gnu.org
Subject: bug#50218: 28.0.50; org-babel-tangle-file tangles code blocks starting with #+begin_src :tangle no
Date: Mon, 17 Oct 2022 12:24:15 +0000	[thread overview]
Message-ID: <87mt9uprio.fsf@localhost> (raw)
In-Reply-To: <9d143449-d2db-179b-24da-b4e4d6a33319@gmail.com>

Tassilo Neubauer <tassilo.neubauer@gmail.com> writes:

> Here are the steps that led to code blocks being tangled I did not 
> expect to:
>
> emacs -Q
> C-x C-h: ~/org-roam/example.org
> content of example.org (excluding "):
> "
> #+begin_src emacs-lisp
> (setq some-emacs-lisp-variable t)
> #+end_src
>
> #+begin_src :tangle no
> ;;This line should not be in the elisp code
> #+end_src
> "
>
> open scratch buffer through menu.
> type into scratch buffer:
> (org-bable-tangle-file "/home/tassilo/org-roam/example.org"
> "/home/tassilo/org-roam/example.el")
> M-x:emacs-lisp-mode
> Select (with mouse) the above line and evaluate region through menu.
> I see in the minibuffer: "Tangled 2 code blocks from example.org"
> After typing C-h C-f: ~/org-roam/example.el
> I see the file content of "example.el" (excluding "):
> "
> (setq some-emacs-lisp-variable t)
>
> ;;This line should not be in the elisp code
>
> "

Well. I can see why you did not expect this, but the real cause is a
typo in your code block.

#+begin_src :tangle no
;;This line should not be in the elisp code
#+end_src

is viewed by Org mode as src block written in ":tangle" programming
language :) That's because you forgot to put language in the block and
Org takes the first word after #+begin_src and the language name.

This block does not have :tangle attribute and thus "example.el"
supplied in your function call is being used :)

On Org side, we may catch such scenarios in org-lint.
M-x org-lint currently reports no problem with the above block.

Not urgent fix. Patches are welcome :)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




  parent reply	other threads:[~2022-10-17 12:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9d143449-d2db-179b-24da-b4e4d6a33319@gmail.com>
2021-12-18 22:16 ` bug#50218: 28.0.50; org-babel-tangle-file tangles code blocks starting with #+begin_src :tangle no Kyle Meyer
2022-10-17 12:24 ` Ihor Radchenko [this message]
2024-01-29 15:16   ` 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:
  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=87mt9uprio.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=50218@debbugs.gnu.org \
    --cc=tassilo.neubauer@gmail.com \
    /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).