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

    fix: selecting wrong highlight when opening
---
 org-remark-line-highlighter.el | 5 ++++-
 org-remark.el                  | 8 ++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/org-remark-line-highlighter.el b/org-remark-line-highlighter.el
index 9072c94857..c81c4e1982 100644
--- a/org-remark-line-highlighter.el
+++ b/org-remark-line-highlighter.el
@@ -64,7 +64,10 @@ by `overlays-in'."
          (highlights (overlays-in bol bol)))
     (seq-find #'org-remark-line-highlight-p highlights)))
 
-(add-hook 'org-remark-find-dwim-functions #'org-remark-line-find)
+;; Depth is deeper than the default one for range highlight. This is to
+;; prioritize it over line-highlight when the fomer is at point and yet
+;; on the same line of another line-highlight.
+(add-hook 'org-remark-find-dwim-functions #'org-remark-line-find 80)
 
 (add-hook 'window-size-change-functions
           #'(lambda (&rest args)
diff --git a/org-remark.el b/org-remark.el
index e3dc0051e5..46991f41ed 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -497,10 +497,10 @@ current buffer.
 This function ensures that there is only one cloned buffer for
 notes file by tracking it."
   (interactive "d\nP")
-  (when-let ((id (overlay-get (org-remark-find-dwim point)
-                              'org-remark-id))
-             (ibuf (org-remark-notes-buffer-get-or-create))
-             (cbuf (current-buffer)))
+  (when-let* ((ov (org-remark-find-dwim point))
+              (id (overlay-get ov 'org-remark-id))
+              (ibuf (org-remark-notes-buffer-get-or-create))
+              (cbuf (current-buffer)))
     (pop-to-buffer ibuf org-remark-notes-display-buffer-action)
     (widen)
     (when-let (p (org-find-property org-remark-prop-id id))

Reply via email to