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

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

[elpa] externals/org-remark 7176e9d460 073/173: add: ID inherits. fix: h


From: ELPA Syncer
Subject: [elpa] externals/org-remark 7176e9d460 073/173: add: ID inherits. fix: housekeep
Date: Fri, 28 Jan 2022 16:58:02 -0500 (EST)

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

    add: ID inherits. fix: housekeep
---
 README.org        | 12 ++++++++++++
 org-marginalia.el | 17 ++++++++---------
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/README.org b/README.org
index 79fc7509a3..f3fb6a91c7 100644
--- a/README.org
+++ b/README.org
@@ -43,6 +43,7 @@ Refer to the screenshots below for a teaser of  what it can 
do.
   - [[#deleted-notes-on-jit-lock-register][Deleted Notes on jit-lock-register]]
   - [[#org-marginalia-load][org-marginalia-load]]
   - [[#set-buffer-modified-p][set-buffer-modified-p]]
+  - [[#overlay-put][overlay-put]]
 - [[#local-variables][Local Variables]]
 :END:
 
@@ -309,6 +310,17 @@ Adding overlay does not set the buffer modified.
 It's more fluid with save operation.
 You cannot use `undo' to undo highlighter.
 
+** overlay-put
+:PROPERTIES:
+:marginalia-id: 44c310d9
+:marginalia-source-beg: 11551
+:marginalia-source-end: 11562
+:END:
+[[file:~/local-repos/org-marginalia/org-marginalia.el][org-marginalia]]
+
+Do not add the =evaporate t= property for the highlight's overlay. By 
remaining in the buffer, =undo= puts overlays in their original location when 
text regions get killed and subsequently the kill gets undone.
+
+Using overlays instead of text-properties has an advantage of easy composition 
of faces; e.g. when marking on a comment line in =emacs-lisp-mode=, the 
highlighters face won't be composed onto the underlying syntax face for 
comments. Overlay can make it easy to add an additional face to comments and 
other syntactically font-locked regions.
 * Local Variables
 
 # Local Variables:
diff --git a/org-marginalia.el b/org-marginalia.el
index 6aaa9fe6ea..8e03cf606c 100644
--- a/org-marginalia.el
+++ b/org-marginalia.el
@@ -380,10 +380,10 @@ in the current buffer. Each highlight is represented by 
this data structure:
                     (file-name-nondirectory (buffer-file-name))))))
     (org-marginalia-housekeep)
     (org-marginalia-sort-highlights-list)
-    (dolist (highlight org-marginalia-highlights)
+    (dolist (h org-marginalia-highlights)
       (let ((orgid (and org-marginalia-use-org-id
-                    (org-id-get (overlay-start highlight)))))
-       (org-marginalia-save-single-highlight highlight title source-path 
orgid)))
+                       (org-entry-get (overlay-start h) "ID" 'INHERIT))))
+       (org-marginalia-save-single-highlight h title source-path orgid)))
     ;; Tracking
     (when org-marginalia-files-tracked
       (add-to-list 'org-marginalia-files-tracked
@@ -672,7 +672,7 @@ notes of the entry."
 (defun org-marginalia-housekeep ()
   "Housekeep the internal variable `org-marginalia-highlights'.
 
-Case 1. Both start and end of an overlay are 1
+Case 1. Both start and end of an overlay are identical
 
         This should not happen when you manually mark a text
         region. A typical cause of this case is when you delete a
@@ -685,12 +685,11 @@ Case 2. The overlay points to no buffer
   
   (interactive)
   (dolist (ov org-marginalia-highlights)
-    ;; Both start and end of an overlay is 1 should not happen when you 
manually
-    ;; mark a text region. A typical cause of this case is when you delete a
-    ;; region that contains a highlight overlay.
+    ;; Both start and end of an overlay are indentical; this should not happen
+    ;; when you manually mark a text region. A typical cause of this case is
+    ;; when you delete a region that contains a highlight overlay.
     (when (and (overlay-buffer ov)
-              (= 1 (overlay-start ov))
-              (= 1 (overlay-end ov)))
+              (= (overlay-start ov) (overlay-end ov)))
       (org-marginalia-remove-marginalia (overlay-get ov 'org-marginalia-id))
       (delete-overlay ov))
     (unless (overlay-buffer ov)



reply via email to

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