Quantcast
Channel: Sacha Chua - category - emacs
Viewing all articles
Browse latest Browse all 844

Making highlight-sexp follow modus-themes-toggle

$
0
0

I'm experimenting with using the highlight-sexp minor mode to highlight my current s-expression, since I sometimes get confused about what I'm modifying with smartparens. The highlight-sexp background colour is hardcoded by default. I want it to adapt when I use modus-themes-toggle. Here's how that works:

(use-package highlight-sexp
  :quelpa
  (highlight-sexp :repo "daimrod/highlight-sexp" :fetcher github :version original)
  :hook
  (emacs-lisp-mode . highlight-sexp-mode)
  :config
  (defun my-hl-sexp-create-overlay ()
    (when (overlayp hl-sexp-overlay)
      (overlay-put
       hl-sexp-overlay
       'face
       `(:background
         ,(car
           (assoc-default
            'bg-inactive
            (modus-themes--current-theme-palette)))))))
  (advice-add 'hl-sexp-create-overlay :after 'my-hl-sexp-create-overlay)
  (advice-add 'modus-themes-toggle :after 'my-hl-sexp-create-overlay))

This is what it looks like:

highlight-sexp.gif
Figure 1: Animation of highlight-sexp toggling along with modus-themes-toggle
This is part of my Emacs configuration.

Viewing all articles
Browse latest Browse all 844

Trending Articles