Fix: Handle the buffer argument properly; Restore org-overview call

This commit is contained in:
Akira Komamura 2019-08-24 19:46:21 +09:00
parent 2cd612d1ba
commit 6b0ff77981

View file

@ -1016,8 +1016,15 @@ When optional argument KEEP-PREVIOUS is non-nil, highlighting and
exposing done by a previous call to `org-occur' or `org-ql-occur'
will be kept, to allow stacking of calls to this command."
(interactive (list (read-minibuffer "Query: ")))
(unless (bufferp buffer)
(user-error "BUFFER should be a single buffer"))
(with-current-buffer buffer
(unless keep-previous
(org-remove-occur-highlights nil nil t))
(when (or (not keep-previous) ; do not want to keep
(not org-occur-highlights)) ; no previous matches
;; hide everything
(org-overview))
;; (push (cons regexp callback) org-occur-parameters)
(let ((result (org-ql-select buffer query
:action
@ -1033,7 +1040,7 @@ will be kept, to allow stacking of calls to this command."
(org-hide-archived-subtrees (point-min) (point-max)))
(run-hooks 'org-occur-hook)
(when (called-interactively-p 'interactive)
(message "%d match(es) for query %s" (length result) query))))
(message "%d match(es) for query %s" (length result) query)))))
;;;; Footer