From 20bac1a7b4f4546bde0344d9df3bab941cf21aa7 Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann Date: Sat, 2 May 2020 00:59:45 +0200 Subject: Revisit relative files visiting logic again --- nov.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'nov.el') diff --git a/nov.el b/nov.el index 193d1f3..585c1b4 100644 --- a/nov.el +++ b/nov.el @@ -648,17 +648,17 @@ 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." - (let ((index nov-documents-index) - (shr-target-id 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")) - (nov-goto-document 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))) + (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)) (when target (let ((pos (next-single-property-change (point-min) 'shr-target-id))) (when (not pos) -- cgit v1.2.3