2019-03-11 12:39:38 -04:00
|
|
|
;;; ui/indent-guides/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
2024-07-28 18:57:12 -04:00
|
|
|
(defcustom +indent-guides-inhibit-functions nil
|
|
|
|
"A list of predicate functions.
|
|
|
|
|
|
|
|
Each function will be run in the context of a buffer where
|
|
|
|
`highlight-indent-guides-mode' should be enabled. If any function returns
|
|
|
|
non-nil, the mode will not be activated."
|
|
|
|
:type 'hook
|
|
|
|
:group '+indent-guides)
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Packages
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! highlight-indent-guides
|
2024-07-28 18:57:12 -04:00
|
|
|
:hook ((prog-mode text-mode conf-mode) . +indent-guides-init-maybe-h)
|
2023-12-05 17:41:59 -05:00
|
|
|
:init
|
2024-09-06 16:15:57 -04:00
|
|
|
(setq highlight-indent-guides-method 'character
|
2023-12-05 17:41:59 -05:00
|
|
|
highlight-indent-guides-bitmap-function #'highlight-indent-guides--bitmap-line)
|
2024-07-28 18:57:12 -04:00
|
|
|
|
|
|
|
(defun +indent-guides-init-maybe-h ()
|
|
|
|
"Enable `highlight-indent-guides-mode'.
|
|
|
|
Consults `+indent-guides-inhibit-functions'."
|
|
|
|
(unless (run-hook-with-args-until-success '+indent-guides-inhibit-functions)
|
|
|
|
(highlight-indent-guides-mode +1)))
|
|
|
|
|
|
|
|
(add-hook! '+indent-guides-inhibit-functions
|
|
|
|
;; Org's virtual indentation messes up indent-guides.
|
|
|
|
(defun +indent-guides-in-org-indent-mode-p ()
|
|
|
|
(bound-and-true-p org-indent-mode))
|
|
|
|
;; Fix #6438: indent-guides prevent inline images from displaying in ein
|
|
|
|
;; notebooks.
|
|
|
|
(defun +indent-guides-in-ein-notebook-p ()
|
|
|
|
(and (bound-and-true-p ein:notebook-mode)
|
|
|
|
(bound-and-true-p ein:output-area-inlined-images))))
|
2019-03-11 16:46:55 -04:00
|
|
|
:config
|
2022-10-27 19:55:07 +02:00
|
|
|
;; HACK: If this package is loaded too early (by the user, and in terminal
|
|
|
|
;; Emacs), then `highlight-indent-guides-auto-set-faces' will have been
|
|
|
|
;; called much too early to set its faces correctly. To get around this, we
|
|
|
|
;; need to call it again, but at a time when I can ensure a frame exists an
|
|
|
|
;; the current theme is loaded.
|
|
|
|
(when (doom-context-p 'init)
|
2024-07-28 18:57:12 -04:00
|
|
|
(add-hook 'doom-first-buffer-hook #'highlight-indent-guides-auto-set-faces)))
|