I was looking for some help, please further modifying the following excerpt from the library highlight-parentheses: https://github.com/nschum/highlight-parentheses.el [Fn 1.]
GOAL . purpose- use something like mapcaror dolistto automatically replace INSERT-FACE-HEREanother person from a variable my-parens-facesevery time whilemakes a loop. The visual effect will be a rainbow colored parentheses based on the level of nesting.
I delete overlays with a post-command-hookfunction similar to that remove-overlays, and then add new overlays using the function parensbelow. I will not move any overlays - just creating and deleting. The final version will use variables for faces and target specific overlays for deletion, but here is an example of how it would look:(add-hook 'post-command-hook (lambda () (remove-overlays) (parens)))
Every time I whileexecute a loop, I want to insert another face from the variable my-parens-faces- in order, for example dolist. For example:
while Run loop # 1: (:foreground "black" :background "cyan")
while execution of cycle # 2: (:foreground "blue" :background "purple")
while The implementation of cycle number 3: (:foreground "green" :background "blue")
while Run cycle # 4: (:foreground "yellow" :background "purple")
while Run cycle # 5: (:foreground "orange" :background "yellow")
while Run cycle # 6: (:foreground "red" :background "green")
while Run cycle # 7: (:foreground "pink" :background "brown")
while Run cycle # 8: (:foreground "blue" :background "beige")
(defun parens ()
(let* (pos1 pos2)
(save-excursion
(condition-case err
(while (setq pos1 (cadr (syntax-ppss pos1)))
(overlay-put (make-overlay pos1 (1+ pos1)) 'face 'INSERT-FACE-HERE)
(when (setq pos2 (scan-sexps pos1 1))
(overlay-put (make-overlay (1- pos2) pos2) 'face 'INSERT-FACE-HERE)))
(error nil)) )))
(defvar my-parens-faces '(
(:foreground "black" :background "cyan")
(:foreground "blue" :background "purple")
(:foreground "green" :background "blue")
(:foreground "yellow" :background "purple")
(:foreground "orange" :background "yellow")
(:foreground "red" :background "green")
(:foreground "pink" :background "brown")
(:foreground "blue" :background "beige")))
[ 1: - , , , (.. ), parens .]