From d8c2488622e4a9e64a5be197832faddd35faeb1f Mon Sep 17 00:00:00 2001 From: bplubell Date: Wed, 18 Mar 2026 15:36:56 -0700 Subject: [PATCH] Fix error when following non-Denote Markdown links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When following links in markdown-mode that are to non-Denote resources like URLs, you would see the error: Cannot open ‘nil’ of unknown link type That is because Denote adds denote-link-markdown-follow to markdown-follow-link-functions, which eventually calls denote--act-on-query-link with a nil value. To solve this, we return nil from denote-link-markdown-follow when we do not know how to handle the link. That lets markdown-mode try its link handling. Per the markdown-follow-link-functions documentation, we should "return non-nil if [we] followed the link, or nil if not." --- denote.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/denote.el b/denote.el index 7417017..51af75e 100644 --- a/denote.el +++ b/denote.el @@ -6367,10 +6367,11 @@ Return either nil or a list whose elements are two cons cells: This is the subroutine of `denote-link-open-at-point' and `denote-link-open-at-mouse'." (pcase-let* ((data (denote--link-at-point-get-data position)) - (`(,target . ,_) (car data))) - (if-let* ((path (denote-get-path-by-id target))) - (funcall denote-open-link-function path) - (denote--act-on-query-link target)))) + (`(,target . ,_) (car data)) + (path (denote-get-path-by-id target))) + (cond + (path (funcall denote-open-link-function path)) + (target (denote--act-on-query-link target))))) (defun denote-link-open-at-point () "Open Denote link at point."