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

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

[elpa] externals/org-remark f85e68c0ac: fix:highlight-save: cond caluses


From: ELPA Syncer
Subject: [elpa] externals/org-remark f85e68c0ac: fix:highlight-save: cond caluses for when notes buf is not main buf
Date: Sat, 5 Feb 2022 08:57:41 -0500 (EST)

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

    fix:highlight-save: cond caluses for when notes buf is not main buf
---
 org-remark.el | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/org-remark.el b/org-remark.el
index 5413a15962..577991a97f 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -750,9 +750,10 @@ source with using ORGID."
   (let* ((filename (org-remark-source-get-file-name filename))
          (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))
          (notes-buf (find-file-noselect (org-remark-notes-get-file-name)))
-         (line-num (org-current-line beg)))
+         (main-buf (current-buffer))
+         (line-num (org-current-line beg))
+         (orgid (org-remark-highlight-get-org-id beg)))
     (with-current-buffer notes-buf
       (when (featurep 'org-remark-convert-legacy) 
(org-remark-convert-legacy-data))
       ;;`org-with-wide-buffer is a macro that should work for non-Org file'
@@ -799,12 +800,15 @@ source with using ORGID."
       (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)))
+       ;; When the marginal notes buffer is the main buffer
+       ((eq notes-buf main-buf)
+        (remove-hook 'after-save-hook #'org-remark-save t)
+        (save-buffer)
+        (add-hook 'after-save-hook #'org-remark-save nil t))
+       ;; When marginal notes buffer is separate from the main buffer, save the
+       ;; notes buffer
+       ((buffer-modified-p)
+        (save-buffer)))
       t)))
 
 



reply via email to

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