emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* bug#50218: 28.0.50; org-babel-tangle-file tangles code blocks starting with #+begin_src :tangle no
       [not found] <9d143449-d2db-179b-24da-b4e4d6a33319@gmail.com>
@ 2021-12-18 22:16 ` Kyle Meyer
  2022-10-17 12:24 ` Ihor Radchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Kyle Meyer @ 2021-12-18 22:16 UTC (permalink / raw)
  To: Tassilo Neubauer; +Cc: 50218

Tassilo Neubauer writes:

> Hello,
>
> 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
> "

(Sorry for the delayed reply.  This message, unlike the initial post,
will be redirected to the Org list, where you're more likely to get a
response.)

Org sees the last block above as a source block of language ":tangle".
Here's what org-element-at-point reports:

  (src-block (:language ":tangle" :switches nil :parameters "yes"...)

org-lint will complain about this block:

     2 nil   Missing colon in header argument "yes"

And, were you to use a bare source block (i.e. drop ":tangle no"), it
would complain about a missing language:

     2 nil   Missing language in source block

So, I think the source block is mis-specified, and I'm not sure there's
much that Org should do here, but perhaps others will chime in with
their thoughts.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#50218: 28.0.50; org-babel-tangle-file tangles code blocks starting with #+begin_src :tangle no
       [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
  2024-01-29 15:16   ` Ihor Radchenko
  1 sibling, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2022-10-17 12:24 UTC (permalink / raw)
  To: Tassilo Neubauer; +Cc: 50218

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>




^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#50218: 28.0.50; org-babel-tangle-file tangles code blocks starting with #+begin_src :tangle no
  2022-10-17 12:24 ` Ihor Radchenko
@ 2024-01-29 15:16   ` Ihor Radchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2024-01-29 15:16 UTC (permalink / raw)
  To: Tassilo Neubauer; +Cc: 50218-done

Ihor Radchenko <yantar92@posteo.net> writes:

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

org-lint does catch such problem.
Not a bug.
Closing.

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-29 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
2024-01-29 15:16   ` Ihor Radchenko

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