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

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

[elpa] externals/denote 75cf3d31d0 288/355: Accept optional BEG and END


From: ELPA Syncer
Subject: [elpa] externals/denote 75cf3d31d0 288/355: Accept optional BEG and END for buttonization
Date: Sun, 26 Jun 2022 23:58:33 -0400 (EDT)

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

    Accept optional BEG and END for buttonization
---
 denote-link.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/denote-link.el b/denote-link.el
index e42dfb6bab..a2cacfe29f 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -246,18 +246,21 @@ format is always [[denote:IDENTIFIER]]."
               (button-end button)))))
     (funcall denote-link-buton-action (file-name-completion id 
(denote-directory)))))
 
-(defun denote-link-buttonize-buffer ()
+(defun denote-link-buttonize-buffer (&optional beg end)
   "Make denote: links actionable buttons in the current buffer.
 Add this to `find-file-hook' (it will not do anything in
 `org-mode' buffers, as buttons already work there).
 
+With optional BEG and END as buffer positions, limit the process
+to the region in-between.
+
 DEVELOPMENT NOTE: This is experimental and subject to review
 before the release of version 0.1.0.  Please test it and/or share
 your thoughts about it."
   (when (and (not (derived-mode-p 'org-mode)) (denote--current-file-is-note-p))
     (save-excursion
-      (goto-char (point-min))
-      (while (re-search-forward denote--id-regexp nil t)
+      (goto-char (or beg (point-min)))
+      (while (re-search-forward denote--id-regexp end t)
         (when-let ((string (denote-link--link-at-point-string))
                    (beg (match-beginning 0))
                    (end (match-end 0)))



reply via email to

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