[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark 2a10b3d75a 17/67: refactor: adjust-positions
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark 2a10b3d75a 17/67: refactor: adjust-positions |
Date: |
Sat, 22 Jul 2023 06:59:00 -0400 (EDT) |
branch: externals/org-remark
commit 2a10b3d75acaa1f5321d11a6b44e002303f206cb
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
refactor: adjust-positions
Simplified logic
---
adjust-highlights.el | 14 +++++++++++---
org-remark-nov.el | 2 +-
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/adjust-highlights.el b/adjust-highlights.el
index 3f55b5ccae..1cad144627 100644
--- a/adjust-highlights.el
+++ b/adjust-highlights.el
@@ -1,3 +1,6 @@
+;; Load works. but need one for sync. Need to re-think
+;; ' and ’ are different in regex of course.
+
;; This is probably not very good for text that you change; and change the
highlights.
;; if you change it, this will bring it back to the "original".
(defun test/move-highlight (highlight text)
@@ -9,9 +12,14 @@
(text (replace-regexp-in-string " " "\[ \n\]" text)))
(org-with-wide-buffer
(unless (string= (buffer-substring beg end) text)
+ ;; Look at one paragraph ahead as it is possible that the
+ ;; position has been displaced across a paragraph
(goto-char beg) (backward-paragraph 2) (setq paragraph-beg (point))
(goto-char beg) (forward-paragraph 2) (setq paragraph-end (point))
- (goto-char (point-min))
- (when (or (re-search-forward text paragraph-end :noerror)
- (re-search-backward text paragraph-beg :noerror))
+ (goto-char paragraph-beg)
+ ;; Search from the beginning of the previous paragraph to the end
+ ;; of next paragraph relative to the begining of the highlight
+ ;; overlay; this way, you don't need to look forward and backward
+ ;; separately.
+ (when (re-search-forward text paragraph-end :noerror)
(move-overlay highlight (match-beginning 0) (match-end 0)))))))
diff --git a/org-remark-nov.el b/org-remark-nov.el
index 322a13ed90..0455944bdc 100644
--- a/org-remark-nov.el
+++ b/org-remark-nov.el
@@ -2,7 +2,7 @@
;; URL: https://github.com/nobiot/org-remark
;; Created: 9 January 2023
-;; Last modified: 12 January 2023
+;; Last modified: 13 January 2023
;;; Commentary:
- [elpa] externals/org-remark eed28d7b8d 26/67: Merge branch 'main' into dev/nov.el, (continued)
- [elpa] externals/org-remark eed28d7b8d 26/67: Merge branch 'main' into dev/nov.el, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark e5de684b67 33/67: fix: adjust location of highlight, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 5b76fa930a 49/67: refactor(load): make load process robust., ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark b50d0f7688 52/67: refactor: rename highlights-after-load-hook to -functions, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 07f5838c40 61/67: fix: Add headlines in the correct order and in the correct headline, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 6ebbce9239 37/67: fix(load): clear obsolete highlight overlays before loading, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 0ec9d2f1c2 41/67: refactor(headline-add): WIP, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 1c2f9ed822 46/67: feat: toggle icons, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 36df818752 55/67: docs: Update user manaul, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 642d4b489f 13/67: docs: updated NEWS, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 2a10b3d75a 17/67: refactor: adjust-positions,
ELPA Syncer <=
- [elpa] externals/org-remark 09d95e7519 20/67: Merge branch 'main' into dev/nov.el, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 52bc575bb9 28/67: docs: comments and docstring, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark e10a00b426 35/67: feat: add icon for highlights with annotation body text #64, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 41f90c53a8 59/67: refactor: Add 'org-remark-string=' for highlight-adjust-positions, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 2bd53de493 60/67: refactor: Set fn to hook org-remark-highlights-after-load-functions, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark e1b7a3a1ba 19/67: Merge remote-tracking branch 'sati-bodhi/main' into dev/nov.el, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark 090156bed2 21/67: feat: org-remark-nov-mode minor mode, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark ef7e02d542 34/67: fix: annotation body to be nil when no body text, ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark aa58058ec4 38/67: refactor: add-headlines (WIP), ELPA Syncer, 2023/07/22
- [elpa] externals/org-remark c38f46e806 42/67: refactor(highlight-add): remove spurflous/obsolete elements, ELPA Syncer, 2023/07/22