Add: (org-ql-find) Add fallback argument
This commit is contained in:
parent
06f1e1be6f
commit
65c5fd2556
1 changed files with 12 additions and 6 deletions
|
|
@ -87,6 +87,7 @@ For an experience like `org-rifle', use a newline."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(cl-defun org-ql-find (buffers-files &key query-prefix query-filter
|
(cl-defun org-ql-find (buffers-files &key query-prefix query-filter
|
||||||
|
fallback
|
||||||
(prompt "Find entry: "))
|
(prompt "Find entry: "))
|
||||||
"Go to an Org entry in BUFFERS-FILES selected by searching entries with `org-ql'.
|
"Go to an Org entry in BUFFERS-FILES selected by searching entries with `org-ql'.
|
||||||
Interactively, with universal prefix, select multiple buffers to
|
Interactively, with universal prefix, select multiple buffers to
|
||||||
|
|
@ -100,7 +101,10 @@ QUERY-FILTER may be a function through which the query the user
|
||||||
types is filtered before execution (e.g. it could replace spaces
|
types is filtered before execution (e.g. it could replace spaces
|
||||||
with commas to turn multiple tokens, which would normally be
|
with commas to turn multiple tokens, which would normally be
|
||||||
treated as multiple predicates, into multiple arguments to a
|
treated as multiple predicates, into multiple arguments to a
|
||||||
single predicate)."
|
single predicate).
|
||||||
|
|
||||||
|
If no candidate matches the input, FALLBACK function is called on
|
||||||
|
the input."
|
||||||
(interactive
|
(interactive
|
||||||
(list (if current-prefix-arg
|
(list (if current-prefix-arg
|
||||||
(mapcar #'get-buffer
|
(mapcar #'get-buffer
|
||||||
|
|
@ -211,11 +215,13 @@ single predicate)."
|
||||||
(completion-styles-alist (list (list 'org-ql-find #'try #'all "Org QL Find")))
|
(completion-styles-alist (list (list 'org-ql-find #'try #'all "Org QL Find")))
|
||||||
(selected (completing-read prompt #'collection nil))
|
(selected (completing-read prompt #'collection nil))
|
||||||
(marker (gethash selected table)))
|
(marker (gethash selected table)))
|
||||||
(with-current-buffer (marker-buffer marker)
|
(if marker
|
||||||
(goto-char marker)
|
(with-current-buffer (marker-buffer marker)
|
||||||
(display-buffer (current-buffer))
|
(goto-char marker)
|
||||||
(select-window (get-buffer-window (current-buffer)))
|
(display-buffer (current-buffer))
|
||||||
(run-hook-with-args 'org-ql-find-goto-hook))))))
|
(select-window (get-buffer-window (current-buffer)))
|
||||||
|
(run-hook-with-args 'org-ql-find-goto-hook))
|
||||||
|
(funcall fallback selected))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun org-ql-find-in-agenda ()
|
(defun org-ql-find-in-agenda ()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue