Dear All,

 Please find attached a patch (against master) which takes care of the
following issue. Assume I have a block like this

#+begin_src sh :tangle no
  This should not be tangled
#+end_src

Then the block is correctly ignored when tangling the whole file, but
erroneously tangled (to a file named "no") when tangling is run with the
universal argument (so that only the current block should be tangled)

This happens because the check for the "no" option is not performed when
tangling a single block.  In the proposed patch I address this issue by
checking for the "no" option in the function org-babel-effective-tangled-
filename
From 4ae3b326750e094b359de5c920cc9695edbea16d Mon Sep 17 00:00:00 2001
From: Jacopo De Simoi <jacop...@protonmail.com>
Date: Wed, 30 Jun 2021 23:33:56 -0400
Subject: [PATCH 2/2] ob-tangle.el: Parse correctly tangle options

* lisp/ob-tangle.el (org-babel-effective-tangled-filename): Check for
  the "no" parameter in this function to avoid erroneous tangling of a
  single block (e.g. with C-u C-c C-v t) even with the parameter
  :tangle no

TINYCHANGE
---
 lisp/ob-tangle.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 02379d44e..585020364 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -359,6 +359,7 @@ as computed by `org-babel-tangle-single-block'."
                     ((string= "yes" src-tfile)
                      ;; Use the buffer name
                      (file-name-sans-extension buffer-fn))
+                    ((string= "no" src-tfile) nil)
                     ((> (length src-tfile) 0) src-tfile)))
         (ext (or (cdr (assoc src-lang org-babel-tangle-lang-exts)) src-lang)))
     (when base-name
-- 
2.31.1

Attachment: attachment.asc
Description: PGP signature

Reply via email to