aboutsummaryrefslogtreecommitdiff
path: root/nov.el
diff options
context:
space:
mode:
authorVasilij Schneidermann <mail@vasilij.de>2020-06-08 15:38:17 +0200
committerVasilij Schneidermann <mail@vasilij.de>2020-06-08 15:38:17 +0200
commit4889373f1f3cd0e7277b5c3a52ff80bdcbf86b4e (patch)
tree30885308c005cdea83e5a05a7c989ecd58bf7e63 /nov.el
parent55a3b41aa71740826a1cd410fa8d24a313f27b7c (diff)
Fix nov-history-back/-forward for relative links
Diffstat (limited to 'nov.el')
-rw-r--r--nov.el23
1 files changed, 12 insertions, 11 deletions
diff --git a/nov.el b/nov.el
index bb17cb2..1f509b1 100644
--- a/nov.el
+++ b/nov.el
@@ -646,17 +646,18 @@ the HTML is rendered with `nov-render-html-function'."
(defun nov-visit-relative-file (filename target)
"Visit the document as specified by FILENAME and TARGET."
- (when (not (zerop (length filename)))
- (let* ((current-path (cdr (aref nov-documents nov-documents-index)))
- (directory (file-name-directory current-path))
- (path (file-truename (nov-make-path directory filename)))
- (index (nov-find-document
- (lambda (doc) (equal path (file-truename (cdr doc)))))))
- (when (not index)
- (error "Couldn't locate document"))
- (setq nov-documents-index index)))
- (let ((shr-target-id target))
- (nov-goto-document nov-documents-index))
+ (let (index)
+ (when (not (zerop (length filename)))
+ (let* ((current-path (cdr (aref nov-documents nov-documents-index)))
+ (directory (file-name-directory current-path))
+ (path (file-truename (nov-make-path directory filename)))
+ (match (nov-find-document
+ (lambda (doc) (equal path (file-truename (cdr doc)))))))
+ (when (not match)
+ (error "Couldn't locate document"))
+ (setq index match)))
+ (let ((shr-target-id target))
+ (nov-goto-document (or index nov-documents-index))))
(when target
(let ((pos (next-single-property-change (point-min) 'shr-target-id)))
(when (not pos)