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

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

[elpa] externals/org-remark 9bb66a742e 074/173: fix: overlay front-advan


From: ELPA Syncer
Subject: [elpa] externals/org-remark 9bb66a742e 074/173: fix: overlay front-advance
Date: Fri, 28 Jan 2022 16:58:02 -0500 (EST)

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

    fix: overlay front-advance
---
 README.org        | 36 ++++++++++++++++++++++++++++++------
 org-marginalia.el |  6 +++---
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/README.org b/README.org
index f3fb6a91c7..051683202a 100644
--- a/README.org
+++ b/README.org
@@ -44,6 +44,7 @@ Refer to the screenshots below for a teaser of  what it can 
do.
   - [[#org-marginalia-load][org-marginalia-load]]
   - [[#set-buffer-modified-p][set-buffer-modified-p]]
   - [[#overlay-put][overlay-put]]
+  - [[#make-overlay-beg-end-nil-front-advance][(make-overlay beg end nil 
'FRONT-ADVANCE)]]
 - [[#local-variables][Local Variables]]
 :END:
 
@@ -292,8 +293,8 @@ jit-lock-register
 ** org-marginalia-load
 :PROPERTIES:
 :marginalia-id: 3ed4316a
-:marginalia-source-beg: 12353
-:marginalia-source-end: 12372
+:marginalia-source-beg: 12372
+:marginalia-source-end: 12391
 :END:
 [[file:~/local-repos/org-marginalia/org-marginalia.el][org-marginalia]]
 
@@ -301,8 +302,8 @@ jit-lock-register
 ** set-buffer-modified-p
 :PROPERTIES:
 :marginalia-id: 275b8a06
-:marginalia-source-beg: 12232
-:marginalia-source-end: 12253
+:marginalia-source-beg: 12251
+:marginalia-source-end: 12272
 :END:
 [[file:~/local-repos/org-marginalia/org-marginalia.el][org-marginalia]]
 
@@ -313,14 +314,37 @@ You cannot use `undo' to undo highlighter.
 ** overlay-put
 :PROPERTIES:
 :marginalia-id: 44c310d9
-:marginalia-source-beg: 11551
-:marginalia-source-end: 11562
+:marginalia-source-beg: 11570
+:marginalia-source-end: 11581
 :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.
+** (make-overlay beg end nil 'FRONT-ADVANCE)
+:PROPERTIES:
+:marginalia-id: 3ec6b5e6
+:marginalia-source-beg: 11520
+:marginalia-source-end: 11561
+:END:
+[[file:~/local-repos/org-marginalia/org-marginalia.el][org-marginalia]]
+
+It's more intuitive if editing the text both on the beg and end points of the 
highlight overlay does not extend it. Pass FRONT-ADVANCE; keep REAR-ADVANCE as 
default.
+
+#+ref: Manual (elisp)Manging Overlays
+#+begin_quote
+     The arguments FRONT-ADVANCE and REAR-ADVANCE specify the marker
+     insertion type for the start of the overlay and for the end of the
+     overlay, respectively.  *Note Marker Insertion Types::.  If they
+     are both ‘nil’, the default, then the overlay extends to include
+     any text inserted at the beginning, but not text inserted at the
+     end.  If FRONT-ADVANCE is non-‘nil’, text inserted at the beginning
+     of the overlay is excluded from the overlay.  If REAR-ADVANCE is
+     non-‘nil’, text inserted at the end of the overlay is included in
+     the overlay.
+#+end_quote
+
 * Local Variables
 
 # Local Variables:
diff --git a/org-marginalia.el b/org-marginalia.el
index 8e03cf606c..5351715115 100644
--- a/org-marginalia.el
+++ b/org-marginalia.el
@@ -4,8 +4,8 @@
 
 ;; Author: Noboru Ota <me@nobiot.com>
 ;; URL: https://github.com/nobiot/org-marginalia
-;; Version: 0.0.5
-;; Last Modified: 2021-01-05
+;; Version: 0.0.6
+;; Last Modified: 2021-08-17
 ;; Package-Requires: ((emacs "27.1") (org "9.4"))
 ;; Keywords: org-mode, annotation, writing, note-taking, margin-notes
 
@@ -287,7 +287,7 @@ and `org-marginalia-prev'."
   (when (not id) (setq id (substring (org-id-uuid) 0 8)))
   ;; Add highlight to the text
   (org-with-wide-buffer
-   (let ((ov (make-overlay beg end)))
+   (let ((ov (make-overlay beg end nil 'FRONT-ADVANCE)))
      (overlay-put ov 'face 'org-marginalia-highlighter)
      (overlay-put ov 'org-marginalia-id id)
      ;; Keep track in a local variable It's a list overlays, guranteed to



reply via email to

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