From 4bd1d6304dcdf5990f3a6ea88fc3b7244304b801 Mon Sep 17 00:00:00 2001 From: cxxxr Date: Tue, 26 Sep 2023 11:04:15 +0900 Subject: [PATCH] minor change --- src/ext/link.lisp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/ext/link.lisp b/src/ext/link.lisp index 5643c9469..bd287bf66 100644 --- a/src/ext/link.lisp +++ b/src/ext/link.lisp @@ -58,23 +58,24 @@ (unless (end-line-p point) (character-offset point -1)) (let ((file (points-to-string link-start point))) - (multiple-value-bind (matched-string groups) - (looking-at point ":(\\d+)(?::(\\d+))?") - (cond (matched-string - (character-offset point (length matched-string)) - (let ((line-number (elt groups 0)) - (charpos (elt groups 1))) + (when (probe-file file) + (multiple-value-bind (matched-string groups) + (looking-at point ":(\\d+)(?::(\\d+))?") + (cond (matched-string + (character-offset point (length matched-string)) + (let ((line-number (elt groups 0)) + (charpos (elt groups 1))) + (make-instance 'file-link + :file file + :line-number (parse-integer line-number) + :charpos (when charpos (parse-integer charpos)) + :start link-start + :end point))) + (t (make-instance 'file-link :file file - :line-number (parse-integer line-number) - :charpos (when charpos (parse-integer charpos)) :start link-start - :end point))) - (t - (make-instance 'file-link - :file file - :start link-start - :end point)))))))))) + :end point))))))))))) (defun search-url-link (point &optional limit) (when (search-forward-regexp point "https?://" limit)