In order to modify the faces when Emacs starts, we must load the file defining them. Alternatively, we could delay all of this code until after an Agda file has been opened, but I am almost always working on Agda anyway, so there's not much point.

( require ' agda2-highlight )

First, we change all uses of background colouring to coloured boxes instead, by looping over the list of themes. This way, if Agda defines more faces in the future, they will be automatically tended to. Note that for many of these faces, the :background attribute is set to 'unspecified , and so they are unaffected.

;; Change backgrounds to boxes. ( cl-loop for ( _ . face ) in agda2-highlight-faces do ( if ( string-prefix-p "agda2-" ( symbol-name face ) ) ;; Some non-Agda faces are in the list; don't change them ( unless ( equal face 'agda2-highlight-incomplete-pattern-face ) ;; Workaround; this face is not defined in recent versions? ( set-face-attribute face nil :box ( face-attribute face :background ) :background 'unspecified ) ) ) )

But these boxes can also be intrusive in some cases; specifically, for warnings about pattern matching, which tend to highlight large portions of code, and which may overlap with other highlighting. So I modify those faces further as follows.