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

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

[elpa] externals/denote be17fcb027 5/6: Fix off-by-one jump to Org headi


From: ELPA Syncer
Subject: [elpa] externals/denote be17fcb027 5/6: Fix off-by-one jump to Org heading line
Date: Sat, 18 May 2024 03:57:44 -0400 (EDT)

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

    Fix off-by-one jump to Org heading line
    
    This wouid match the wrong heading if there were no spaces between the
    headings. Thanks to kilesduli for bringing this matter to my attention
    in issue 354: <https://github.com/protesilaos/denote/issues/354>.
---
 denote-org-extras.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/denote-org-extras.el b/denote-org-extras.el
index 3205d7426b..23e94017be 100644
--- a/denote-org-extras.el
+++ b/denote-org-extras.el
@@ -72,9 +72,10 @@ the current file."
   "Return heading text and CUSTOM_ID from the given LINE in FILE."
   (with-current-buffer (find-file-noselect file)
     (save-excursion
-      (goto-char (point-min))
-      (forward-line line)
-      (cons (denote-link-ol-get-heading) (denote-link-ol-get-id)))))
+      (save-restriction
+        (goto-char (point-min))
+        (forward-line (1- line))
+        (cons (denote-link-ol-get-heading) (denote-link-ol-get-id))))))
 
 (defun denote-org-extras-format-link-with-heading (file heading-id description)
   "Prepare link to FILE with HEADING-ID using DESCRIPTION."



reply via email to

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