Function: doc-view-search

doc-view-search is an interactive and byte-compiled function defined in doc-view.el.gz.

Signature

(doc-view-search NEW-QUERY &optional BACKWARD)

Documentation

Jump to the next match or initiate a new search if NEW-QUERY is given.

If the current document hasn't been transformed to plain text till now do that first. If BACKWARD is non-nil, jump to the previous match.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/doc-view.el.gz
(defun doc-view-search (new-query &optional backward)
  "Jump to the next match or initiate a new search if NEW-QUERY is given.
If the current document hasn't been transformed to plain text
till now do that first.
If BACKWARD is non-nil, jump to the previous match."
  (interactive "P")
  (if (and (not new-query)
	   doc-view--current-search-matches)
      (if backward
	  (doc-view-search-previous-match 1)
	(doc-view-search-next-match 1))
    ;; New search, so forget the old results.
    (setq doc-view--current-search-matches nil)
    (let ((txt (expand-file-name "doc.txt"
				 (doc-view--current-cache-dir))))
      (if (file-readable-p txt)
	  (progn
	    (setq doc-view--current-search-matches
		  (doc-view-search-internal
		   (read-from-minibuffer "Regexp: ")
		   txt))
	    (message "DocView: search yielded %d matches."
		     (doc-view-search-no-of-matches
		      doc-view--current-search-matches)))
	;; We must convert to TXT first!
	(if doc-view--current-converter-processes
	    (message "DocView: please wait till conversion finished.")
	  (doc-view-doc->txt txt (lambda () (doc-view-search nil))))))
    ;; Update the tool bar items.
    (force-mode-line-update)))