Closed oantolin closed 5 months ago
Hi Omar,
Thanks for reporting that. I hadn't noticed since I use org-tree-to-indirect-buffer
in the org-ql-find-goto-hook
.
I think this commit should fix it: https://github.com/alphapapa/org-ql/commit/631cd80ce870b5bec6609eea8f0f4123876bf1cf Please let me know if it does for you.
Yes, that works perfectly. Thank you!
THANK YOU, @oantolin !!! This has been driving me crazy for weeks now, and I had no idea where, even on which package, the problem was!!
@telenieko Glad that it's fixed for you. Could you tell me a bit more about how you're using org-ql? I'm surprised it wasn't more obvious where the problem was.
Yeah, I'm curious about that too, @telenieko.
@telenieko Glad that it's fixed for you. Could you tell me a bit more about how you're using org-ql? I'm surprised it wasn't more obvious where the problem was.
There are two places that were broken in my system,
In a notmuch-show
buffer I can call mf-email-get-links-to-current-thread
and, using org-ql
I will find any Org entries that contain links to any e-mails of the e-mail thread being visited. (#279 has some background on the org-backlinks
predicate):
(defun mf-email-get-links-to-current-thread()
"Find org items linking to this email thread."
(interactive)
(let* ((message-ids (notmuch-show-get-messages-ids))
(targets (mapconcat (lambda (tgt) (format "\"notmuch:%s\"" tgt))
message-ids))
(query (format "org-backlinks:%s" targets))
(title (format "Tasks linked to: %s"
(notmuch-show-get-subject)))
)
(org-ql-find (org-agenda-files t t)
:query-prefix query
:prompt "Tareas relacionadas: ")))
I also have a very simple search function bound to a key for "full text" searching:
(defun mf-pkm-todo-search (arg)
"Search for TODO. If ARG search archives too."
(interactive "P")
(let ((include-archives (not (eq nil arg))))
(org-ql-find (org-agenda-files nil include-archives))))
You see both functions use org-ql-find
to allow me to refine the search in the minibuffer (specially on the e-mail searching function).
Back to the obviousness: Now that @oantolin mentioned it... I feel ashamed of missing this behaviour of org-with-point-at
(well, not ashamed, I'm a newbie still!). But before then my brain just did not make the connection.
In a
notmuch-show
buffer I can callmf-email-get-links-to-current-thread
and, usingorg-ql
I will find any Org entries that contain links to any e-mails of the e-mail thread being visited. (#279 has some background on theorg-backlinks
predicate):
Cool, thanks. Quick thing I noticed that you might want to be aware of: you seem to be concatting targets
without commas between tokens, i.e. IIUC it will turn into something like org-backlinks:"notmuch:FOO""notmuch:BAR"
. Instead the query should look something like org-backlinks:notmuch:FOO,notmuch:BAR
(assuming that the org-backlinks
predicate handles multiple arguments correctly).
Back to the obviousness: Now that @oantolin mentioned it... I feel ashamed of missing this behaviour of org-with-point-at (well, not ashamed, I'm a newbie still!). But before then my brain just did not make the connection.
Well, you shouldn't feel bad, after all, I misused it myself. :)
Also, friendly tip: Instead of (not (eq nil arg))
you can use the classic trick to "booleanize" it, (not (not arg))
.
Thanks for the tips @alphapapa! will polish my code a little bit! :D
For anyone coming here in the future: I fixed the targets
concatenation by passing a SEPARATOR parameter to mapconcat
.
Commit 8e9a8fe0907fdd56e46bd78bbfb2d05b9eea0c85 reintroduces org-with-point-at
, essentially reintroducing this bug again in release 0.8.1.
Commit 8e9a8fe reintroduces
org-with-point-at
, essentially reintroducing this bug again in release 0.8.1.
Argh. Thanks for reporting.
This should be fixed now, on master
and in v0.8.2. Thanks, @bram85.
I'm still seeing the bug after that commit. You did replace org-with-point-at
with without-restriction
, but you forgot to actually move point. The code in commit 631cd80ce870b5bec6609eea8f0f4123876bf1cf included a (goto-char marker)
which you don't have anymore.
@oantolin Thanks. I've just pushed fixes as v0.8.3 and to master
. I've tested it more carefully, and it seems to work correctly in various circumstances. Please let me know if you find any more problems.
Thank you! I can confirm that fix works for me.
Or rather it does, but it does so inside a
org-with-point-at
which expands to a form includingsave-excursion
so the jumping gets undone right away! (There's an easy work around: just useembark-dwim
, but I would much rather just pressRET
.) This is with org-ql version 0.8-pre from MELPA, build 20231020.244.