summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Politz <politza@hochschule-trier.de>2017-08-10 20:32:33 +0200
committerAndreas Politz <politza@hochschule-trier.de>2017-08-10 20:32:33 +0200
commit8fc137673c59c8cab392f519dab967051a0b07f0 (patch)
tree32efafc2a56bc086f6a64a4ea6ed8c14580dd3e8
parent9d807aab423172a7a21e02432c99c037746854a9 (diff)
Add a command performing a sync-backward to isearch
-rw-r--r--lisp/pdf-isearch.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/pdf-isearch.el b/lisp/pdf-isearch.el
index d0e2129..bb950aa 100644
--- a/lisp/pdf-isearch.el
+++ b/lisp/pdf-isearch.el
@@ -116,6 +116,7 @@ searching across multiple lines.")
(define-key kmap (kbd "C-d") 'pdf-view-dark-minor-mode)
(define-key kmap (kbd "C-b") 'pdf-isearch-batch-mode)
(define-key kmap (kbd "M-s o") 'pdf-isearch-occur)
+ (define-key kmap (kbd "M-s s") 'pdf-isearch-sync-backward)
kmap)
"Keymap used in `pdf-isearch-active-mode'.
@@ -433,6 +434,18 @@ there was no previous search, this function returns t."
(pdf-occur (or regexp isearch-string) regexp))
(isearch-message)))
+(defun pdf-isearch-sync-backward ()
+ "Visit the source of the beginning of the current match."
+ (interactive)
+ (pdf-util-assert-pdf-window)
+ (unless pdf-isearch-current-match
+ (user-error "No current or recent match"))
+ (when isearch-mode
+ (isearch-exit))
+ (cl-destructuring-bind (left top _right _bot)
+ (car pdf-isearch-current-match)
+ (pdf-sync-backward-search left top)))
+
;; * ================================================================== *
;; * Interface to epdfinfo