You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Emacs 29.4 - installed through openSUSE repository
Emacs command
KRunner -> "emacs"
Org version and provenance
org version 9.6.15 - builtin to emacs
org-ql package version and provenance
20240222.200
Actions taken
Before meetings I like to pull in topics I need to discuss with meeting attendees. I capture topics with a "topic" tag and a TARGET property that describes who this topic needs to be discussed with. See below:
** TODO topic 1 for Susie :topic:
:PROPERTIES:
:OWNER:
:TARGET: Susie
:CREATED: [2025-01-12 Sun]
:END:
** TODO topic 2 for Bob :topic:
:PROPERTIES:
:OWNER:
:TARGET: Bob
:CREATED: [2025-01-12 Sun]
:END:
** TODO topic 1 for Bob :topic:
:PROPERTIES:
:OWNER:
:TARGET: Bob
:CREATED: [2025-01-12 Sun]
:END:
I wrote a custom org-ql predicate to search for items where the TARGET property matches a name:
(org-ql-defpred target (name)
"Search for entries where the \"TARGET\" property matches the supplied name."
:body (and (property "TARGET")
(string-match name (org-entry-get (point) "TARGET"))))
I then use this predicate in a simple function (simplified for a reprex here):
(defun my-dupl-test-example ()
"Collect open topics for a list of people and insert as headers by person."
(interactive)
;; list of example persons
(dolist (name (list "Bob" "Susie"))
(insert (format "* %s\n" name))
;; get topics for a person
(let ((results (org-ql-select (org-agenda-files)
'(and (target name) (tags "topic") (not (done)))
:action '(let ((heading (org-get-heading t t t t))
(position (line-number-at-pos)))
(if heading
(let ((file (buffer-file-name)))
(format "%s" heading)))))))
;; insert topics as headers
(dolist (headline results)
(insert (format "** %s\n" headline))))))
Observed results
The function inserts Bob's topics for both names IF the topics are found in a separate org file and the org-ql-search scope is set to "org-agenda-files":
* Bob
** topic 2 for Bob
** topic 1 for Bob
* Susie
** topic 2 for Bob
** topic 1 for Bob
If the topics are found in the same org file where they are supposed to be inserted and the org-ql-search scope is set to "current-buffer" it works correctly:
* Bob
** topic 2 for Bob
** topic 1 for Bob
* Susie
** topic 1 for Susie
I am completely guessing here that the items for Bob were returned both times because of a caching issue between searches. That does not explain why it works when the search is within current buffer though. I'm really at a loss of what to do about it or anything else I could test to find the source of the problem.
Expected results
The result should be:
* Bob
** topic 2 for Bob
** topic 1 for Bob
* Susie
** topic 1 for Susie
Backtrace
No response
Etc.
No response
The text was updated successfully, but these errors were encountered:
Repository owner
locked and limited conversation to collaborators
Jan 14, 2025
OS/platform
openSUSE Leap 15.6
Emacs version and provenance
Emacs 29.4 - installed through openSUSE repository
Emacs command
KRunner -> "emacs"
Org version and provenance
org version 9.6.15 - builtin to emacs
org-ql package version and provenance
20240222.200
Actions taken
Before meetings I like to pull in topics I need to discuss with meeting attendees. I capture topics with a "topic" tag and a TARGET property that describes who this topic needs to be discussed with. See below:
I wrote a custom org-ql predicate to search for items where the TARGET property matches a name:
I then use this predicate in a simple function (simplified for a reprex here):
Observed results
The function inserts Bob's topics for both names IF the topics are found in a separate org file and the org-ql-search scope is set to "org-agenda-files":
If the topics are found in the same org file where they are supposed to be inserted and the org-ql-search scope is set to "current-buffer" it works correctly:
I am completely guessing here that the items for Bob were returned both times because of a caching issue between searches. That does not explain why it works when the search is within current buffer though. I'm really at a loss of what to do about it or anything else I could test to find the source of the problem.
Expected results
The result should be:
Backtrace
No response
Etc.
No response
The text was updated successfully, but these errors were encountered: