[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark b6fa1bea1a 4/9: fix: notes-update-source to
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark b6fa1bea1a 4/9: fix: notes-update-source to allow for beg end adjustment |
Date: |
Tue, 27 Dec 2022 19:58:31 -0500 (EST) |
branch: externals/org-remark
commit b6fa1bea1a68704deb30cda134f7482aa0e05276
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
fix: notes-update-source to allow for beg end adjustment
Added a new function org-remark-find-overlay-in. Previously
org-remark-find-overlay-at was used. This had a problem when users
manually move the highlight in the notes by adjusting :org-remark-beg:
and :org-remark-end: properties. When the beg point does not have the
hightlight overlay, the update would fail.
Using org-remark-find-overlay-in is not perfect as the overlay will need
to be found in the location between beg and end; however, this is deemed
to be an edge case -- you would not really move the highlight.
---
org-remark.el | 35 +++++++++++++++++++++++++++++------
1 file changed, 29 insertions(+), 6 deletions(-)
diff --git a/org-remark.el b/org-remark.el
index f01022b6e8..437b5a894b 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -128,6 +128,10 @@ returned by `org-remark-notes-get-file-name'.")
(defvar-local org-remark-highlights-hidden nil
"Keep hidden/shown state of the highlights in current buffer.")
+;; TODO org-remark-sync?
+(defvar-local org-remark-notes-setup-done nil)
+(defvar-local org-remark-source-setup-done nil)
+
(defvar org-remark-last-notes-buffer nil
"Stores the cloned indirect buffer visiting the notes file.
It is meant to exist only one of these in each Emacs session.")
@@ -647,6 +651,26 @@ If there are more than one, return CAR of the list."
(setq overlays (cdr overlays)))
(car found)))
+(defun org-remark-find-overlay-in (beg end &optional id)
+ "Return one org-remark overlay between BEG and END.
+If there are more than one, return CAR of the list.
+Optioanlly ID can be passed to find the exacth ID match."
+ (let* ((overlays (overlays-in beg end))
+ found)
+ (while overlays
+ (let ((overlay (car overlays)))
+ (if (overlay-get overlay 'org-remark-id)
+ (setq found (cons overlay found))))
+ (setq overlays (cdr overlays)))
+ (when id (setq found
+ (seq-filter
+ (lambda (ov)
+ (equal (overlay-get ov 'org-remark-id) id))
+ found)))
+ (car found)))
+
+
+
;;;; org-remark-highlight
;; Work on a single highlight
@@ -1024,9 +1048,6 @@ load the highlights"
(setq org-remark-source-setup-done t))
t)
-(defvar-local org-remark-notes-setup-done nil)
-(defvar-local org-remark-source-setup-done nil)
-
(defun org-remark-notes-setup (notes-buf source-buf source-file-name)
;;; Start tracking the source buffer in the notes buffer as local variable.
;;; This adds variable only to the base-buffer and not to the indrect buffer.
@@ -1052,9 +1073,11 @@ Trigger by on-save of the notes."
(org-remark-highlights-get (current-buffer) source-file-name)))
(with-current-buffer source-buffer
(dolist (highlight new-highlights)
- (let ((ov (org-remark-find-overlay-at-point
- (car (plist-get highlight :location))))
- (props (plist-get highlight :props)))
+ (let* ((location (plist-get highlight :location))
+ (beg (car location))
+ (end (cdr location))
+ (id (plist-get highlight :id))
+ (ov (org-remark-find-overlay-in beg end id)))
(delete-overlay ov)
(org-remark-highlight-load highlight))))))
- [elpa] externals/org-remark updated (a6b79194d8 -> 5fb747a419), ELPA Syncer, 2022/12/27
- [elpa] externals/org-remark 854856059f 8/9: fix: issue #44 change CATEGORY, ELPA Syncer, 2022/12/27
- [elpa] externals/org-remark 47918fa751 2/9: feat: sync notes with source, ELPA Syncer, 2022/12/27
- [elpa] externals/org-remark cc69b0359b 6/9: fix: inifinate loop when notes = source for notes-sync, ELPA Syncer, 2022/12/27
- [elpa] externals/org-remark b6fa1bea1a 4/9: fix: notes-update-source to allow for beg end adjustment,
ELPA Syncer <=
- [elpa] externals/org-remark f0a4f23911 3/9: feat: notes-source sync setup, ELPA Syncer, 2022/12/27
- [elpa] externals/org-remark 2b0ccad245 1/9: refactor: org-remark-highlight-get-text -> notes-get-text, ELPA Syncer, 2022/12/27
- [elpa] externals/org-remark 5fb747a419 9/9: Merge branch 'notes-sync', ELPA Syncer, 2022/12/27
- [elpa] externals/org-remark eb6456d7f9 5/9: docs(notes-sync): add FIXME comment for the previous commit, ELPA Syncer, 2022/12/27
- [elpa] externals/org-remark 00e56e12a6 7/9: fix: text-property org-remark-label to be symbol, ELPA Syncer, 2022/12/27