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

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

[nongnu] elpa/annotate f829a1ece3 1/9: - fixed procedure for coloring an


From: ELPA Syncer
Subject: [nongnu] elpa/annotate f829a1ece3 1/9: - fixed procedure for coloring annotations (adjacent annotations with the same colors was still possible).
Date: Thu, 2 Nov 2023 10:00:07 -0400 (EDT)

branch: elpa/annotate
commit f829a1ece3536548c579e8dbe95e65fcc1053c09
Author: cage <cage>
Commit: cage <cage@invalid>

    - fixed procedure for coloring annotations (adjacent annotations with the 
same colors was still possible).
---
 annotate.el | 44 +++++++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/annotate.el b/annotate.el
index 7c79b3e08c..7cbcb6c088 100644
--- a/annotate.el
+++ b/annotate.el
@@ -93,13 +93,15 @@ same directory that contains `filename'."
 name of the local database annotation"
   :type 'string)
 
-(defcustom annotate-highlight-faces '((:underline "coral")
-                                      (:underline "khaki"))
+(defcustom annotate-highlight-faces '((:underline "#EEF192")
+                                      (:underline "#92EEF1")
+                                      (:underline "#F192EE"))
   "List of faces for annotated text."
   :type 'list)
 
-(defcustom annotate-annotation-text-faces '((:background "coral" :foreground 
"black")
-                                            (:background "khaki" :foreground 
"black"))
+(defcustom annotate-annotation-text-faces '((:background "#EEF192"  
:foreground "black")
+                                            (:background "#92EEF1"  
:foreground "black")
+                                            (:background "#F192EE"  
:foreground "black"))
   "List of faces for annotation's text."
   :type 'list)
 
@@ -2111,25 +2113,29 @@ 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 ((face-index-annotation-shifting-point (position 
shifting-direction-function)
+  (cl-labels ((face-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))
+                  (cl-find-if (lambda (a) (cl-equalp annotation-face a))
+                              annotate-highlight-faces)))
+              (face-annotation-before-point (position)
+                (face-annotation-shifting-point position
+                                                
#'annotate-previous-annotation-ends))
+              (face-annotation-after-point (position)
+                (face-annotation-shifting-point position
+                                                
#'annotate-next-annotation-starts))
+              (available-face-index (&rest used-faces)
+                (cl-position-if-not (lambda (a)
+                                      (cl-member a used-faces :test 
#'cl-equalp))
+                                    annotate-highlight-faces))
               (create-annotation (start end annotation-text)
-                (when (null color-index)
-                  (when-let ((used-face-index (or 
(face-index-annotation-before-point start)
-                                                  
(face-index-annotation-after-point end))))
-                    (setf annotate-colors-index-counter
-                          used-face-index)))
-                (cl-incf annotate-colors-index-counter)
+                (if (null color-index)
+                    (when-let ((new-face-index (available-face-index 
(face-annotation-before-point start)
+                                                                     
(face-annotation-after-point end))))
+                      (setf annotate-colors-index-counter
+                            new-face-index))
+                  (cl-incf annotate-colors-index-counter))
                 (save-excursion
                   (let ((all-overlays ()))
                     (while (< start end)



reply via email to

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