; Fix documentation of imenu access in DocView

* lisp/doc-view.el (doc-view-imenu-enabled)
(doc-view--pdf-outline, doc-view-imenu-index): Doc fixes.

* doc/emacs/misc.texi (DocView Navigation): Fix typo and wording.
This commit is contained in:
Eli Zaretskii 2022-09-27 16:01:50 +03:00
parent fe21507439
commit 37fe62a3bd
2 changed files with 12 additions and 11 deletions

View file

@ -585,11 +585,11 @@ default size for DocView, customize the variable
@code{doc-view-resolution}.
@vindex doc-view-imenu-enabled
When the @command{mutool} executable is available, DocView will use
When the @command{mutool} program is available, DocView will use it
to generate entries for an outline menu, making it accessible via the
imenu facility (@pxref{Imenu}). To disable this functionality even
when @command{mutool} can be found in your @code{exec-path}, customize
the variable @code{doc-view-imenu-enabled}.
@code{imenu} facility (@pxref{Imenu}). To disable this functionality
even when @command{mutool} can be found on your system, customize
the variable @code{doc-view-imenu-enabled} to the @code{nil} value.
@node DocView Searching
@subsection DocView Searching

View file

@ -215,7 +215,7 @@ are available (see Info node `(emacs)Document View')."
:version "29.1")
(defcustom doc-view-imenu-enabled (and (executable-find "mutool") t)
"Whether to generate an imenu outline when mutool is available."
"Whether to generate an imenu outline when \"mutool\" is available."
:type 'boolean
:version "29.1")
@ -1884,9 +1884,10 @@ If BACKWARD is non-nil, jump to the previous match."
"[^\t]+\\(\t+\\)\"\\(.+\\)\"\t#\\(?:page=\\)?\\([0-9]+\\)")
(defun doc-view--pdf-outline (&optional file-name)
"Return a describing the outline of FILE-NAME (or current if nil).
"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 list contains information about a section's
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* ((outline nil)
@ -1925,11 +1926,11 @@ entries at an upper level."
(cons (nreverse index) outline)))
(defun doc-view-imenu-index (&optional file-name goto-page-fn)
"Create an imenu index using mutool to extract its outline.
"Create an imenu index using \"mutool\" to extract its outline.
For extensibility, a FILE-NAME other than the current buffer and
a jumping function, GOTO-PAGE-FN other than `doc-view-goto-page'
can be specified."
For extensibility, callers can specify a FILE-NAME to indicate
the buffer other than the current buffer, and a jumping function
GOTO-PAGE-FN other than `doc-view-goto-page'."
(let* ((goto (or goto-page-fn 'doc-view-goto-page))
(act (lambda (_name _pos page) (funcall goto page))))
(car (doc-view--imenu-subtree (doc-view--pdf-outline file-name) act))))