[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark 7bf6359fae 23/67: refactor: remove org-remar
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark 7bf6359fae 23/67: refactor: remove org-remark-notes-update-source |
Date: |
Sat, 22 Jul 2023 06:59:01 -0400 (EDT) |
branch: externals/org-remark
commit 7bf6359fae292eb70e653e19ead86e589742da79
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
refactor: remove org-remark-notes-update-source
It is essentially the same as 'org-remark-highligths-load' but not for
the initial load but an update.
---
org-remark.el | 55 +++++++++++++++++++++----------------------------------
1 file changed, 21 insertions(+), 34 deletions(-)
diff --git a/org-remark.el b/org-remark.el
index 6e194bf759..2fdd3ef21f 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -1200,36 +1200,6 @@ base-buffer of the notes and not to the indirect buffer."
(setq org-remark-notes-source-buffers
(seq-filter #'buffer-live-p org-remark-notes-source-buffers)))
-(defun org-remark-notes-update-source (source-buffer)
- "Update SOURCE-BUFFER with marginal notes properties.
-This function assumes the current buffer is one visiting the
-notes file (indrect or base)."
- (let ((notes-buf (current-buffer))
- (overlays)) ;; highlight overlays
- (with-current-buffer source-buffer
- (dolist (highlight (org-remark-highlights-get notes-buf) overlays)
- (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)))
- ;; In order to update the overlay, it is first gets deleted
- ;; and newly loaded. This way, we avoid duplicate of the same
- ;; highlight.
-
- ;; FIXME Currently the when clause is used to guard against
- ;; the case wheremarkre a highlight overlay is not found. It should
- ;; be an edge case but the highlight could have moved to a
- ;; completely new location where the old location does not
- ;; overlap with the new location at all.
- (when ov (org-remark-highlight-clear ov))
- (push (org-remark-highlight-load highlight) overlays)))
- ;; TODO This function is pretty much the same as
- ;; `org-remark-highlights-load'. Refactor into one?
- (run-hook-with-args 'org-remark-highlights-after-load-hook
- overlays notes-buf))
- t))
-
(defun org-remark-notes-sync-with-source ()
"Update sources from the current notes buffer.
This function iterates through `org-remark-notes-source-buffers'
@@ -1244,7 +1214,9 @@ It is meant to be used in `after-save-hook'."
(with-current-buffer notes-buffer
(org-remark-notes-housekeep)
(dolist (source-buf org-remark-notes-source-buffers)
- (org-remark-notes-update-source source-buf)))))
+ (with-current-buffer source-buffer
+ (org-remark-highlights-load :update))))
+ t))
;;;;; org-remark-highlights
@@ -1307,7 +1279,7 @@ highlight is a property list in the following properties:
It is run with OVERLAYS and NOTES-BUF as arguments. OVERLAYS are
highlights. It is run with the source buffer as current buffer.")
-(defun org-remark-highlights-load ()
+(defun org-remark-highlights-load (&optional update)
"Visit `org-remark-notes-file' & load the saved highlights onto current
buffer.
If there is no highlights or annotations for current buffer,
output a message in the echo.
@@ -1324,8 +1296,23 @@ load the highlights"
(source-buf (current-buffer))
(overlays)) ;; highlight overlays
(dolist (highlight (org-remark-highlights-get notes-buf) overlays)
- (push (org-remark-highlight-load highlight) overlays))
- (org-remark-notes-setup notes-buf source-buf)
+ (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)))
+ ;; In order to update the overlay, it is first gets deleted
+ ;; and newly loaded. This way, we avoid duplicate of the same
+ ;; highlight.
+
+ ;; FIXME Currently the when clause is used to guard against
+ ;; the case wheremarkre a highlight overlay is not found. It should
+ ;; be an edge case but the highlight could have moved to a
+ ;; completely new location where the old location does not
+ ;; overlap with the new location at all.
+ (when ov (org-remark-highlight-clear ov))
+ (push (org-remark-highlight-load highlight) overlays)))
+ (unless update (org-remark-notes-setup notes-buf source-buf))
(run-hook-with-args 'org-remark-highlights-after-load-hook
overlays notes-buf))
t)
- [elpa] externals/org-remark 02f2ca5c7c 12/67: fix: Text cut off if the highlight spans across two lines #56, (continued)
- [elpa] externals/org-remark 02f2ca5c7c 12/67: fix: Text cut off if the highlight spans across two lines #56, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark a2fcae8d5b 03/67: refactor(mark): save notes buf only when create/change, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark b2e0b37247 04/67: refactor(save): -highlight-save function, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 3f71f58603 05/67: feat: dynamic notes headline level - WIP with test code, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark b2d2d432dd 06/67: feat(save): per-mode options for -notes-create-entry-functions WIP, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 8e067b1813 11/67: refactor(save): -highlight-save -> -highlight-add, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 3c25682d1d 14/67: fix: typo in regression issue, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 97c5f1c8e0 15/67: fix: missing defvar org-remark-source-find-file-name-functions, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark ba8e3433e0 18/67: feat: test/find-nov-file-buffer, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 9f95c8a6f9 22/67: refactor: adjust-positions and sync, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 7bf6359fae 23/67: refactor: remove org-remark-notes-update-source,
ELPA Syncer <=
- [elpa] externals/org-remark 5bd790cf3c 27/67: docs: docstring, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 5ea75070bc 29/67: refactor: move highlights-after-load-hook to org-remark.el, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 2ae9516091 40/67: fix(highlights-get): existence check beg and end, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 612629c366 51/67: docs: NEWS and README, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark e8e0693268 07/67: fix(save): source-setup-done needs to be done in source, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark b35fcfdbe4 16/67: feat: adjust positions after load via new hook, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 32860de66b 24/67: fix: typo in the previous refactor, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark f2a1e9f339 32/67: fix(eww) adjust the arg of fn link-to-source, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark fa81cc764a 36/67: feat(adjust-positions): Add an icon indicating the position adjusted, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 5a0299bdf7 39/67: refactor: (WIP) highlight-new-headline-maybe, ELPA Syncer, 2023/07/22