branch: externals/org-remark
commit 2e6fca7a294ab7a2220b61d2259616eba7046868
Author: Noboru Ota <m...@nobiot.com>
Commit: Noboru Ota <m...@nobiot.com>

    fix(highlights-delay-load): rm window-state-change-functions #82
    
    Refer to issues #82 #74.
    
    If buffer in question is opened directly instead of using find-file --
    during new client frame creation - this leaks to ALL open buffers if
    org-remark-mode is activated by using local evaluation, for example:
    
        # Local Variables:
        # eval: (org-remark-mode)
        # End:
    
    The solution is to replace the use of `window-state-change-functions'
    hook with the local post-command-hook.
---
 org-remark.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/org-remark.el b/org-remark.el
index 4cfb7cbee6..311ce8f52d 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -6,7 +6,7 @@
 ;; URL: https://github.com/nobiot/org-remark
 ;; Version: 1.2.2
 ;; Created: 22 December 2020
-;; Last modified: 25 March 2024
+;; Last modified: 29 June 2024
 ;; Package-Requires: ((emacs "27.1") (org "9.4"))
 ;; Keywords: org-mode, annotation, note-taking, marginal-notes, wp,
 
@@ -1638,10 +1638,10 @@ highlight is a property list in the following 
properties:
                          highlights)))))
            highlights))))))
 
-(defun org-remark-highlights-delay-load (window)
-  "Delay load until WINDOW for current buffer is created."
-  (when (windowp window)
-    (remove-hook 'window-state-change-functions
+(defun org-remark-highlights-delay-load ()
+  "Delay load until window for current buffer is created."
+  (when (get-buffer-window)
+    (remove-hook 'post-command-hook
                  #'org-remark-highlights-delay-load 'local)
     (org-remark-highlights-load)))
 
@@ -1654,7 +1654,7 @@ output a message in the echo.
 Non-nil value for UPDATE is passed for the notes-source sync
 process."
   (if (not (get-buffer-window))
-      (add-hook 'window-state-change-functions
+      (add-hook 'post-command-hook
                 #'org-remark-highlights-delay-load 95 'local)
     ;; Some major modes such as nov.el reuse the current buffer, deleting
     ;; the buffer content and insert a different file's content. In this

Reply via email to