[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate da5f3dcfe8 2/6: - prevented using the same color
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate da5f3dcfe8 2/6: - prevented using the same color on adjacent annotations; |
Date: |
Sat, 30 Sep 2023 12:59:45 -0400 (EDT) |
branch: elpa/annotate
commit da5f3dcfe8d2b0fb5aa1b0ea8dcd5098de2191d6
Author: cage <cage>
Commit: cage <cage@invalid>
- prevented using the same color on adjacent annotations;
To reproduce the issue (assuming the variable
'annotate-highlight-faces' is bound to a list of two elements):
1. annotate the first line of a buffer (C-a)
2. annotate the second line of the same buffer (C-a)
3. delete the annotation on the second line (C-d)
4. annotate again the second line (C-a)
the annotations in both lines got the same colors.
---
annotate.el | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/annotate.el b/annotate.el
index 22ac54286b..e28bc2b932 100644
--- a/annotate.el
+++ b/annotate.el
@@ -433,6 +433,22 @@ annotated text?
See: `ANNOTATE-ANNOTATION-POSITION-POLICY'."
(overlay-get annotation 'force-newline-policy))
+(defun annotate-annotation-set-face (annotation face)
+ "Set property face to `FACE' for `ANNOTATION'."
+ (overlay-put annotation 'face face))
+
+(defun annotate-annotation-face (annotation)
+ "Get property face from `ANNOTATION'."
+ (overlay-get annotation 'face))
+
+(defun annotate-annotation-set-annotation-face (annotation face)
+ "Set property annotation-face to `FACE' for `ANNOTATION'."
+ (overlay-put annotation 'annotation-face face))
+
+(defun annotate-annotation-property-annotation-face (annotation)
+ "Get property annotation-face from `ANNOTATION'."
+ (overlay-get annotation 'annotation-face))
+
(defun annotate-chain-last-ring (chain)
"Get the last ring of `CHAIN'."
(car (last chain)))
@@ -2095,7 +2111,24 @@ interval and, if found, the buffer is annotated right
there.
The searched interval can be customized setting the variable:
'annotate-search-region-lines-delta'."
- (cl-labels ((create-annotation (start end annotation-text)
+ (cl-labels ((face-index-annotation-shifting-point (position
shifting-direction-function)
+ (when-let* ((annotation (funcall
shifting-direction-function
+ position))
+ (annotation-face (annotate-annotation-face
annotation)))
+ (cl-position-if (lambda (a) (cl-equalp annotation-face a))
+ annotate-highlight-faces)))
+ (face-index-annotation-before-point (position)
+ (face-index-annotation-shifting-point position
+
#'annotate-previous-annotation-ends))
+ (face-index-annotation-after-point (position)
+ (face-index-annotation-shifting-point position
+
#'annotate-next-annotation-starts))
+ (create-annotation (start end annotation-text)
+ (when (null color-index)
+ (when-let ((used-face-index (or
(face-index-annotation-before-point (point))
+
(face-index-annotation-after-point (point)))))
+ (setf annotate-colors-index-counter
+ used-face-index)))
(cl-incf annotate-colors-index-counter)
(save-excursion
(let ((all-overlays ()))
- [nongnu] elpa/annotate updated (dbdd2a4663 -> eae9e73f2e), ELPA Syncer, 2023/09/30
- [nongnu] elpa/annotate eae9e73f2e 6/6: Merge pull request #158 from cage2/master, ELPA Syncer, 2023/09/30
- [nongnu] elpa/annotate 335bdea752 3/6: - fixed indentation of local functions definitions., ELPA Syncer, 2023/09/30
- [nongnu] elpa/annotate da5f3dcfe8 2/6: - prevented using the same color on adjacent annotations;,
ELPA Syncer <=
- [nongnu] elpa/annotate b2767cdba2 4/6: - increased version number;, ELPA Syncer, 2023/09/30
- [nongnu] elpa/annotate b88f773a84 1/6: - fixed docstring., ELPA Syncer, 2023/09/30
- [nongnu] elpa/annotate d1debccc5c 5/6: - fixed points to start searching for adjacent annotations., ELPA Syncer, 2023/09/30