Change: (org-ql-find) Interactively, search relevant buffers

This commit is contained in:
Adam Porter 2023-09-30 20:09:12 -05:00
parent ca23b1c7bd
commit ab720689e9
3 changed files with 46 additions and 38 deletions

View file

@ -551,6 +551,7 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
*Additions*
+ Function ~org-ql-completing-read~, used by command ~org-ql-find~, now specifies the completion category as ~org-heading~, providing compatibility with [[https://github.com/oantolin/embark][Embark]]. (This is a powerful feature, as it means any ~org-ql-find~ result can be acted on from inside the search results with Embark, which provides common actions from Org Agenda and Org speed keys bindings.) ([[https://github.com/alphapapa/org-ql/issues/299][#299]]. Thanks to [[https://github.com/oantolin][Omar Antolín Camarena]], [[https://github.com/minad][Daniel Mendler]], and [[https://github.com/akirak][Akira Komamura]].)
+ Command ~org-ql-find~ may be called in an ~org-agenda~ or ~org-ql-view~ buffer to search the buffers which contributed to the agenda/view buffer.
*Compatibility*

View file

@ -54,8 +54,11 @@ See function `display-buffer'."
(cl-defun org-ql-find (buffers-files &key query-prefix query-filter
(prompt "Find entry: "))
"Go to an Org entry in BUFFERS-FILES selected by searching entries with `org-ql'.
Interactively, with universal prefix, select multiple buffers to
search with completion and PROMPT.
Interactively, search the buffers and files relevant to the
current buffer (i.e. in `org-agenda-mode', the value of
`org-ql-view-buffers-files' or `org-agenda-contributing-files';
in `org-mode', that buffer). With universal prefix, select
multiple buffers to search with completion and PROMPT.
QUERY-PREFIX may be a string to prepend to the query (e.g. use
\"heading:\" to only search headings, easily creating a custom
@ -75,10 +78,11 @@ single predicate)."
when (eq 'org-mode (buffer-local-value 'major-mode buffer))
collect (buffer-name buffer))
nil t))
(progn
(unless (eq major-mode 'org-mode)
(user-error "This is not an Org buffer: %S" (current-buffer)))
(current-buffer)))))
(pcase major-mode
((pred (derived-mode-p 'org-agenda-mode)) (or org-ql-view-buffers-files
org-agenda-contributing-files))
((pred (derived-mode-p 'org-mode)) (current-buffer))
(_ (user-error "This is not an Org-related buffer: %S" (current-buffer)))))))
(let ((marker (org-ql-completing-read buffers-files
:query-prefix query-prefix
:query-filter query-filter

View file

@ -1051,6 +1051,9 @@ File: README.info, Node: 08-pre, Next: 072, Up: Changelog
Thanks to Omar Antolín Camarena (https://github.com/oantolin),
Daniel Mendler (https://github.com/minad), and Akira Komamura
(https://github.com/akirak).)
• Command org-ql-find may be called in an org-agenda or
org-ql-view buffer to search the buffers which contributed to the
agenda/view buffer.
*Compatibility*
@ -1820,38 +1823,38 @@ Node: Links37776
Node: Tips38463
Node: Changelog38787
Node: 08-pre39583
Node: 07240645
Node: 07141567
Node: 0742376
Node: 06345300
Node: 06245831
Node: 06146136
Node: 0646704
Node: 05249758
Node: 05150058
Node: 0550483
Node: 04952014
Node: 04852296
Node: 04752645
Node: 04653054
Node: 04553462
Node: 04453823
Node: 04354182
Node: 04254385
Node: 04154546
Node: 0454793
Node: 03258894
Node: 03159297
Node: 0359494
Node: 02362794
Node: 02263028
Node: 02163308
Node: 0263513
Node: 0167591
Node: Notes67692
Node: Comparison with Org Agenda searches67854
Node: org-sidebar68743
Node: License69022
Node: 07240820
Node: 07141742
Node: 0742551
Node: 06345475
Node: 06246006
Node: 06146311
Node: 0646879
Node: 05249933
Node: 05150233
Node: 0550658
Node: 04952189
Node: 04852471
Node: 04752820
Node: 04653229
Node: 04553637
Node: 04453998
Node: 04354357
Node: 04254560
Node: 04154721
Node: 0454968
Node: 03259069
Node: 03159472
Node: 0359669
Node: 02362969
Node: 02263203
Node: 02163483
Node: 0263688
Node: 0167766
Node: Notes67867
Node: Comparison with Org Agenda searches68029
Node: org-sidebar68918
Node: License69197

End Tag Table