From 29dad16dea52702fab470ac294a346fc4bc7e96a Mon Sep 17 00:00:00 2001 From: Sergey Trofimov Date: Tue, 10 Feb 2026 04:53:54 +0100 Subject: [PATCH] fix(org,cli): tangle: filter by tag properly Org files with tagged headlines weren't tangled correctly. Also improves filtering by tag as in current shape it is not working at all. Fix: #8622 --- modules/lang/org/cli.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/lang/org/cli.el b/modules/lang/org/cli.el index ceb953dd7..111af036c 100644 --- a/modules/lang/org/cli.el +++ b/modules/lang/org/cli.el @@ -49,7 +49,7 @@ EXAMPLES: (setq last-heading-pos current-heading-pos))) (unless (or (org-in-commented-heading-p) (org-in-archived-heading-p)) - (let* ((tags (org-get-tags-at)) + (let* ((headline-tags (org-get-tags)) (info (org-babel-get-src-block-info 'no-eval)) (src-lang (nth 0 info)) (src-tfile (cdr (assq :tangle (nth 2 info)))) @@ -66,16 +66,14 @@ EXAMPLES: ((let* ((tags (seq-group-by (fn! (equal (car %) "--or")) tags)) (or-tags (mapcar #'cdr (cdr (assq t tags)))) - (and-tags (mapcar #'cdr (cdr (assq nil tags)))) - (all-tags (append or-tags and-tags))) + (and-tags (mapcar #'cdr (cdr (assq nil tags))))) (and (or or-tags and-tags) (or (not and-tags) - (let ((a (cl-intersection and-tags all-tags :test #'string=)) + (let ((a (cl-intersection and-tags headline-tags :test #'string=)) (b and-tags)) - (not (or (cl-set-difference a b :test #'equal) - (cl-set-difference b a :test #'equal))))) + (cl-set-exclusive-or a b :test #'equal))) (or (not or-tags) - (cl-intersection or-tags all-tags :test #'string=)) + (not (cl-intersection or-tags headline-tags :test #'string=))) t))) ((or (not src-tfile)