Add :limit keyword support
This commit is contained in:
parent
4b8330a683
commit
9b32856244
4 changed files with 67 additions and 26 deletions
|
|
@ -149,7 +149,7 @@ Runs `org-occur-hook' after making the sparse tree."
|
|||
num-results)))
|
||||
|
||||
;;;###autoload
|
||||
(cl-defun org-ql-search (buffers-files query &key narrow super-groups sort title
|
||||
(cl-defun org-ql-search (buffers-files query &key narrow super-groups sort title limit
|
||||
(buffer org-ql-view-buffer))
|
||||
"Search for QUERY with `org-ql'.
|
||||
Interactively, prompt for these variables:
|
||||
|
|
@ -205,7 +205,8 @@ necessary."
|
|||
(results (org-ql-select buffers-files query
|
||||
:action 'element-with-markers
|
||||
:narrow narrow
|
||||
:sort sort))
|
||||
:sort sort
|
||||
:limit limit))
|
||||
(strings (-map #'org-ql-view--format-element results))
|
||||
(buffer (or buffer (format "%s %s*" org-ql-view-buffer-name-prefix (or title query))))
|
||||
(header (org-ql-view--header-line-format
|
||||
|
|
@ -214,6 +215,7 @@ necessary."
|
|||
(org-ql-view-buffers-files buffers-files)
|
||||
(org-ql-view-query query)
|
||||
(org-ql-view-sort sort)
|
||||
(org-ql-view-limit limit)
|
||||
(org-ql-view-narrow narrow)
|
||||
(org-ql-view-super-groups super-groups)
|
||||
(org-ql-view-title title))
|
||||
|
|
@ -242,10 +244,10 @@ automatically from the query."
|
|||
('nil (org-agenda-files nil 'ifmode))
|
||||
(_ (prog1 org-agenda-restrict
|
||||
(with-current-buffer org-agenda-restrict
|
||||
;; Narrow the buffer; remember to widen it later.
|
||||
(setf old-beg (point-min) old-end (point-max)
|
||||
;; Narrow the buffer; remember to widen it later.
|
||||
(setf old-beg (point-min) old-end (point-max)
|
||||
narrow-p t)
|
||||
(narrow-to-region org-agenda-restrict-begin org-agenda-restrict-end))))))
|
||||
(narrow-to-region org-agenda-restrict-begin org-agenda-restrict-end))))))
|
||||
(items (org-ql-select from query
|
||||
:action 'element-with-markers
|
||||
:narrow narrow-p)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue