emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mehmet Tekman <mtekman89@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [ANN] lisp/ob-tangle-sync.el
Date: Fri, 4 Aug 2023 15:14:04 +0200	[thread overview]
Message-ID: <CAHHeYzL1VyFVOrfBCG+k5-YWPkYa+U77s457YDGxtn8xqgCGwg@mail.gmail.com> (raw)
In-Reply-To: <87pm43kz3i.fsf@localhost>

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

Ihor Radchenko <yantar92@posteo.net> writes:

>
> Side note: I had one newly added test failing on the latest main. You
> may need to rebase your branch and check if tests are still passing.
>

The rebase was fine, but I'm having a problem aligning my patch branch
to work without any tangle involvement.

The first hurdle is that I'm a little bit unsure about the validity of one of
 the tests.

* Under vanilla `org-babel-merge-params', any number of :tangle header
  values are permitted and concatenated together.

  e.g 4:
  __________
  ´
    (should  ;; 4.
override-document-and-parent-header-with-local-tfile-and-action
     (equal '(:tangle "randomfile sync")
            (org-test-with-temp-text
                "\
  #+PROPERTY: header-args :tangle /tmp/default_tangle.txt
  * Four
  :PROPERTIES:
  :header-args: :tangle \"newfile.txt\" import
  :END:
  ** A
  #+begin_src conf :tangle randomfile sync
  #+end_src"
              (test-ob/get-src-block-property :tangle))))
  `-----------

  This result of "randomfile sync" for the :tangle header is seen as
  valid.... but it shouldn't, should it? Tangle can only take one value,
  so the action of `:any` should also just output one value?

  From the docstring text:

  > Symbol `:any' in the value list implies that any value is allowed.

  It's not clear to me if this means that `:any' or `:any :any` or
  `":any :any"` is permitted.

  In my rewrite, I very much take the `:any` or `":any :any"` single
  value interpretation when merging the headers together.

