-
Notifications
You must be signed in to change notification settings - Fork 53
Example functions
Bruce D'Arcus edited this page Dec 15, 2021
·
22 revisions
If you run this and select candidates, this will pass the list of any associated PDF files to pdf-tools to search across all of them.
(defun ex/search-pdf-contents (keys-entries &optional string)
"Search pdfs."
(interactive (list (citar-select-refs)))
(let ((files (seq-filter
(lambda (file) (string-match-p "\\.pdf$" file))
(citar-file--files-for-multiple-entries
(citar--ensure-entries keys-entries)
citar-library-paths
'("pdf"))))
(string (or string (read-string "Search string: "))))
(pdf-occur-search files string t)))
;; with this, you can exploit embark's multitarget actions, so that you can run `embark-act-all`
(add-to-list 'embark-multitarget-actions #'ex/search-pdf-contents)