-
-
Notifications
You must be signed in to change notification settings - Fork 339
use ivy to jump to a PDF outline entry
Mohsin Kaleem edited this page May 26, 2020
·
1 revision
for use with pdftools.
(defun counsel-pdf-outline-action (entry)
(let ((line (cdr entry)))
(with-current-buffer (ivy-state-buffer ivy-last)
(save-excursion
(goto-line (1+ line)) ;; was starting from 0
(call-interactively #'pdf-outline-follow-link)))))
(defun counsel-pdf-outline ()
(interactive)
(let* ((buffer (pdf-outline-noselect nil))
entries)
(with-current-buffer buffer
(setq entries
(split-string
(buffer-substring-no-properties
(point-min) (point-max))
"\n"))
(ivy-read "Title: "
(-zip entries
(number-sequence 0 (length entries)))
:action #'counsel-pdf-outline-action
:caller 'counsel-pdf-outline))))