emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 3a1d857850: Define denote-link-markdown-follow f


From: ELPA Syncer
Subject: [elpa] externals/denote 3a1d857850: Define denote-link-markdown-follow for C-c C-o in markdown-mode buffers
Date: Sat, 10 Feb 2024 09:57:46 -0500 (EST)

branch: externals/denote
commit 3a1d8578505dff27c6bde6322cbf508716f8b048
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Define denote-link-markdown-follow for C-c C-o in markdown-mode buffers
---
 README.org | 10 ++++++++++
 denote.el  | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/README.org b/README.org
index f74e0f8094..5e2eb8dae1 100644
--- a/README.org
+++ b/README.org
@@ -1863,6 +1863,16 @@ like an ordinary link by default.  This is just a 
convenience for the
 user/theme in case they want =denote:= links to remain distinct from
 other links.
 
+[ The following is part of {{{development-version}}}. ]
+
+#+findex: denote-link-markdown-follow
+In files whose major mode is ~markdown-mode~, the default key binding
+=C-c C-o= (which calls the command ~markdown-follow-thing-at-point~)
+correctly resolves =denote:= links. This method works in addition to
+the =RET= key, which is made available by the aforementioned
+buttonization. Interested users can refer to the function
+~denote-link-markdown-follow~ for the implementation details.
+
 ** The ~denote-org-store-link-to-heading~ user option
 :PROPERTIES:
 :CUSTOM_ID: h:d99de1fb-b1b7-4a74-8667-575636a4d6a4
diff --git a/denote.el b/denote.el
index ae73723459..c69a59ea65 100644
--- a/denote.el
+++ b/denote.el
@@ -3647,6 +3647,16 @@ positions, limit the process to the region in-between."
                    (end (match-end 0)))
           (make-button beg end 'type 'denote-link-button))))))
 
+(defun denote-link-markdown-follow (link)
+  "Function to open Denote file present in LINK.
+To be assigned to `markdown-follow-link-functions'."
+  (string-match denote-id-regexp link)
+  (funcall denote-link-button-action
+           (denote-get-path-by-id (match-string 0 link))))
+
+(eval-after-load 'markdown-mode
+  '(add-hook 'markdown-follow-link-functions #'denote-link-markdown-follow))
+
 ;;;;; Backlinks' buffer
 
 (define-button-type 'denote-link-backlink-button



reply via email to

[Prev in Thread] Current Thread [Next in Thread]