Function: doc-view--pdf-outline
doc-view--pdf-outline is a byte-compiled function defined in
doc-view.el.gz.
Signature
(doc-view--pdf-outline &optional FILE-NAME)
Documentation
Return a list describing the outline of FILE-NAME.
Return a list describing the current file if FILE-NAME is nil.
Each element in the returned list contains information about a section's
title, nesting level and page number. The list is flat: its tree
structure is extracted by doc-view--imenu-subtree.
Source Code
;; Defined in /usr/src/emacs/lisp/doc-view.el.gz
(defun doc-view--pdf-outline (&optional file-name)
"Return a list describing the outline of FILE-NAME.
Return a list describing the current file if FILE-NAME is nil.
Each element in the returned list contains information about a section's
title, nesting level and page number. The list is flat: its tree
structure is extracted by `doc-view--imenu-subtree'."
(let ((fn (or file-name (buffer-file-name))))
(when fn
(with-temp-buffer
(let ((proc (make-process
:name "doc-view-pdf-outline"
:command (list "mutool" "run")
:buffer (current-buffer))))
(process-send-string proc (format doc-view--mutool-pdf-outline-script
(expand-file-name fn)))
;; Need to send this twice for some reason...
(process-send-eof)
(process-send-eof)
(while (accept-process-output proc))
(unless (eq (process-status proc) 'exit)
(setq doc-view--outline 'unavailable)
(imenu-unavailable-error "Unable to create imenu index using `mutool'"))
(goto-char (point-min))
(when (search-forward "BEGIN" nil t)
(condition-case nil
(read (current-buffer))
(end-of-file nil))))))))