emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix erroneous tangling of blocks
@ 2021-07-01  3:50 Jacopo De Simoi
  2021-07-01 13:38 ` Timothy
  0 siblings, 1 reply; 3+ messages in thread
From: Jacopo De Simoi @ 2021-07-01  3:50 UTC (permalink / raw)
  To: emacs-orgmode

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

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-ob-tangle.el-Parse-correctly-tangle-options.patch --]
[-- Type: text/x-patch; name=0002-ob-tangle.el-Parse-correctly-tangle-options.patch, Size: 1127 bytes --]

From 4ae3b326750e094b359de5c920cc9695edbea16d Mon Sep 17 00:00:00 2001
From: Jacopo De Simoi <jacopods@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 #3: attachment.asc --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

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

end of thread, other threads:[~2021-07-01 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01  3:50 [PATCH] Fix erroneous tangling of blocks Jacopo De Simoi
2021-07-01 13:38 ` Timothy
2021-07-01 13:43   ` Nicolas Goaziou

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