Highlight the current line while still being able to easily customize/describe underlying faces

| emacs

I use global-hl-line-mode to highlight the current line.

(global-hl-line-mode 1)

However, I don't want hl-line to interfere with the default face suggested by customize-face, which is returned by face-at-point.

(defun my-suggest-other-faces (func &rest args)
  (if global-hl-line-mode
      (progn
        (global-hl-line-mode -1)
        (prog1 (apply func args)
          (global-hl-line-mode 1)))
    (apply func args)))
(advice-add #'face-at-point :around #'my-suggest-other-faces)

Now I can use customize-face and describe-face without hl-line interfering all the time.

This is part of my Emacs configuration.
You can comment with Disqus or you can e-mail me at sacha@sachachua.com.