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

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

[elpa] externals/org 410cecc0e7 3/3: ob-tangle/collect-blocks: Small ref


From: ELPA Syncer
Subject: [elpa] externals/org 410cecc0e7 3/3: ob-tangle/collect-blocks: Small refactoring and extra commentary
Date: Fri, 28 Jul 2023 03:58:25 -0400 (EDT)

branch: externals/org
commit 410cecc0e7a3bdebad676461f05a2d1d2ae9348a
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    ob-tangle/collect-blocks: Small refactoring and extra commentary
    
    * testing/lisp/test-ob-tangle.el (ob-tangle/collect-blocks): Use
    `format-spec' instead of `format' for better readability.  Add extra
    comments explaining the logic of testing.  Add "." at the end of
    `lambda' docstrings.
---
 testing/lisp/test-ob-tangle.el | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index ad0e1c29cd..22d88c38fb 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -576,7 +576,8 @@ another block
            (test-dir (file-name-directory org-file))
            (el-file-abs (concat (file-name-sans-extension org-file) ".el"))
            (el-file-rel (file-name-nondirectory el-file-abs)))
-      (insert (format "* H1 with :tangle in properties
+      (insert
+       (format-spec "* H1 with :tangle in properties
 :PROPERTIES:
 :header-args: :tangle relative.el
 :END:
@@ -593,8 +594,8 @@ another block
 \"H1: should be ignored\"
 #+end_src
 
-#+begin_src emacs-lisp :tangle %s
-\"H1: absolute org-file.lang-ext :tangle %s\"
+#+begin_src emacs-lisp :tangle %a
+\"H1: absolute org-file.lang-ext :tangle %a\"
 #+end_src
 
 #+begin_src emacs-lisp :tangle relative.el
@@ -627,8 +628,8 @@ another block
 \"H2: should be ignored\"
 #+end_src
 
-#+begin_src emacs-lisp :tangle %s
-\"H2: relative org-file.lang-ext :tangle %s\"
+#+begin_src emacs-lisp :tangle %r
+\"H2: relative org-file.lang-ext :tangle %r\"
 #+end_src
 
 #+begin_src emacs-lisp :tangle relative.el
@@ -645,20 +646,27 @@ another block
 
 #+begin_src emacs-lisp :tangle ~/../../tmp/absolute.el
 \"H2: :tangle ~/../../tmp/absolute.el\"
-#+end_src" el-file-abs el-file-abs el-file-rel el-file-rel))
+#+end_src"
+                    `((?a . ,el-file-abs)
+                      (?r . ,el-file-rel))))
+      ;; We check the collected blocks to tangle by counting equal
+      ;; file names in the output of
+      ;; `org-babel-tangle-collect-blocks'.
       (letrec ((sort-fn (lambda (lst) (seq-sort-by #'car #'string-lessp lst)))
                (normalize-expected-targets-alist
                 (lambda (blocks-per-target-alist)
-                  "Convert to absolute file names and sort expected targets"
+                  "Convert to absolute file names and sort expected targets."
                   (funcall sort-fn
                            (map-apply (lambda (file nblocks)
                                         (cons (expand-file-name file test-dir) 
nblocks))
                                       blocks-per-target-alist))))
                (count-blocks-in-target-files
                 (lambda (collected-blocks)
-                  "Get sorted alist of target file names with number of blocks 
in each"
+                  "Get sorted alist of target file names with number of blocks 
in each."
                   (funcall sort-fn (map-apply (lambda (file blocks)
+                                                ;; Blocks are grouped by file 
name.
                                                 (cons file (length blocks)))
+                                              ;; From 
`org-babel-tangle-collect-blocks'.
                                               collected-blocks)))))
         (should (equal (funcall normalize-expected-targets-alist
                                 `(("/tmp/absolute.el" . 4)



reply via email to

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