* Sometimes the value of another header is caught in the value of
  another

  e.g 8: "wrap" is caught in the output of `:results' despite it not being
         a valid results keyword in `org-babel-common-header-args-w-values'.

   __________
  ´
    (should  ;; 8. test-results-and-exports
     (equal '(:results "wrap file replace" :exports "code")
            (org-test-with-temp-text
                "\
  * Eight
  #+begin_src sh :results file wrap
  #+end_src"
              (test-ob/get-src-block-property '(:results :exports)))))
    (should  ;; 9. do-not-tangle-this-block --
  `-----------

  This test results in "true" for both my rewrite, and the vanilla
  function, but I'm not sure how accurate or value this is.


I've been reordering and splitting commits for a while now, but I think
it's really not easy to seperate the new tangle-sync component from my
merge-params rewrite.

I've attached my patches, including fixes from the last review you gave
- I hope you can make more sense of this than I can.

Best,
Mehmet

[-- Attachment #2: 0001-testing-lisp-test-ob.el-New-tests-for-merge-params.patch --]
[-- Type: text/x-patch, Size: 5962 bytes --]

From bcbd184d7b7effa6cda1f6c3680a1e4a28b8be30 Mon Sep 17 00:00:00 2001
From: Mehmet Tekman <mtekman89@gmail.com>
Date: Tue, 1 Aug 2023 05:14:46 +0200
Subject: [PATCH 1/4] * testing/lisp/test-ob.el: New tests for merge-params

(test-ob/get-src-block-property):
(test-ob/merge-params): add new tests for the merge-params source
block header handling function.
---
 testing/lisp/test-ob.el | 138 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 138 insertions(+)

diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index c8dbd44f4..f12533258 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -314,6 +314,144 @@ this is simple"
     (org-babel-next-src-block)
     (should (= 14 (org-babel-execute-src-block)))))
 
+(defun test-ob/get-src-block-property (properties)
+  "Get plist of PROPERTIES and values for the first src block in buffer.
+PROPERTIES is a list of property keywords or a single keyword."
+  (org-with-wide-buffer
+   (goto-char (point-min))
+   (org-babel-next-src-block)
+   (org-set-regexps-and-options)
+   (let ((all-props (nth 2 (org-babel-get-src-block-info))))
+     (if (listp properties)
+         (apply #'nconc (mapcar (lambda (p) (list p (cdr (assoc p all-props)))) properties))
+       (list properties (cdr (assoc properties all-props)))))))
+
+(ert-deftest test-ob/merge-params ()
+  "Test the output of merging multiple header parameters."
+  (should ;; 1. inherit-document-header-args
+   (equal '(:tangle "/tmp/default_tangle.txt")
+          (org-test-with-temp-text
+              "\
+#+PROPERTY: header-args :tangle /tmp/default_tangle.txt
+* One
+#+begin_src conf
+#+end_src"
+            (test-ob/get-src-block-property :tangle))))
+  (should-not ;; 2. inherit-document-header-with-local-sync-action
+   ;; This should pass with newer merge function with multiple tangle parameters
+   (equal '(:tangle "/tmp/default_tangle.txt skip")
+          (org-test-with-temp-text
+              "\
+#+PROPERTY: header-args :tangle /tmp/default_tangle.txt
+* Two
+#+begin_src conf :tangle skip
+#+end_src"
+            (test-ob/get-src-block-property :tangle))))
+  (should ;; 3. override-document-header-with-local-tfile
+   (equal '(:tangle "randomfile sync")
+          (org-test-with-temp-text
+              "\
+#+PROPERTY: header-args :tangle /tmp/default_tangle.txt
+* Three
+#+begin_src conf :tangle randomfile sync
+#+end_src"
+            (test-ob/get-src-block-property :tangle))))
+  (should  ;; 4. override-document-and-parent-header-with-local-tfile-and-action
+   (equal '(:tangle "randomfile sync")
+          (org-test-with-temp-text
+              "\
+#+PROPERTY: header-args :tangle /tmp/default_tangle.txt
+* Four
+:PROPERTIES:
+:header-args: :tangle \"newfile.txt\" import
+:END:
+** A
+#+begin_src conf :tangle randomfile sync
+#+end_src"
+            (test-ob/get-src-block-property :tangle))))
+  (should ;; 5. test-tangle-and-default-results-param-together
+   (equal '(:tangle "randomfile" :results "replace")
+          (org-test-with-temp-text
+              "\
+* Five
+#+begin_src conf  :tangle randomfile
+#+end_src"
+            (test-ob/get-src-block-property '(:tangle :results)))))
+  (should-not  ;; 6. inherit-document-tfile-take-only-last-local-sync-action
+   ;; This should pass with newer merge function with multiple tangle parameters
+   (equal '(:tangle "/tmp/default_tangle.txt export")
+          (org-test-with-temp-text
+              "\
+#+PROPERTY: header-args :tangle /tmp/default_tangle.txt
+* Six
+#+begin_src conf  :tangle import export
+#+end_src"
+            (test-ob/get-src-block-property :tangle))))
+  (should-not  ;; 7. ignore-document-header-take-last-tfile-and-sync-action
+   ;; This should pass with newer merge function with multiple tangle parameters
+   (equal '(:tangle "fname2 export")
+          (org-test-with-temp-text
+              "\
+#+PROPERTY: header-args :tangle /tmp/default_tangle.txt
+* Seven
+#+begin_src conf  :tangle fname1 fname2 sync export
+#+end_src"
+            (test-ob/get-src-block-property :tangle))))
+  (should  ;; 8. test-results-and-exports
+   (equal '(:results "wrap file replace" :exports "code")
+          (org-test-with-temp-text
+              "\
+* Eight
+#+begin_src sh :results file wrap
+#+end_src"
+            (test-ob/get-src-block-property '(:results :exports)))))
+  (should  ;; 9. do-not-tangle-this-block --
+   (equal '(:tangle "no")
+          (org-test-with-temp-text
+              "\
+#+PROPERTY: header-args :tangle /tmp/default_tangle.txt
+* Nine
+#+begin_src conf :tangle no
+#+end_src"
+            (test-ob/get-src-block-property :tangle))))
+  (should  ;; 10. test-tangle-exports-and-comments
+   (equal '(:tangle "foo.txt" :exports "verbatim code" :comments "link")
+          (org-test-with-temp-text
+              "\
+#+PROPERTY: header-args :tangle /tmp/default_tangle.txt
+* Ten
+:PROPERTIES:
+:header-args: :tangle no :exports verbatim
+:END:
+#+begin_src conf :tangle \"foo.txt\" :comments link
+#+end_src"
+            (test-ob/get-src-block-property '(:tangle :exports :comments)))))
+  (should-not  ;; 11. override-document-and-heading-tfile-with-yes
+   ;; This should pass with newer merge function with multiple tangle parameters
+   (equal '(:tangle "foo.txt")
+          (org-test-with-temp-text
+              "\
+#+PROPERTY: header-args :tangle /tmp/default_tangle.txt
+* Eleven
+:PROPERTIES:
+:header-args: :tangle \"foo.txt\"
+:END:
+#+begin_src conf :tangle yes
+#+end_src"
+            (test-ob/get-src-block-property :tangle))))
+  (should  ;; 12. tangle-file-with-spaces
+   (equal '(:tangle "file with spaces.txt")
+          (org-test-with-temp-text
+              "\
+* Twelve
+:PROPERTIES:
+:header-args: :tangle \"foo.txt\"
+:END:
+** A
+#+begin_src conf :tangle \"file with spaces.txt\"
+#+end_src"
+            (test-ob/get-src-block-property :tangle)))))
+
 (ert-deftest test-ob/inline-src-blocks ()
   (should
    (= 1
-- 
2.41.0


[-- Attachment #3: 0004-org-babel-common-header-args-w-values-Added-mutually.patch --]
[-- Type: text/x-patch, Size: 847 bytes --]

From 1a2aae5d89aeb665f5e6a4420f6f6a1a00e5056f Mon Sep 17 00:00:00 2001
From: Mehmet Tekman <mtekman89@gmail.com>
Date: Fri, 4 Aug 2023 13:07:14 +0200
Subject: [PATCH 4/4] (org-babel-common-header-args-w-values): Added mutually
 exclusive tangle groups relating to desired tangle sync actions

---
 lisp/ob-core.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index cd6c6708c..f901a75ee 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -441,7 +441,8 @@ then run `org-babel-switch-to-session'."
     (sep	. :any)
     (session	. :any)
     (shebang	. :any)
-    (tangle	. ((tangle yes no :any)))
+    (tangle	. ((tangle yes no :any)
+                   (import export skip sync)))
     (tangle-mode . ((#o755 #o555 #o444 :any)))
     (var	. :any)
     (wrap       . :any))
-- 
2.41.0


[-- Attachment #4: 0002-lisp-ob-core.el-Rewrite-of-merge-babel-headers.patch --]
[-- Type: text/x-patch, Size: 10413 bytes --]

From c8f8e1cf6dbf88162a11b520578b32b4ddd8441a Mon Sep 17 00:00:00 2001
From: Mehmet Tekman <mtekman89@gmail.com>
Date: Wed, 10 May 2023 17:38:22 +0200
Subject: [PATCH 2/4] * lisp/ob-core.el: Rewrite of merge babel headers

(org-babel-merge-params): merge headers strategy split out into new
dedicated function `--merge-headers'
(org-babel--merge-headers): new function that resolves headers based
on their mutually exclusive groups, with better support for groups
with `:any' keywords.

added ob-core

ihors suggestions implemented
---
 lisp/ob-core.el | 154 +++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 121 insertions(+), 33 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index fb9df80c3..cd6c6708c 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2843,6 +2843,88 @@ specified as an an \"attachment:\" style link."
       (goto-char body-start)
       (insert body))))
 
+(defun org-babel--merge-headers (exclusive-groups &rest related-params)
+  "Merge related cascading header parameters whilst upholding group exclusivity.
+
+A given header parameter (prop) can have multiple values
+depending on where it is referenced in the outline path (olp) of
+an Org document.  The RELATED-PARAMS argument is a list that
+contains the value of the prop at the current level of the olp,
+as well the resolution of the last time this function was called
+for the prop.  The EXCLUSIVE-GROUPS argument contains the related
+prop entry from `org-babel-common-header-args-w-values' and
+dictates the valid values a prop can take. If the prop can have
+more than one value, it defines consistent mutually exclusive
+keywords that the prop can take."
+    ;;
+    ;; Having an :any keyword in an exclusion group means that a
+    ;; parameter of "yes" could match to an exclusion group that
+    ;; contains both "yes" AND ":any".
+    ;;
+    ;; For each parameter, build a list of exclusion groups it could
+    ;; belong to. If a parameter belongs to two groups, eliminate it
+    ;; from the group that contains the ":any" keyword.
+    ;;
+  ;; Exclusion groups are referenced to by their car, acting as a key
+  ;; for the entire group.
+    ;;
+    (let ((any-group-key       ;; exclusion group key for group with :any keyword
+         ;; Ihor: cl-find is suggested here, but not sure how to apply.
+           (caar (cl-remove-if-not (lambda (x) (member ":any" x)) exclusive-groups)))
+          params-alist         ;; param -> list( exclusion group keys )
+          unexplained-params)  ;; any params that were not caught
+      ;; Iterate parameters, across each exclusion group.
+      ;; - Populate params-alist
+      (dolist (new-params related-params)
+        (dolist (new-param new-params)
+          (dolist (exclusive-group exclusive-groups)
+            (if (or (member new-param exclusive-group)
+                    (and (string= (car exclusive-group) any-group-key)
+                         ;; param *doesn't* match a keyword in this
+                         ;; :any group? Could be :any.
+                         (not (member new-param exclusive-group))))
+                (let ((group-key (car exclusive-group)))
+                (push group-key (alist-get new-param params-alist nil nil #'equal)))
+              ;; Some parameters fit into no groups, store them and process later.
+              (push new-param unexplained-params)))))
+
+    (setq unexplained-params (delete-dups unexplained-params))
+      ;; Find parameters listed in 2 or more exclusive groups, and kick
+      ;; them out of any non-":any" group.
+      ;; - Update params-alist
+      ;; - Remove uniquely known params from unexplained-params
+      (dolist (parm-vals params-alist)
+        (let ((parm (car parm-vals))
+              (group-keys (delete-dups (cdr parm-vals))))
+          (if (member parm unexplained-params)
+              (setq unexplained-params (delete parm unexplained-params)))
+          (if (> (length group-keys) 1)
+              (dolist (gkey group-keys)
+                (if (string= gkey any-group-key)
+                    (setcdr (assoc parm params-alist) (delete gkey group-keys)))))))
+      ;; Collapse parameters into exclusion groups
+      ;; - convert params → list(exclusion group keys) to  exclusion-group-key → list(params)
+      (let (group-alist)
+      (mapcar (lambda (x)
+                (let* ((key (cadr x))
+                       (val (car x))
+                       (existing (cdr (assoc key group-alist))))
+                  ;;(push val (alist-get key group-alist nil nil #'equal))
+                  (if existing
+                      (setcdr (assoc key group-alist) (append existing (list val)))
+                    (setq group-alist (cons (cons key (list val)) group-alist)))))
+              params-alist)
+        ;; Set values in the same order that the exclusion groups are defined
+        (let ((group-key-order (mapcar #'car exclusive-groups)))
+        (setq group-alist (delq nil (mapcar (lambda (x) (car (alist-get x group-alist)))
+                                                      group-key-order))))
+
+        ;; Final Sanity Check: were all parameters explained?
+        ;; - if not, append to result
+        (if unexplained-params
+            (setq group-alist (append unexplained-params group-alist)))
+      group-alist)))
+
 (defun org-babel-merge-params (&rest plists)
   "Combine all parameter association lists in PLISTS.
 Later elements of PLISTS override the values of previous elements.
@@ -2854,26 +2936,15 @@ parameters when merging lists."
 	 (exports-exclusive-groups
 	  (mapcar (lambda (group) (mapcar #'symbol-name group))
 		  (cdr (assq 'exports org-babel-common-header-args-w-values))))
-	 (merge
-	  (lambda (exclusive-groups &rest result-params)
-	    ;; Maintain exclusivity of mutually exclusive parameters,
-	    ;; as defined in EXCLUSIVE-GROUPS while merging lists in
-	    ;; RESULT-PARAMS.
-	    (let (output)
-	      (dolist (new-params result-params (delete-dups output))
-		(dolist (new-param new-params)
-		  (dolist (exclusive-group exclusive-groups)
-		    (when (member new-param exclusive-group)
-		      (setq output (cl-remove-if
-				    (lambda (o) (member o exclusive-group))
-				    output))))
-		  (push new-param output))))))
+         (tangle-exclusive-groups
+	  (mapcar (lambda (group) (mapcar #'symbol-name group))
+		  (cdr (assq 'tangle org-babel-common-header-args-w-values))))
 	 (variable-index 0)		;Handle positional arguments.
 	 clearnames
 	 params				;Final parameters list.
 	 ;; Some keywords accept multiple values.  We need to treat
 	 ;; them specially.
-	 vars results exports)
+	 vars results exports tangle)
     (dolist (plist plists)
       (dolist (pair plist)
 	(pcase pair
@@ -2908,22 +2979,33 @@ parameters when merging lists."
 	      (t (error "Variable \"%s\" must be assigned a default value"
 			(cdr pair))))))
 	  (`(:results . ,value)
-	   (setq results (funcall merge
-				  results-exclusive-groups
-				  results
-				  (split-string
-				   (cond ((stringp value) value)
-                                         ((functionp value) (funcall value))
+	   (setq results (org-babel--merge-headers
+			  results-exclusive-groups
+			  results
+			  (split-string
+			   (cond ((stringp value) value)
+                                 ((functionp value) (funcall value))
                                          ;; FIXME: Arbitrary code evaluation.
-                                         (t (eval value t)))))))
+                                 (t (eval value t)))))))
 	  (`(:exports . ,value)
-	   (setq exports (funcall merge
-				  exports-exclusive-groups
-				  exports
-                                  (split-string
-                                   (cond ((and value (functionp value)) (funcall value))
-                                         (value value)
-                                         (t ""))))))
+	   (setq exports (org-babel--merge-headers
+			  exports-exclusive-groups
+			  exports
+                          (split-string
+                           (cond ((and value (functionp value)) (funcall value))
+                                 (value value)
+                                 (t ""))))))
+          (`(:tangle . ,value)
+           (setq tangle (org-babel--merge-headers
+                         tangle-exclusive-groups
+                         tangle
+                         (mapcar #'org-babel-read
+                                 (org-babel-balanced-split
+                                  (or value "")
+                                  (if (eq (car (text-properties-at 0 value))
+                                          'org-babel-quote)
+                                      ?\"
+                                    ?\s))))))
           ((or '(:dir . attach) '(:dir . "'attach"))
            (unless (org-attach-dir nil t)
              (error "No attachment directory for element (add :ID: or :DIR: property)"))
@@ -2949,7 +3031,8 @@ parameters when merging lists."
 			      params)))))
     ;; Handle other special keywords, which accept multiple values.
     (setq params (nconc (list (cons :results (mapconcat #'identity results " "))
-			      (cons :exports (mapconcat #'identity exports " ")))
+			      (cons :exports (mapconcat #'identity exports " "))
+                              (cons :tangle (mapconcat #'substring-no-properties tangle " ")))
 			params))
     ;; Return merged params.
     (org-babel-eval-headers params)))
@@ -3246,9 +3329,14 @@ situations in which is it not appropriate."
          ;; FIXME: Arbitrary code evaluation.
 	 (eval (read cell) t))
 	((save-match-data
-           (and (string-match "^[[:space:]]*\"\\(.*\\)\"[[:space:]]*$" cell)
-                (not (string-match "[^\\]\"" (match-string 1 cell)))))
-         (read cell))
+           (and (string-match (rx bol (* space) "\"" (group (* any)) "\"" (* space) eol)
+                              cell)
+                (not (string-match (rx (not "\\") "\"") (match-string 1 cell)))))
+         (let ((res (read cell)))
+           ;; If the matched string contains quotes, add quote property
+           (if (string-match (rx bol "\"" (* any) "\"" eol) cell)
+               (put-text-property 0 (length res) 'org-babel-quote 't res))
+           res))
 	(t (org-no-properties cell))))
 
 (defun org-babel--string-to-number (string)
-- 
2.41.0


[-- Attachment #5: 0003-testing-lisp-test-ob.el-update-tests-according-to-ne.patch --]
[-- Type: text/x-patch, Size: 4316 bytes --]

From 90c2e30cd27e783670856ff618efc5c0d4674bdd Mon Sep 17 00:00:00 2001
From: Mehmet Tekman <mtekman89@gmail.com>
Date: Fri, 4 Aug 2023 13:06:58 +0200
Subject: [PATCH 3/4] * testing/lisp/test-ob.el: update tests according to new
 merge strategy, with emphasis on `:tangle' headers for syncing actions.

updated test
---
 testing/lisp/test-ob.el | 43 ++++++++++++++++++++++++++++++++---------
 1 file changed, 34 insertions(+), 9 deletions(-)

diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index f12533258..d51937b69 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -337,7 +337,7 @@ PROPERTIES is a list of property keywords or a single keyword."
 #+begin_src conf
 #+end_src"
             (test-ob/get-src-block-property :tangle))))
-  (should-not ;; 2. inherit-document-header-with-local-sync-action
+  (should ;; 2. inherit-document-header-with-local-sync-action
    ;; This should pass with newer merge function with multiple tangle parameters
    (equal '(:tangle "/tmp/default_tangle.txt skip")
           (org-test-with-temp-text
@@ -377,7 +377,7 @@ PROPERTIES is a list of property keywords or a single keyword."
 #+begin_src conf  :tangle randomfile
 #+end_src"
             (test-ob/get-src-block-property '(:tangle :results)))))
-  (should-not  ;; 6. inherit-document-tfile-take-only-last-local-sync-action
+  (should  ;; 6. inherit-document-tfile-take-only-last-local-sync-action
    ;; This should pass with newer merge function with multiple tangle parameters
    (equal '(:tangle "/tmp/default_tangle.txt export")
           (org-test-with-temp-text
@@ -387,7 +387,7 @@ PROPERTIES is a list of property keywords or a single keyword."
 #+begin_src conf  :tangle import export
 #+end_src"
             (test-ob/get-src-block-property :tangle))))
-  (should-not  ;; 7. ignore-document-header-take-last-tfile-and-sync-action
+  (should  ;; 7. ignore-document-header-take-last-tfile-and-sync-action
    ;; This should pass with newer merge function with multiple tangle parameters
    (equal '(:tangle "fname2 export")
           (org-test-with-temp-text
@@ -426,9 +426,8 @@ PROPERTIES is a list of property keywords or a single keyword."
 #+begin_src conf :tangle \"foo.txt\" :comments link
 #+end_src"
             (test-ob/get-src-block-property '(:tangle :exports :comments)))))
-  (should-not  ;; 11. override-document-and-heading-tfile-with-yes
-   ;; This should pass with newer merge function with multiple tangle parameters
-   (equal '(:tangle "foo.txt")
+  (should  ;; 11. override-document-and-heading-tfile-with-yes
+   (equal '(:tangle "yes")
           (org-test-with-temp-text
               "\
 #+PROPERTY: header-args :tangle /tmp/default_tangle.txt
@@ -439,18 +438,44 @@ PROPERTIES is a list of property keywords or a single keyword."
 #+begin_src conf :tangle yes
 #+end_src"
             (test-ob/get-src-block-property :tangle))))
-  (should  ;; 12. tangle-file-with-spaces
+  (should ;; 12. simple-file-with-spaces
+   (equal '(:tangle "file with spaces.txt import")
+          (org-test-with-temp-text "\
+#+PROPERTY: header-args :tangle \"file with spaces.txt\" sync
+* Twelve
+#+begin_src conf :tangle import
+#+end_src"
+            (test-ob/get-src-block-property :tangle))))
+  (should  ;; 13. hierarchical-tangle-file-with-spaces
    (equal '(:tangle "file with spaces.txt")
           (org-test-with-temp-text
               "\
-* Twelve
+* Thirteen
 :PROPERTIES:
 :header-args: :tangle \"foo.txt\"
 :END:
 ** A
 #+begin_src conf :tangle \"file with spaces.txt\"
 #+end_src"
-            (test-ob/get-src-block-property :tangle)))))
+            (test-ob/get-src-block-property :tangle))))
+  (should ;; 14. do-not-tangle
+   (equal '(:tangle "no")
+          (org-test-with-temp-text
+           "\
+#+PROPERTY: header-args :tangle /tmp/default_tangle.txt
+* Fourteen
+#+begin_src emacs-lisp :tangle no
+#+end_src"
+            (test-ob/get-src-block-property :tangle))))
+  (should ;; 15. headers-dont-cancel-out
+   (equal '(:tangle "relative.el")
+          (org-test-with-temp-text
+           "\
+#+PROPERTY: header-args :tangle relative.el
+* Fifteen
+#+begin_src emacs-lisp :tangle relative.el
+#+end_src"
+           (test-ob/get-src-block-property :tangle)))))
 
 (ert-deftest test-ob/inline-src-blocks ()
   (should
-- 
2.41.0


  reply	other threads:[~2023-08-04 13:15 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26 14:48 [ANN] lisp/ob-tangle-sync.el Mehmet Tekman
2023-04-26 16:43 ` John Wiegley
2023-04-26 18:43   ` Mehmet Tekman
2023-04-27  2:55 ` Ruijie Yu via General discussions about Org-mode.
2023-04-27  6:27   ` Mehmet Tekman
2023-04-28 10:57     ` Ruijie Yu via General discussions about Org-mode.
2023-04-28 11:28       ` Mehmet Tekman
2023-05-02 20:43         ` Mehmet Tekman
2023-05-03  2:31           ` Ruijie Yu via General discussions about Org-mode.
2023-05-03  7:53             ` Mehmet Tekman
2023-05-03  8:34               ` Mehmet Tekman
2023-05-03  8:44                 ` Ihor Radchenko
2023-05-03 11:43           ` Ihor Radchenko
2023-05-03 13:54             ` Mehmet Tekman
2023-05-03 18:06               ` Ihor Radchenko
2023-05-03 15:05             ` Mehmet Tekman
2023-05-03 15:21               ` Ihor Radchenko
     [not found]                 ` <87lei577g4.fsf@gmail.com>
     [not found]                   ` <87lei5v1fg.fsf@localhost>
     [not found]                     ` <87fs8duyae.fsf@localhost>
2023-05-09 14:03                       ` Mehmet Tekman
2023-05-10  9:46                         ` Ihor Radchenko
2023-05-10 11:06                           ` mtekman89
2023-05-10 11:32                             ` Ihor Radchenko
2023-05-10 16:20                               ` Mehmet Tekman
2023-05-12 12:33                                 ` Ihor Radchenko
2023-05-16 12:49                                   ` Mehmet Tekman
2023-05-16 18:57                                     ` Ihor Radchenko
2023-05-17 13:45                                       ` Mehmet Tekman
2023-05-18 10:30                                         ` Ihor Radchenko
2023-05-19  7:10                                           ` Mehmet Tekman
2023-07-15 12:38                                             ` Ihor Radchenko
2023-07-16  9:42                                               ` Mehmet Tekman
2023-07-17 11:29                                                 ` Mehmet Tekman
2023-07-18  8:47                                                   ` Ihor Radchenko
2023-07-21  8:48                                                     ` Mehmet Tekman
2023-07-22  8:02                                                       ` Ihor Radchenko
2023-07-25 11:19                                                         ` Mehmet Tekman
2023-07-25 16:19                                                           ` Ihor Radchenko
2023-07-31 13:41                                                             ` Mehmet Tekman
2023-07-31 16:38                                                               ` Ihor Radchenko
2023-07-31 20:11                                                                 ` Mehmet Tekman
2023-08-01  7:54                                                                   ` Ihor Radchenko
2023-08-01  8:49                                                                     ` Mehmet Tekman
2023-08-01  9:30                                                                       ` Ihor Radchenko
2023-08-01 18:19                                                                         ` Bastien Guerry
2023-08-02  7:29                                                                           ` Ihor Radchenko
2023-08-02 14:46                                                                   ` Mehmet Tekman
2023-08-03  6:32                                                                     ` Mehmet Tekman
2023-08-03  7:35                                                                     ` Ihor Radchenko
2023-08-03  8:08                                                                       ` Mehmet Tekman
2023-08-03  8:16                                                                         ` Ihor Radchenko
     [not found]                                                                           ` <CAHHeYzL6Z5_gGbTUrNzKDh5swgCSQiYsSj3Cs0gFy_d=eXbSBA@mail.gmail.com>
     [not found]                                                                             ` <87o7jo1q2s.fsf@localhost>
2023-08-03  8:46                                                                               ` Mehmet Tekman
2023-08-04  7:41                                                                                 ` Mehmet Tekman
2023-08-04  8:09                                                                                   ` Ihor Radchenko
2023-08-04 13:14                                                                                     ` Mehmet Tekman [this message]
2023-08-04 16:34                                                                                       ` Mehmet Tekman
2023-08-06  9:07                                                                                         ` Ihor Radchenko
2023-08-08 19:41                                                                                           ` Mehmet Tekman
2023-08-08 19:51                                                                                             ` Ihor Radchenko
2023-08-08 20:04                                                                                               ` Mehmet Tekman
2023-08-09  8:04                                                                                                 ` Ihor Radchenko
2023-08-05  8:48                                                                                       ` Ihor Radchenko
2023-08-05 22:54                                                                                         ` Mehmet Tekman
2023-11-10  9:41                                                                                           ` Ihor Radchenko
2023-11-10  9:53                                                                                             ` Mehmet Tekman
2023-12-11 13:40                                                                                               ` Ihor Radchenko
2023-12-11 14:28                                                                                                 ` Mehmet Tekman
2023-04-27 12:02 ` Ihor Radchenko
2023-04-27 13:01   ` Mehmet Tekman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHHeYzL1VyFVOrfBCG+k5-YWPkYa+U77s457YDGxtn8xqgCGwg@mail.gmail.com \
    --to=mtekman89@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).