* Bug: COMMENT and noweb-ref
@ 2019-09-16 21:33 Sebastian Miele
2019-09-16 21:39 ` Sebastian Miele
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Sebastian Miele @ 2019-09-16 21:33 UTC (permalink / raw)
To: emacs-orgmode
org-babel-tangle on
* A
#+BEGIN_SRC elisp :tangle yes :noweb yes
;; A
<<B>>
#+END_SRC
* COMMENT B
#+BEGIN_SRC elisp :noweb-ref B
;; B
#+END_SRC
* COMMENT C
#+BEGIN_SRC elisp :tangle yes
;; C
#+END_SRC
produces a file with A and B in it. Expected: Just A. Changing
#+BEGIN_SRC elisp :noweb-ref B
;; B
#+END_SRC
to
# #+BEGIN_SRC elisp :noweb-ref B
# ;; B
# #+END_SRC
does yield the expected result.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug: COMMENT and noweb-ref
2019-09-16 21:33 Bug: COMMENT and noweb-ref Sebastian Miele
@ 2019-09-16 21:39 ` Sebastian Miele
2019-09-26 16:58 ` Sebastian Miele
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Sebastian Miele @ 2019-09-16 21:39 UTC (permalink / raw)
To: emacs-orgmode
GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10) of 2019-08-29
Org mode version 9.2.6 (release_9.2.6-538-g23113f @ /home/w/borg/emacs/org/lisp/)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug: COMMENT and noweb-ref
2019-09-16 21:33 Bug: COMMENT and noweb-ref Sebastian Miele
2019-09-16 21:39 ` Sebastian Miele
@ 2019-09-26 16:58 ` Sebastian Miele
2019-09-26 18:09 ` Marco Wahl
2019-10-08 20:34 ` Sebastian Miele
2019-10-20 22:09 ` [PATCH] " Sebastian Miele
2019-10-20 22:30 ` Sebastian Miele
3 siblings, 2 replies; 9+ messages in thread
From: Sebastian Miele @ 2019-09-26 16:58 UTC (permalink / raw)
To: emacs-orgmode
In the following days I will try to fix it and write a regression test.
However, in the unlikely case that this is a feature and not a bug,
please let me know. Please also let me know, if anyone is already on it.
Sebastian Miele <sebastian.miele@gmail.com> writes:
> org-babel-tangle on
>
> * A
>
> #+BEGIN_SRC elisp :tangle yes :noweb yes
> ;; A
> <<B>>
> #+END_SRC
>
> * COMMENT B
>
> #+BEGIN_SRC elisp :noweb-ref B
> ;; B
> #+END_SRC
>
> * COMMENT C
>
> #+BEGIN_SRC elisp :tangle yes
> ;; C
> #+END_SRC
>
> produces a file with A and B in it. Expected: Just A. Changing
>
> #+BEGIN_SRC elisp :noweb-ref B
> ;; B
> #+END_SRC
>
> to
>
> # #+BEGIN_SRC elisp :noweb-ref B
> # ;; B
> # #+END_SRC
>
> does yield the expected result.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug: COMMENT and noweb-ref
2019-09-26 16:58 ` Sebastian Miele
@ 2019-09-26 18:09 ` Marco Wahl
2019-10-02 13:38 ` Sebastian Miele
2019-10-08 20:34 ` Sebastian Miele
1 sibling, 1 reply; 9+ messages in thread
From: Marco Wahl @ 2019-09-26 18:09 UTC (permalink / raw)
To: emacs-orgmode
Sebastian Miele <sebastian.miele@gmail.com> writes:
> In the following days I will try to fix it and write a regression test.
>
> However, in the unlikely case that this is a feature and not a bug,
> please let me know. Please also let me know, if anyone is already on it.
>
> Sebastian Miele <sebastian.miele@gmail.com> writes:
>
>> org-babel-tangle on
>>
>> * A
>>
>> #+BEGIN_SRC elisp :tangle yes :noweb yes
>> ;; A
>> <<B>>
>> #+END_SRC
>>
>> * COMMENT B
>>
>> #+BEGIN_SRC elisp :noweb-ref B
>> ;; B
>> #+END_SRC
>> [...]
>>
>> produces a file with A and B in it. Expected: Just A. Changing
>>
>> #+BEGIN_SRC elisp :noweb-ref B
>> ;; B
>> #+END_SRC
>>
>> to
>>
>> # #+BEGIN_SRC elisp :noweb-ref B
>> # ;; B
>> # #+END_SRC
>>
>> does yield the expected result.
Your expectation looks right to me. I guess nobody thought about this
case before.
Happy hacking,
--
Marco
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug: COMMENT and noweb-ref
2019-09-26 18:09 ` Marco Wahl
@ 2019-10-02 13:38 ` Sebastian Miele
0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Miele @ 2019-10-02 13:38 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 79 bytes --]
First, here is a patch introducing tests concerning Org comments and
tangling.
[-- Attachment #2: 0001-ob-tangle-Add-tests.patch --]
[-- Type: text/plain, Size: 2359 bytes --]
From c769435b9ab11f7a3b5ff5f1ec2df95ae2c6aa32 Mon Sep 17 00:00:00 2001
From: Sebastian Miele <sebastian.miele@gmail.com>
Date: Wed, 2 Oct 2019 13:02:46 +0000
Subject: [PATCH] ob-tangle: Add tests
* testing/lisp/test-ob-tangle.el (ob-tangle/commented-src-blocks):
(ob-tangle/commented-src-blocks-with-nowebref): Add tests.
---
testing/lisp/test-ob-tangle.el | 85 ++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index 47c31dff5..675f0714b 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -296,6 +296,91 @@ another block
(org-split-string (buffer-string))))
(delete-file file))))))
+(ert-deftest ob-tangle/commented-src-blocks ()
+ "Test omission of commented src blocks."
+ (should
+ (equal '("A")
+ (let ((file (make-temp-file "org-tangle-")))
+ (unwind-protect
+ (progn
+ (org-test-with-temp-text-in-file
+ (format "#+property: header-args :tangle %S
+* A
+
+ #+BEGIN_SRC emacs-lisp
+ A
+ #+END_SRC
+
+* COMMENT B
+
+ #+BEGIN_SRC emacs-lisp
+ B
+ #+END_SRC
+
+* C
+
+ # #+BEGIN_SRC emacs-lisp
+ # C
+ # #+END_SRC
+
+* D
+
+ #+BEGIN_COMMENT
+ #+BEGIN_SRC emacs-lisp
+ D
+ #+END_SRC
+ #+END_COMMENT"
+ file)
+ (org-babel-tangle))
+ (with-temp-buffer
+ (insert-file-contents file)
+ (org-split-string (buffer-string))))
+ (delete-file file))))))
+
+(ert-deftest ob-tangle/commented-src-blocks-with-nowebref ()
+ "Test omission of commented src blocks with nowebref."
+ (should
+ (equal '("A")
+ (let ((file (make-temp-file "org-tangle-")))
+ (unwind-protect
+ (progn
+ (org-test-with-temp-text-in-file
+ (format "#+property: header-args :tangle %S
+* A
+
+ #+BEGIN_SRC elisp :noweb yes
+ A
+ <<B>>
+ <<C>>
+ <<D>>
+ #+END_SRC
+
+* COMMENT B
+
+ #+BEGIN_SRC elisp :noweb-ref B
+ B
+ #+END_SRC
+
+* C
+
+ # #+BEGIN_SRC elisp :noweb-ref C
+ # C
+ # #+END_SRC
+
+* D
+
+ #+BEGIN_COMMENT
+ #+BEGIN_SRC elisp :noweb-ref D
+ D
+ #+END_SRC
+ #+END_COMMENT"
+ file)
+ (org-babel-tangle))
+ (with-temp-buffer
+ (insert-file-contents file)
+ (org-split-string (buffer-string))))
+ (delete-file file))))))
+
(provide 'test-ob-tangle)
;;; test-ob-tangle.el ends here
--
2.23.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: Bug: COMMENT and noweb-ref
2019-09-26 16:58 ` Sebastian Miele
2019-09-26 18:09 ` Marco Wahl
@ 2019-10-08 20:34 ` Sebastian Miele
1 sibling, 0 replies; 9+ messages in thread
From: Sebastian Miele @ 2019-10-08 20:34 UTC (permalink / raw)
To: emacs-orgmode
I wrote:
> I wrote:
>
>> org-babel-tangle on
>>
>> * A
>>
>> #+BEGIN_SRC elisp :tangle yes :noweb yes
>> ;; A
>> <<B>>
>> #+END_SRC
>>
>> * COMMENT B
>>
>> #+BEGIN_SRC elisp :noweb-ref B
>> ;; B
>> #+END_SRC
>>
>> * COMMENT C
>>
>> #+BEGIN_SRC elisp :tangle yes
>> ;; C
>> #+END_SRC
>>
>> produces a file with A and B in it. Expected: Just A. Changing
>>
>> #+BEGIN_SRC elisp :noweb-ref B
>> ;; B
>> #+END_SRC
>>
>> to
>>
>> # #+BEGIN_SRC elisp :noweb-ref B
>> # ;; B
>> # #+END_SRC
>>
>> does yield the expected result.
>
> In the following days I will try to fix it and write a regression test.
I wanted to mention that this is still on my agenda. But it will take a
while. Among other things, I have to learn the formal syntax and the
element api of Org, before I can satisfactorily dive into ob-tangle.el.
Apart from that I had to seriously limit my Emacs time per day.
It may take several weeks. But it will happen.
Best wishes
Sebastian
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] COMMENT and noweb-ref
2019-09-16 21:33 Bug: COMMENT and noweb-ref Sebastian Miele
2019-09-16 21:39 ` Sebastian Miele
2019-09-26 16:58 ` Sebastian Miele
@ 2019-10-20 22:09 ` Sebastian Miele
2019-10-20 22:30 ` Sebastian Miele
3 siblings, 0 replies; 9+ messages in thread
From: Sebastian Miele @ 2019-10-20 22:09 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: 0001-ob-core-Respect-COMMENTed-headlines-when-expanding-n.patch --]
[-- Type: text/plain, Size: 2047 bytes --]
From ddf0b6d89d30766158311c047d6de10091cb0377 Mon Sep 17 00:00:00 2001
From: Sebastian Miele <sebastian.miele@gmail.com>
Date: Sun, 20 Oct 2019 21:34:02 +0000
Subject: [PATCH 1/2] ob-core: Respect COMMENTed headlines when expanding noweb
references
* lisp/ob-core.el (org-babel-expand-noweb-references): Add calls to
org-in-commented-heading-p where appropriate.
---
lisp/ob-core.el | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 572f97919..b99545ab5 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2780,7 +2780,8 @@ block but are passed literally to the \"example-block\"."
(concat (funcall c-wrap (car cs)) "\n"
b "\n"
(funcall c-wrap (cadr cs)))))))))
- (if (re-search-forward name-regexp nil t)
+ (if (and (re-search-forward name-regexp nil t)
+ (not (org-in-commented-heading-p)))
;; Found a source block named SOURCE-NAME.
;; Assume it is unique; do not look after
;; `:noweb-ref' header argument.
@@ -2791,14 +2792,16 @@ block but are passed literally to the \"example-block\"."
;; those with a matching Noweb reference.
(let ((expansion nil))
(org-babel-map-src-blocks nil
- (let* ((info (org-babel-get-src-block-info 'light))
- (parameters (nth 2 info)))
- (when (equal source-name
- (cdr (assq :noweb-ref parameters)))
- (push (funcall expand-body info) expansion)
- (push (or (cdr (assq :noweb-sep parameters))
- "\n")
- expansion))))
+ (unless (org-in-commented-heading-p)
+ (let* ((info
+ (org-babel-get-src-block-info 'light))
+ (parameters (nth 2 info)))
+ (when (equal source-name
+ (cdr (assq :noweb-ref parameters)))
+ (push (funcall expand-body info) expansion)
+ (push (or (cdr (assq :noweb-sep parameters))
+ "\n")
+ expansion)))))
(when expansion
(mapconcat #'identity
(nreverse (cdr expansion))
--
2.23.0
[-- Attachment #2: 0002-Add-tests-about-omission-of-commented-src-blocks-whe.patch --]
[-- Type: text/plain, Size: 3127 bytes --]
From 66c7904298a33900e389acb184fbe7511960b34d Mon Sep 17 00:00:00 2001
From: Sebastian Miele <sebastian.miele@gmail.com>
Date: Sun, 20 Oct 2019 21:38:03 +0000
Subject: [PATCH 2/2] Add tests about omission of commented src blocks when
e.g. tangling
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Add clause to
test.
* testing/lisp/test-ob-tangle.el (ob-tangle/commented-src-blocks): Add
test.
---
testing/lisp/test-ob-tangle.el | 84 ++++++++++++++++++++++++++++++++++
testing/lisp/test-ob.el | 24 ++++++++++
2 files changed, 108 insertions(+)
diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index 47c31dff5..301f7aff7 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -296,6 +296,90 @@ another block
(org-split-string (buffer-string))))
(delete-file file))))))
+(ert-deftest ob-tangle/commented-src-blocks ()
+ "Test omission of commented src blocks."
+ (should
+ (equal '("A")
+ (let ((file (make-temp-file "org-tangle-")))
+ (unwind-protect
+ (progn
+ (org-test-with-temp-text-in-file
+ (format "#+property: header-args :tangle %S
+* A
+
+ #+begin_src emacs-lisp
+ A
+ #+end_src
+
+* COMMENT B
+
+ #+begin_src emacs-lisp
+ B
+ #+end_src
+
+* C
+
+ # #+begin_src emacs-lisp
+ # C
+ # #+end_src
+
+* D
+
+ #+begin_comment
+ #+begin_src emacs-lisp
+ D
+ #+end_src
+ #+end_comment"
+ file)
+ (org-babel-tangle))
+ (with-temp-buffer
+ (insert-file-contents file)
+ (org-split-string (buffer-string))))
+ (delete-file file)))))
+ (should
+ (equal '("A")
+ (let ((file (make-temp-file "org-tangle-")))
+ (unwind-protect
+ (progn
+ (org-test-with-temp-text-in-file
+ (format "#+property: header-args :tangle %S
+* A
+
+ #+begin_src elisp :noweb yes
+ A
+ <<B>>
+ <<C>>
+ <<D>>
+ #+end_src
+
+* COMMENT B
+
+ #+begin_src elisp :noweb-ref B
+ B
+ #+end_src
+
+* C
+
+ # #+begin_src elisp :noweb-ref C
+ # C
+ # #+end_src
+
+* D
+
+ #+begin_comment
+ #+begin_src elisp :noweb-ref D
+ D
+ #+end_src
+ #+end_comment"
+ file)
+ (let (org-babel-noweb-error-all-langs
+ org-babel-noweb-error-langs)
+ (org-babel-tangle)))
+ (with-temp-buffer
+ (insert-file-contents file)
+ (org-split-string (buffer-string))))
+ (delete-file file))))))
+
(provide 'test-ob-tangle)
;;; test-ob-tangle.el ends here
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 367c70f83..681f3403e 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -758,6 +758,30 @@ x
#+name: bar
#+begin_src emacs-lisp
baz
+#+end_src"
+ (org-babel-expand-noweb-references))))
+ ;; Respect COMMENT headlines
+ (should
+ (equal "C"
+ (org-test-with-temp-text "
+#+begin_src emacs-lisp :noweb yes<point>
+ <<foo>>
+#+end_src
+
+* COMMENT A
+#+name: foo
+#+begin_src emacs-lisp
+ A
+#+end_src
+
+* COMMENT B
+#+begin_src emacs-lisp :noweb-ref foo
+ B
+#+end_src
+
+* C
+#+begin_src emacs-lisp :noweb-ref foo
+ C
#+end_src"
(org-babel-expand-noweb-references)))))
--
2.23.0
[-- Attachment #3: Type: text/plain, Size: 856 bytes --]
I wrote:
> org-babel-tangle on
>
> * A
>
> #+BEGIN_SRC elisp :tangle yes :noweb yes
> ;; A
> <<B>>
> #+END_SRC
>
> * COMMENT B
>
> #+BEGIN_SRC elisp :noweb-ref B
> ;; B
> #+END_SRC
>
> * COMMENT C
>
> #+BEGIN_SRC elisp :tangle yes
> ;; C
> #+END_SRC
>
> produces a file with A and B in it. Expected: Just A. Changing
>
> #+BEGIN_SRC elisp :noweb-ref B
> ;; B
> #+END_SRC
>
> to
>
> # #+BEGIN_SRC elisp :noweb-ref B
> # ;; B
> # #+END_SRC
>
> does yield the expected result.
Attached is a patch that fixes the problem.
A second patch is attached that contains tests about this and related
stuff. It is an updated version of an unapplied patch that I
sent to this list earlier this month
(https://lists.gnu.org/archive/html/emacs-orgmode/2019-10/msg00013.html).
Best wishes
Sebastian
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] COMMENT and noweb-ref
2019-09-16 21:33 Bug: COMMENT and noweb-ref Sebastian Miele
` (2 preceding siblings ...)
2019-10-20 22:09 ` [PATCH] " Sebastian Miele
@ 2019-10-20 22:30 ` Sebastian Miele
2019-11-24 9:29 ` Nicolas Goaziou
3 siblings, 1 reply; 9+ messages in thread
From: Sebastian Miele @ 2019-10-20 22:30 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 913 bytes --]
Sorry. I messed up the previous mail. Please ignore it.
I wrote:
> org-babel-tangle on
>
> * A
>
> #+BEGIN_SRC elisp :tangle yes :noweb yes
> ;; A
> <<B>>
> #+END_SRC
>
> * COMMENT B
>
> #+BEGIN_SRC elisp :noweb-ref B
> ;; B
> #+END_SRC
>
> * COMMENT C
>
> #+BEGIN_SRC elisp :tangle yes
> ;; C
> #+END_SRC
>
> produces a file with A and B in it. Expected: Just A. Changing
>
> #+BEGIN_SRC elisp :noweb-ref B
> ;; B
> #+END_SRC
>
> to
>
> # #+BEGIN_SRC elisp :noweb-ref B
> # ;; B
> # #+END_SRC
>
> does yield the expected result.
Attached is a patch that fixes the problem.
A second patch is attached that contains tests about this and related
stuff. It is an updated version of an unapplied patch that I
sent to this list earlier this month
(https://lists.gnu.org/archive/html/emacs-orgmode/2019-10/msg00013.html).
Best wishes
Sebastian
[-- Attachment #2: 0001-ob-core-Respect-COMMENTed-headlines-when-expanding-n.patch --]
[-- Type: text/plain, Size: 2047 bytes --]
From ddf0b6d89d30766158311c047d6de10091cb0377 Mon Sep 17 00:00:00 2001
From: Sebastian Miele <sebastian.miele@gmail.com>
Date: Sun, 20 Oct 2019 21:34:02 +0000
Subject: [PATCH 1/2] ob-core: Respect COMMENTed headlines when expanding noweb
references
* lisp/ob-core.el (org-babel-expand-noweb-references): Add calls to
org-in-commented-heading-p where appropriate.
---
lisp/ob-core.el | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 572f97919..b99545ab5 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2780,7 +2780,8 @@ block but are passed literally to the \"example-block\"."
(concat (funcall c-wrap (car cs)) "\n"
b "\n"
(funcall c-wrap (cadr cs)))))))))
- (if (re-search-forward name-regexp nil t)
+ (if (and (re-search-forward name-regexp nil t)
+ (not (org-in-commented-heading-p)))
;; Found a source block named SOURCE-NAME.
;; Assume it is unique; do not look after
;; `:noweb-ref' header argument.
@@ -2791,14 +2792,16 @@ block but are passed literally to the \"example-block\"."
;; those with a matching Noweb reference.
(let ((expansion nil))
(org-babel-map-src-blocks nil
- (let* ((info (org-babel-get-src-block-info 'light))
- (parameters (nth 2 info)))
- (when (equal source-name
- (cdr (assq :noweb-ref parameters)))
- (push (funcall expand-body info) expansion)
- (push (or (cdr (assq :noweb-sep parameters))
- "\n")
- expansion))))
+ (unless (org-in-commented-heading-p)
+ (let* ((info
+ (org-babel-get-src-block-info 'light))
+ (parameters (nth 2 info)))
+ (when (equal source-name
+ (cdr (assq :noweb-ref parameters)))
+ (push (funcall expand-body info) expansion)
+ (push (or (cdr (assq :noweb-sep parameters))
+ "\n")
+ expansion)))))
(when expansion
(mapconcat #'identity
(nreverse (cdr expansion))
--
2.23.0
[-- Attachment #3: 0002-Add-tests-about-omission-of-commented-src-blocks-whe.patch --]
[-- Type: text/plain, Size: 3127 bytes --]
From 66c7904298a33900e389acb184fbe7511960b34d Mon Sep 17 00:00:00 2001
From: Sebastian Miele <sebastian.miele@gmail.com>
Date: Sun, 20 Oct 2019 21:38:03 +0000
Subject: [PATCH 2/2] Add tests about omission of commented src blocks when
e.g. tangling
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Add clause to
test.
* testing/lisp/test-ob-tangle.el (ob-tangle/commented-src-blocks): Add
test.
---
testing/lisp/test-ob-tangle.el | 84 ++++++++++++++++++++++++++++++++++
testing/lisp/test-ob.el | 24 ++++++++++
2 files changed, 108 insertions(+)
diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index 47c31dff5..301f7aff7 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -296,6 +296,90 @@ another block
(org-split-string (buffer-string))))
(delete-file file))))))
+(ert-deftest ob-tangle/commented-src-blocks ()
+ "Test omission of commented src blocks."
+ (should
+ (equal '("A")
+ (let ((file (make-temp-file "org-tangle-")))
+ (unwind-protect
+ (progn
+ (org-test-with-temp-text-in-file
+ (format "#+property: header-args :tangle %S
+* A
+
+ #+begin_src emacs-lisp
+ A
+ #+end_src
+
+* COMMENT B
+
+ #+begin_src emacs-lisp
+ B
+ #+end_src
+
+* C
+
+ # #+begin_src emacs-lisp
+ # C
+ # #+end_src
+
+* D
+
+ #+begin_comment
+ #+begin_src emacs-lisp
+ D
+ #+end_src
+ #+end_comment"
+ file)
+ (org-babel-tangle))
+ (with-temp-buffer
+ (insert-file-contents file)
+ (org-split-string (buffer-string))))
+ (delete-file file)))))
+ (should
+ (equal '("A")
+ (let ((file (make-temp-file "org-tangle-")))
+ (unwind-protect
+ (progn
+ (org-test-with-temp-text-in-file
+ (format "#+property: header-args :tangle %S
+* A
+
+ #+begin_src elisp :noweb yes
+ A
+ <<B>>
+ <<C>>
+ <<D>>
+ #+end_src
+
+* COMMENT B
+
+ #+begin_src elisp :noweb-ref B
+ B
+ #+end_src
+
+* C
+
+ # #+begin_src elisp :noweb-ref C
+ # C
+ # #+end_src
+
+* D
+
+ #+begin_comment
+ #+begin_src elisp :noweb-ref D
+ D
+ #+end_src
+ #+end_comment"
+ file)
+ (let (org-babel-noweb-error-all-langs
+ org-babel-noweb-error-langs)
+ (org-babel-tangle)))
+ (with-temp-buffer
+ (insert-file-contents file)
+ (org-split-string (buffer-string))))
+ (delete-file file))))))
+
(provide 'test-ob-tangle)
;;; test-ob-tangle.el ends here
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 367c70f83..681f3403e 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -758,6 +758,30 @@ x
#+name: bar
#+begin_src emacs-lisp
baz
+#+end_src"
+ (org-babel-expand-noweb-references))))
+ ;; Respect COMMENT headlines
+ (should
+ (equal "C"
+ (org-test-with-temp-text "
+#+begin_src emacs-lisp :noweb yes<point>
+ <<foo>>
+#+end_src
+
+* COMMENT A
+#+name: foo
+#+begin_src emacs-lisp
+ A
+#+end_src
+
+* COMMENT B
+#+begin_src emacs-lisp :noweb-ref foo
+ B
+#+end_src
+
+* C
+#+begin_src emacs-lisp :noweb-ref foo
+ C
#+end_src"
(org-babel-expand-noweb-references)))))
--
2.23.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] COMMENT and noweb-ref
2019-10-20 22:30 ` Sebastian Miele
@ 2019-11-24 9:29 ` Nicolas Goaziou
0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2019-11-24 9:29 UTC (permalink / raw)
To: Sebastian Miele; +Cc: emacs-orgmode
Hello,
Sebastian Miele <sebastian.miele@gmail.com> writes:
> Sorry. I messed up the previous mail. Please ignore it.
Applied. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-11-24 9:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-16 21:33 Bug: COMMENT and noweb-ref Sebastian Miele
2019-09-16 21:39 ` Sebastian Miele
2019-09-26 16:58 ` Sebastian Miele
2019-09-26 18:09 ` Marco Wahl
2019-10-02 13:38 ` Sebastian Miele
2019-10-08 20:34 ` Sebastian Miele
2019-10-20 22:09 ` [PATCH] " Sebastian Miele
2019-10-20 22:30 ` Sebastian Miele
2019-11-24 9:29 ` 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).