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

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

[elpa] externals/org-remark 2ae9516091 40/67: fix(highlights-get): exist


From: ELPA Syncer
Subject: [elpa] externals/org-remark 2ae9516091 40/67: fix(highlights-get): existence check beg and end
Date: Sat, 22 Jul 2023 06:59:03 -0400 (EDT)

branch: externals/org-remark
commit 2ae951609159cfcd1431a7651fc6aa2e434bae63
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>

    fix(highlights-get): existence check beg and end
    
    beg and end must exist. If either is nil, `number-to-string` errors and
    load stops prematurely. This can happen when the user manually manages
    the notes file and accidentally deletes the beg/end props.
---
 NEWS          |  6 ++++++
 org-remark.el | 14 ++++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index c63482bdf5..1fce3c7486 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,12 @@ Current development version
   - feat: adjust positions after load
   - feat: org-remark-highlights-after-load-hook
 
+  - fix: highlights-get existence check beg and end
+
+         beg and end must exist. If either is nil, `number-to-string`
+         errors and load stops prematurely. This can happen when the
+         user manually manages the notes file and accidentally deletes
+         the beg/end props.
 
 Version 1.1.0
 
diff --git a/org-remark.el b/org-remark.el
index 5e3b8e2ca0..b8423b3819 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -1352,14 +1352,16 @@ highlight is a property list in the following 
properties:
              ;; `org-remark-notes-headline-functions'
              (while (not (org-next-visible-heading 1))
                (let ((id (org-entry-get (point) org-remark-prop-id))
-                     (beg (string-to-number
-                           (org-entry-get (point)
-                                          org-remark-prop-source-beg)))
-                     (end (string-to-number
-                           (org-entry-get (point)
-                                          org-remark-prop-source-end)))
+                     (beg (org-entry-get (point)
+                                         org-remark-prop-source-beg))
+                     (end (org-entry-get (point)
+                                         org-remark-prop-source-end))
                      (body (org-remark-notes-get-body)))
+                 ;; beg and end must exist. If either is nil
+                 ;; `string-to-number' errors
                  (when (and id beg end)
+                   (setq beg (string-to-number beg))
+                   (setq end (string-to-number end))
                    (push (list :id id
                                :location (cons beg end)
                                :label    (org-entry-get (point) 
"org-remark-label")



reply via email to

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