Fix: Inherit org-file-tags
Fixes #55. Closes #57. Thanks to Mikhail Skorzhinskiy (@mskorzhinskiy).
This commit is contained in:
parent
dadbbe4a87
commit
9f5bbeb3f2
5 changed files with 84 additions and 32 deletions
|
|
@ -392,6 +392,7 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience
|
|||
+ Function ~helm-org-ql-source~, which returns a Helm source that searches given buffers/files with ~helm-org-ql~. It can be used for custom Helm commands that search certain files.
|
||||
|
||||
*Fixed*
|
||||
+ Inherit file tags when =org-tag-inheritance= is enabled. (Fixes [[https://github.com/alphapapa/org-ql/issues/55][#55]]. Thanks to [[https://github.com/mskorzhinskiy][Mikhail Skorzhinskiy]].)
|
||||
+ Call =helm-make-source= directly instead of using =helm-build-sync-source= macro. (Fixes [[https://github.com/alphapapa/org-ql/issues/60][#60]]. Thanks to [[https://github.com/matthuszagh][Matt Huszagh]] for reporting.)
|
||||
+ Search/view buffers now always end with a newline, which prevents side-scrolling of the window when calling =end-of-buffer=.
|
||||
+ Face for done to-do keywords in =org-ql-view= buffers. (Thanks to [[https://github.com/dsdshcym][Yiming Chen]].)
|
||||
|
|
|
|||
|
|
@ -392,7 +392,8 @@ Returns cons (INHERITED-TAGS . LOCAL-TAGS)."
|
|||
'org-ql-nil))
|
||||
(inherited-tags (or (when org-use-tag-inheritance
|
||||
(save-excursion
|
||||
(when (org-up-heading-safe)
|
||||
(if (org-up-heading-safe)
|
||||
;; Return parent heading's tags.
|
||||
(-let* (((inherited local) (org-ql--tags-at (point)))
|
||||
(tags (when (or inherited local)
|
||||
(cond ((and (listp inherited)
|
||||
|
|
@ -407,7 +408,9 @@ Returns cons (INHERITED-TAGS . LOCAL-TAGS)."
|
|||
tags))))
|
||||
(pcase org-tags-exclude-from-inheritance
|
||||
('nil tags)
|
||||
(_ (-difference tags org-tags-exclude-from-inheritance)))))))
|
||||
(_ (-difference tags org-tags-exclude-from-inheritance))))
|
||||
;; Top-level heading: use file tags.
|
||||
org-file-tags)))
|
||||
'org-ql-nil))
|
||||
(all-tags (list inherited-tags local-tags)))
|
||||
;; Check caches again, because they may have been set now.
|
||||
|
|
|
|||
27
org-ql.info
27
org-ql.info
|
|
@ -723,6 +723,9 @@ File: README.info, Node: 04-pre, Next: 032, Up: Changelog
|
|||
for custom Helm commands that search certain files.
|
||||
|
||||
*Fixed*
|
||||
• Inherit file tags when org-tag-inheritance is enabled. (Fixes #55
|
||||
(https://github.com/alphapapa/org-ql/issues/55). Thanks to Mikhail
|
||||
Skorzhinskiy (https://github.com/mskorzhinskiy).)
|
||||
• Call helm-make-source directly instead of using
|
||||
helm-build-sync-source macro. (Fixes #60
|
||||
(https://github.com/alphapapa/org-ql/issues/60). Thanks to Matt
|
||||
|
|
@ -1023,18 +1026,18 @@ Node: Agenda-like views18276
|
|||
Node: Listing / acting-on results19681
|
||||
Node: Changelog24283
|
||||
Node: 04-pre24820
|
||||
Node: 03226633
|
||||
Node: 03127014
|
||||
Node: 0327209
|
||||
Node: 02330182
|
||||
Node: 02230408
|
||||
Node: 02130674
|
||||
Node: 0230871
|
||||
Node: 0134904
|
||||
Node: Notes35003
|
||||
Node: Comparison with Org Agenda searches35165
|
||||
Node: org-sidebar36036
|
||||
Node: License36315
|
||||
Node: 03226835
|
||||
Node: 03127216
|
||||
Node: 0327411
|
||||
Node: 02330384
|
||||
Node: 02230610
|
||||
Node: 02130876
|
||||
Node: 0231073
|
||||
Node: 0135106
|
||||
Node: Notes35205
|
||||
Node: Comparison with Org Agenda searches35367
|
||||
Node: org-sidebar36238
|
||||
Node: License36517
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
|
|
|||
16
tests/data2.org
Normal file
16
tests/data2.org
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# This file is currently used to test org-file-tags.
|
||||
|
||||
#+FILETAGS: :food:
|
||||
|
||||
* Fruit :fruit:
|
||||
|
||||
** Blueberry
|
||||
|
||||
** Strawberry
|
||||
|
||||
* Vegetable :vegetable:
|
||||
|
||||
** Broccoli
|
||||
|
||||
** Potato
|
||||
|
||||
|
|
@ -760,7 +760,15 @@ RESULTS should be a list of strings as returned by
|
|||
(org-ql-expect ((tags "Emacs" "space"))
|
||||
'("Visit Mars" "Visit the moon" "/r/emacs" "Rewrite Emacs in Common Lisp"))
|
||||
(org-ql-expect ((not (tags "Emacs" "space")))
|
||||
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony"))))
|
||||
'("Take over the universe" "Take over the world" "Skype with president of Antarctica" "Take over Mars" "Take over the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "Shop for groceries" "Sunrise/sunset" "Ideas" "Write a symphony")))
|
||||
|
||||
(org-ql-it "with file tags"
|
||||
(org-ql-expect ((tags "food"))
|
||||
'("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato")
|
||||
:buffer (org-ql-test-data-buffer "data2.org"))
|
||||
(org-ql-expect ((tags "fruit"))
|
||||
'("Fruit" "Blueberry" "Strawberry")
|
||||
:buffer (org-ql-test-data-buffer "data2.org"))))
|
||||
|
||||
(describe "(tags-inherited)"
|
||||
|
||||
|
|
@ -783,7 +791,15 @@ RESULTS should be a list of strings as returned by
|
|||
'("Skype with president of Antarctica"))
|
||||
(org-ql-expect ((not (tags-inherited "personal" "world")))
|
||||
;; Note that this correctly includes the task "Practice leaping...", which has the LOCAL tag "personal".
|
||||
'("Take over the universe" "Take over the world" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))))
|
||||
'("Take over the universe" "Take over the world" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Practice leaping tall buildings in a single bound" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))
|
||||
|
||||
(org-ql-it "with file tags"
|
||||
(org-ql-expect ((tags-inherited "food"))
|
||||
'("Fruit" "Blueberry" "Strawberry" "Vegetable" "Broccoli" "Potato")
|
||||
:buffer (org-ql-test-data-buffer "data2.org"))
|
||||
(org-ql-expect ((tags-inherited "fruit"))
|
||||
'("Blueberry" "Strawberry")
|
||||
:buffer (org-ql-test-data-buffer "data2.org"))))
|
||||
|
||||
(describe "(tags-local)"
|
||||
|
||||
|
|
@ -805,7 +821,15 @@ RESULTS should be a list of strings as returned by
|
|||
(org-ql-expect ((ltags "personal" "world"))
|
||||
'("Take over the world" "Skype with president of Antarctica" "Practice leaping tall buildings in a single bound" "Get haircut"))
|
||||
(org-ql-expect ((not (tags-local "personal" "world")))
|
||||
'("Take over the universe" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony"))))
|
||||
'("Take over the universe" "Take over Mars" "Visit Mars" "Take over the moon" "Visit the moon" "Renew membership in supervillain club" "Learn universal sign language" "Order a pizza" "Internet" "Spaceship lease" "Fix flux capacitor" "Recurring" "/r/emacs" "Shop for groceries" "Sunrise/sunset" "Ideas" "Rewrite Emacs in Common Lisp" "Write a symphony")))
|
||||
|
||||
(org-ql-it "with file tags"
|
||||
(org-ql-expect ((tags-local "food"))
|
||||
nil
|
||||
:buffer (org-ql-test-data-buffer "data2.org"))
|
||||
(org-ql-expect ((tags-local "fruit"))
|
||||
'("Fruit")
|
||||
:buffer (org-ql-test-data-buffer "data2.org"))))
|
||||
|
||||
(describe "(tags-all), (tags&)"
|
||||
|
||||
|
|
@ -813,7 +837,12 @@ RESULTS should be a list of strings as returned by
|
|||
(org-ql-expect ((tags-all "universe" "personal"))
|
||||
'("Practice leaping tall buildings in a single bound"))
|
||||
(org-ql-expect ((tags& "ambition" "space"))
|
||||
'("Visit Mars" "Visit the moon"))))
|
||||
'("Visit Mars" "Visit the moon")))
|
||||
|
||||
(org-ql-it "with file tags"
|
||||
(org-ql-expect ((tags-all "food" "fruit"))
|
||||
'("Fruit" "Blueberry" "Strawberry")
|
||||
:buffer (org-ql-test-data-buffer "data2.org"))))
|
||||
|
||||
(describe "(ts)"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue