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

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

[elpa] externals/org-remark 916924ad29 3/3: fix:#19 infinitate loop when


From: ELPA Syncer
Subject: [elpa] externals/org-remark 916924ad29 3/3: fix:#19 infinitate loop when notes buffer is the current buffer
Date: Fri, 4 Feb 2022 13:57:54 -0500 (EST)

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

    fix:#19 infinitate loop when notes buffer is the current buffer
    
    * org-remark.el (org-remark-highlight-save):
    
    Now `org-remark-save' is temporarily removed from `after-save-hook' to 
avoid infinate loop.
---
 org-remark.el | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/org-remark.el b/org-remark.el
index 4a3c72123c..3004fe486f 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -6,7 +6,7 @@
 ;; URL: https://github.com/nobiot/org-remark
 ;; Version: 0.2.0
 ;; Created: 22 December 2020
-;; Last modified: 01 February 2022
+;; Last modified: 04 February 2022
 ;; Package-Requires: ((emacs "27.1") (org "9.4"))
 ;; Keywords: org-mode, annotation, writing, note-taking, marginal-notes
 
@@ -743,11 +743,9 @@ source with using ORGID."
          (id (plist-get props 'org-remark-id))
          (text (org-with-wide-buffer (buffer-substring-no-properties beg end)))
          (orgid (org-remark-highlight-get-org-id beg))
-         ;; FIXME current-line - it's not always at point
+         (notes-buf (find-file-noselect (org-remark-notes-get-file-path)))
          (line-num (org-current-line beg)))
-    ;; TODO Want to add a check if save is applicable here.
-    (with-current-buffer (find-file-noselect (org-remark-notes-get-file-path))
-      ;; If it is a new empty marginalia file
+    (with-current-buffer notes-buf
       (when (featurep 'org-remark-convert-legacy) 
(org-remark-convert-legacy-data))
       (org-with-wide-buffer
        (let ((file-headline (or (org-find-property
@@ -789,7 +787,15 @@ source with using ORGID."
            (org-remark-notes-set-properties beg end props)
            (when (and orgid org-remark-use-org-id)
                (insert (concat "[[id:" orgid "]" "[" title "]]"))))))
-      (when (buffer-modified-p) (save-buffer))
+      (cond
+       ;; fix GH issue #19
+       ;; Temporarily remove `org-remark-save' from the `after-save-hook'
+       ;; When the marginal notes buffer is the current buffer
+       ((eq notes-buf (current-buffer))(progn
+                                         (remove-hook 'after-save-hook 
#'org-remark-save t)
+                                         (save-buffer)
+                                         (add-hook 'after-save-hook 
#'org-remark-save nil t))
+        (buffer-modified-p)(save-buffer)))
       t)))
 
 



reply via email to

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