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

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

[elpa] externals/org-remark d7ae7158bd 48/67: fix(adjust-position) newli


From: ELPA Syncer
Subject: [elpa] externals/org-remark d7ae7158bd 48/67: fix(adjust-position) newline char prevent string match
Date: Sat, 22 Jul 2023 06:59:03 -0400 (EDT)

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

    fix(adjust-position) newline char prevent string match
    
    Cater to the case when the text is divided by a newline character \n.
    Remove all spaces and newline chars before comparing the strings.
    
    When the highlighted text is long and include a newline, it's not
    easy (possilbe?) to determine it should be replaced with a space or no
    space. Eliminate the ambiguity by removing all spaces and newline chars.
---
 org-remark.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/org-remark.el b/org-remark.el
index f487493bee..9ccd25a513 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -6,7 +6,7 @@
 ;; URL: https://github.com/nobiot/org-remark
 ;; Version: 1.1.0
 ;; Created: 22 December 2020
-;; Last modified: 11 July 2023
+;; Last modified: 12 July 2023
 ;; Package-Requires: ((emacs "27.1") (org "9.4"))
 ;; Keywords: org-mode, annotation, note-taking, marginal-notes, wp,
 
@@ -1074,12 +1074,15 @@ It searches for TEXT, which should be the original text 
of the highlight."
   ;; if you change it, this will bring it back to the "original".
   (let* ((beg (overlay-start highlight))
          (end (overlay-end highlight))
-         (paragraph-beg)(paragraph-end)
-         ;; Cater to the case when the text is divided by a \n
-         ;; The regexp must look for space or \n
-         (text (replace-regexp-in-string " " "\[ \n\]" text)))
+         (paragraph-beg)(paragraph-end))
     (org-with-wide-buffer
-     (unless (string= (buffer-substring beg end) text)
+     (unless (string=
+              ;; Cater to the case when the text is divided by a newline
+              ;; character \n. Remove all spaces and newline chars
+              ;; before comparing the strings.
+              (replace-regexp-in-string "[\n ]" ""
+                                        (buffer-substring beg end))
+              (replace-regexp-in-string "[\n ]" "" 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))



reply via email to

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