tweak(indent-guides): subtle bars & bitmaps (almost) by default
Ine0a926d
, I defaulted to not using bitmaps for indent-guides, but after some more research, I realize this slowness is more prominent on MacOS, older PGTK builds, and (possibly) Windows, so I've opted to re-enable bitmaps by default, unless you're on one of those systems (except Windows; still testing that). This change also makes the guide bars more subtle, since the default is too distracting and colorful. Ref: #8052 Ref:e0a926dc1e
This commit is contained in:
parent
0dc1084e8a
commit
0461c5de5f
1 changed files with 21 additions and 20 deletions
|
@ -20,11 +20,26 @@ be enabled. If any function returns non-nil, the mode will not be activated."
|
|||
(unless (run-hook-with-args-until-success '+indent-guides-inhibit-functions)
|
||||
(indent-bars-mode +1)))
|
||||
:config
|
||||
;; Bitmap performance is inconsistent across display systems (pgtk, ns, mac,
|
||||
;; gtk, etc). There's also a bitmap init bug in PGTK builds of Emacs before
|
||||
;; v30 that could cause crashes (see jdtsmith/indent-bars#3). If you use PGTK
|
||||
;; and reverse this setting, you've been warned!
|
||||
(setq indent-bars-prefer-character t)
|
||||
(setq indent-bars-prefer-character
|
||||
(or
|
||||
;; Bitmaps are far slower on MacOS, inexplicably, but this needs more
|
||||
;; testing to see if it's specific to ns or emacs-mac builds, or is
|
||||
;; just a general MacOS issue.
|
||||
(featurep :system 'macos)
|
||||
;; FIX: A bitmap init bug in PGTK builds of Emacs before v30 that could
|
||||
;; cause crashes (see jdtsmith/indent-bars#3).
|
||||
(and (featurep 'pgtk)
|
||||
(< emacs-major-version 30)))
|
||||
|
||||
;; Show indent guides starting from the first column.
|
||||
indent-bars-starting-column 0
|
||||
;; Make indent guides subtle; the default is too distractingly colorful.
|
||||
indent-bars-width-frac 0.15 ; make bitmaps thinner
|
||||
indent-bars-color-by-depth nil
|
||||
indent-bars-color '(font-lock-comment-face :face-bg nil :blend 0.425)
|
||||
;; Don't highlight current level indentation; it's distracting and is
|
||||
;; unnecessary overhead for little benefit.
|
||||
indent-bars-highlight-current-depth nil)
|
||||
|
||||
;; TODO: Uncomment once we support treesit
|
||||
;; (setq indent-bars-treesit-support (modulep! :tools tree-sitter))
|
||||
|
@ -45,18 +60,4 @@ be enabled. If any function returns non-nil, the mode will not be activated."
|
|||
;; completion or eldoc popups).
|
||||
;; REVIEW: Swap with `frame-parent' when 27 support is dropped
|
||||
(defun +indent-guides-in-childframe-p ()
|
||||
(frame-parameter nil 'parent-frame)))
|
||||
|
||||
;; HACK: Out of the box, indent-bars offers no way to fully disable
|
||||
;; "highlighting the current line", so I advise on in, since the feature is
|
||||
;; unnecessary work (and allocation of timers) for users that don't want it,
|
||||
;; and for our performance-leaning defaults.
|
||||
(setq indent-bars-depth-update-delay nil)
|
||||
(defadvice! +indent-guides--disable-highlight-current-line-a (fn &rest args)
|
||||
:around #'indent-bars-setup
|
||||
(letf! (defun indent-bars--highlight-current-depth ()
|
||||
(when indent-bars-depth-update-delay
|
||||
(funcall indent-bars--highlight-current-depth)))
|
||||
(prog1 (apply fn args)
|
||||
(unless indent-bars-depth-update-delay
|
||||
(remove-hook 'post-command-hook #'indent-bars--highlight-current-depth t))))))
|
||||
(frame-parameter nil 'parent-frame))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue