emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals-release/org 79ec91584c: org-babel-tangle-single-block:


From: ELPA Syncer
Subject: [elpa] externals-release/org 79ec91584c: org-babel-tangle-single-block: Do not rely on match-data from `org-back-to-heading'
Date: Thu, 22 Jun 2023 06:58:22 -0400 (EDT)

branch: externals-release/org
commit 79ec91584c24264f83223192e5b18730b1a89b71
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-babel-tangle-single-block: Do not rely on match-data from 
`org-back-to-heading'
    
    * lisp/ob-tangle.el (org-babel-tangle-single-block): Explicitly move
    to the beginning of title instead of assuming that
    `org-back-to-heading' sets match data appropriately (it is not
    documented to do so).
    * testing/lisp/test-ob-tangle.el (ob-tangle/comment-org): Add test.
    
    Reported-by: Nick Dokos <ndokos@redhat.com>
    Link: https://orgmode.org/list/87bkh8k3at.fsf@alphaville.usersys.redhat.com
---
 lisp/ob-tangle.el              |  2 +-
 testing/lisp/test-ob-tangle.el | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 980d4a1205..e63bde89f9 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -571,7 +571,7 @@ non-nil, return the full association list to be used by
              (max (condition-case nil
                       (save-excursion
                         (org-back-to-heading t) ; Sets match data
-                        (match-end 0))
+                        (re-search-forward org-outline-regexp))
                     (error (point-min)))
                   (save-excursion
                     (if (re-search-backward
diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index 2a6e4b1dd1..6fbc471cd8 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -99,6 +99,23 @@ echo 1
                                    (buffer-string)))
         (delete-file "test-ob-tangle.sh"))))))
 
+(ert-deftest ob-tangle/comment-org ()
+  "Test :commends org."
+  (should
+   (string-match
+    (regexp-quote ";; Function heading")
+    (org-test-with-temp-text-in-file
+        "* Function heading
+
+  #+begin_src elisp :tangle \"test-ob-tange.el\" :comments org
+    (message \"FOO\")
+  #+end_src"
+      (unwind-protect
+          (progn (org-babel-tangle)
+                 (with-temp-buffer (insert-file-contents "test-ob-tange.el")
+                                   (buffer-string)))
+        (delete-file "test-ob-tange.el"))))))
+
 (ert-deftest ob-tangle/comment-links-numbering ()
   "Test numbering of source blocks when commenting with links."
   (should



reply via email to

[Prev in Thread] Current Thread [Next in Thread]