nit(indent-guides): reformat config.el & proofread comments
This commit is contained in:
parent
08abc7d698
commit
dd5ae257f1
1 changed files with 25 additions and 29 deletions
|
@ -27,8 +27,8 @@ be enabled. If any function returns non-nil, the mode will not be activated."
|
||||||
;; testing to see if it's specific to ns or emacs-mac builds, or is
|
;; testing to see if it's specific to ns or emacs-mac builds, or is
|
||||||
;; just a general MacOS issue.
|
;; just a general MacOS issue.
|
||||||
(featurep :system 'macos)
|
(featurep :system 'macos)
|
||||||
;; FIX: A bitmap init bug in PGTK builds of Emacs before v30 that could
|
;; FIX: A bitmap init bug in emacs-pgtk (before v30) could cause
|
||||||
;; cause crashes (see jdtsmith/indent-bars#3).
|
;; crashes (see jdtsmith/indent-bars#3).
|
||||||
(and (featurep 'pgtk)
|
(and (featurep 'pgtk)
|
||||||
(< emacs-major-version 30)))
|
(< emacs-major-version 30)))
|
||||||
|
|
||||||
|
@ -45,23 +45,6 @@ be enabled. If any function returns non-nil, the mode will not be activated."
|
||||||
;; TODO: Uncomment once we support treesit
|
;; TODO: Uncomment once we support treesit
|
||||||
;; (setq indent-bars-treesit-support (modulep! :tools tree-sitter))
|
;; (setq indent-bars-treesit-support (modulep! :tools tree-sitter))
|
||||||
|
|
||||||
;; HACK: Both indent-bars and tree-sitter-hl-mode use the jit-font-lock
|
|
||||||
;; mechanism, and so they don't play well together. For those particular
|
|
||||||
;; cases, we'll use `highlight-indent-guides', at least until the
|
|
||||||
;; tree-sitter module adopts treesit.
|
|
||||||
(defvar-local +indent-guides-p nil)
|
|
||||||
(add-hook! 'tree-sitter-mode-hook :append
|
|
||||||
(defun +indent-guides--toggle-on-tree-sitter-h ()
|
|
||||||
(if tree-sitter-mode
|
|
||||||
(when (bound-and-true-p indent-bars-mode)
|
|
||||||
(with-memoization (get 'indent-bars-mode 'disabled-in-tree-sitter)
|
|
||||||
(doom-log "Disabled `indent-bars-mode' because it's not supported in `tree-sitter-mode'")
|
|
||||||
t)
|
|
||||||
(indent-bars-mode -1)
|
|
||||||
(setq +indent-guides-p t))
|
|
||||||
(when +indent-guides-p
|
|
||||||
(indent-bars-mode +1)))))
|
|
||||||
|
|
||||||
(unless (boundp 'enable-theme-functions)
|
(unless (boundp 'enable-theme-functions)
|
||||||
(add-hook 'doom-load-theme-hook #'indent-bars-reset-styles))
|
(add-hook 'doom-load-theme-hook #'indent-bars-reset-styles))
|
||||||
|
|
||||||
|
@ -74,24 +57,20 @@ be enabled. If any function returns non-nil, the mode will not be activated."
|
||||||
(defun +indent-guides-in-ein-notebook-p ()
|
(defun +indent-guides-in-ein-notebook-p ()
|
||||||
(and (bound-and-true-p ein:notebook-mode)
|
(and (bound-and-true-p ein:notebook-mode)
|
||||||
(bound-and-true-p ein:output-area-inlined-images)))
|
(bound-and-true-p ein:output-area-inlined-images)))
|
||||||
;; Don't display indent guides in childframe popups (not helpful in
|
;; Don't display indent guides in childframe popups (which are almost always
|
||||||
;; completion or eldoc popups).
|
;; used for completion or eldoc popups).
|
||||||
;; REVIEW: Swap with `frame-parent' when 27 support is dropped
|
;; REVIEW: Swap with `frame-parent' when 27 support is dropped
|
||||||
(defun +indent-guides-in-childframe-p ()
|
(defun +indent-guides-in-childframe-p ()
|
||||||
(frame-parameter nil 'parent-frame)))
|
(frame-parameter nil 'parent-frame)))
|
||||||
|
|
||||||
;; HACK: `indent-bars-mode' interactions with some packages poorly. This
|
;; HACK: `indent-bars-mode' interactions with some packages poorly, often
|
||||||
;; section is dedicated to package interop fixes.
|
;; flooding whole sections of the buffer with indent guides. This section is
|
||||||
|
;; dedicated to fixing interop with those packages.
|
||||||
(when (modulep! :tools magit)
|
(when (modulep! :tools magit)
|
||||||
(after! magit-blame
|
(after! magit-blame
|
||||||
(add-to-list 'magit-blame-disable-modes 'indent-bars-mode)))
|
(add-to-list 'magit-blame-disable-modes 'indent-bars-mode)))
|
||||||
|
|
||||||
(when (modulep! :tools lsp)
|
(when (modulep! :tools lsp)
|
||||||
;; HACK: lsp-ui-peek uses overlays, and indent-bars doesn't know how to deal
|
|
||||||
;; with all the whitespace it uses to format its popups, spamming it with
|
|
||||||
;; indent guides. Making the two work together is a project for another
|
|
||||||
;; day, so disable `indent-bars-mode' while its active instead. Doesn't
|
|
||||||
;; affect character bars though.
|
|
||||||
;; REVIEW: Report this upstream to `indent-bars'?
|
;; REVIEW: Report this upstream to `indent-bars'?
|
||||||
(defadvice! +indent-guides--remove-after-lsp-ui-peek-a (&rest _)
|
(defadvice! +indent-guides--remove-after-lsp-ui-peek-a (&rest _)
|
||||||
:after #'lsp-ui-peek--peek-new
|
:after #'lsp-ui-peek--peek-new
|
||||||
|
@ -107,4 +86,21 @@ be enabled. If any function returns non-nil, the mode will not be activated."
|
||||||
(defadvice! +indent-guides--restore-after-lsp-ui-peek-a (&rest _)
|
(defadvice! +indent-guides--restore-after-lsp-ui-peek-a (&rest _)
|
||||||
:after #'lsp-ui-peek--peek-hide
|
:after #'lsp-ui-peek--peek-hide
|
||||||
(unless indent-bars-prefer-character
|
(unless indent-bars-prefer-character
|
||||||
(indent-bars-setup)))))
|
(indent-bars-setup))))
|
||||||
|
|
||||||
|
;; HACK: Both indent-bars and tree-sitter-hl-mode use the jit-font-lock
|
||||||
|
;; mechanism, and so they don't play well together. For those particular
|
||||||
|
;; cases, we'll use `highlight-indent-guides', at least until the
|
||||||
|
;; tree-sitter module adopts treesit.
|
||||||
|
(defvar-local +indent-guides-p nil)
|
||||||
|
(add-hook! 'tree-sitter-mode-hook :append
|
||||||
|
(defun +indent-guides--toggle-on-tree-sitter-h ()
|
||||||
|
(if tree-sitter-mode
|
||||||
|
(when (bound-and-true-p indent-bars-mode)
|
||||||
|
(with-memoization (get 'indent-bars-mode 'disabled-in-tree-sitter)
|
||||||
|
(doom-log "Disabled `indent-bars-mode' because it's not supported in `tree-sitter-mode'")
|
||||||
|
t)
|
||||||
|
(indent-bars-mode -1)
|
||||||
|
(setq +indent-guides-p t))
|
||||||
|
(when +indent-guides-p
|
||||||
|
(indent-bars-mode +1))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue