dev: merge branch 'master' of github.com:doomemacs

This commit is contained in:
Matt Nish-Lapidus 2024-09-09 09:58:08 -04:00
commit cd6d8c02b1
2 changed files with 48 additions and 24 deletions

View file

@ -52,12 +52,6 @@
;; quickly self-correct. ;; quickly self-correct.
(setq fast-but-imprecise-scrolling t) (setq fast-but-imprecise-scrolling t)
;; Don't ping things that look like domain names.
(setq ffap-machine-p-known 'reject)
;; Emacs "updates" its ui more often than it needs to, so slow it down slightly
(setq idle-update-delay 1.0) ; default is 0.5
;; Font compacting can be terribly expensive, especially for rendering icon ;; Font compacting can be terribly expensive, especially for rendering icon
;; fonts on Windows. Whether disabling it has a notable affect on Linux and Mac ;; fonts on Windows. Whether disabling it has a notable affect on Linux and Mac
;; hasn't been determined, but do it anyway, just in case. This increases memory ;; hasn't been determined, but do it anyway, just in case. This increases memory

View file

@ -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) (unless (run-hook-with-args-until-success '+indent-guides-inhibit-functions)
(indent-bars-mode +1))) (indent-bars-mode +1)))
:config :config
;; Bitmap performance is inconsistent across display systems (pgtk, ns, mac, (setq indent-bars-prefer-character
;; gtk, etc). There's also a bitmap init bug in PGTK builds of Emacs before (or
;; v30 that could cause crashes (see jdtsmith/indent-bars#3). If you use PGTK ;; Bitmaps are far slower on MacOS, inexplicably, but this needs more
;; and reverse this setting, you've been warned! ;; testing to see if it's specific to ns or emacs-mac builds, or is
(setq indent-bars-prefer-character t) ;; 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 ;; TODO: Uncomment once we support treesit
;; (setq indent-bars-treesit-support (modulep! :tools tree-sitter)) ;; (setq indent-bars-treesit-support (modulep! :tools tree-sitter))
@ -47,16 +62,31 @@ be enabled. If any function returns non-nil, the mode will not be activated."
(defun +indent-guides-in-childframe-p () (defun +indent-guides-in-childframe-p ()
(frame-parameter nil 'parent-frame))) (frame-parameter nil 'parent-frame)))
;; HACK: Out of the box, indent-bars offers no way to fully disable ;; HACK: `indent-bars-mode' interactions with some packages poorly. This
;; "highlighting the current line", so I advise on in, since the feature is ;; section is dedicated to package interop fixes.
;; unnecessary work (and allocation of timers) for users that don't want it, (when (modulep! :tools magit)
;; and for our performance-leaning defaults. (after! magit-blame
(setq indent-bars-depth-update-delay nil) (add-to-list 'magit-blame-disable-modes 'indent-bars-mode)))
(defadvice! +indent-guides--disable-highlight-current-line-a (fn &rest args)
:around #'indent-bars-setup (when (modulep! :tools lsp)
(letf! (defun indent-bars--highlight-current-depth () ;; HACK: lsp-ui-peek uses overlays, and indent-bars doesn't know how to deal
(when indent-bars-depth-update-delay ;; with all the whitespace it uses to format its popups, spamming it with
(funcall indent-bars--highlight-current-depth))) ;; indent guides. Making the two work together is a project for another
(prog1 (apply fn args) ;; day, so disable `indent-bars-mode' while its active instead. Doesn't
(unless indent-bars-depth-update-delay ;; affect character bars though.
(remove-hook 'post-command-hook #'indent-bars--highlight-current-depth t)))))) ;; REVIEW: Report this upstream to `indent-bars'?
(defadvice! +indent-guides--remove-after-lsp-ui-peek-a (&rest _)
:after #'lsp-ui-peek--peek-new
(when (and indent-bars-mode
(not indent-bars-prefer-character)
(overlayp lsp-ui-peek--overlay))
(save-excursion
(let ((indent-bars--display-function #'ignore)
(indent-bars--display-blank-lines-function #'ignore))
(indent-bars--fontify (overlay-start lsp-ui-peek--overlay)
(1+ (overlay-end lsp-ui-peek--overlay))
nil)))))
(defadvice! +indent-guides--restore-after-lsp-ui-peek-a (&rest _)
:after #'lsp-ui-peek--peek-hide
(unless indent-bars-prefer-character
(indent-bars-setup)))))