Created
May 2, 2023 15:49
-
-
Save jdtsmith/098adb413fb88554d53cf1f4d17d5d88 to your computer and use it in GitHub Desktop.
Custom code with a timer delay for current-column marking in highlight indentation mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (use-package highlight-indentation | |
| :ensure highlight-indentation | |
| :init | |
| ;; Add a timer delay to the current column highlight for efficiency, | |
| ;; and to avoid flashing when scrolling or moving by line | |
| (defvar my/highlight-indentation-current-column-timer nil) | |
| (defun my/highlight-indentation-current-column () | |
| (highlight-indentation-redraw-window (selected-window) | |
| 'highlight-indentation-current-column-overlay | |
| 'highlight-indentation-current-column-put-overlays-region)) | |
| (defun my/highlight-indentation-current-column-with-timer () | |
| (when my/highlight-indentation-current-column-timer | |
| (cancel-timer my/highlight-indentation-current-column-timer) | |
| (setq-local my/highlight-indentation-current-column-timer nil)) | |
| (setq-local my/highlight-indentation-current-column-timer | |
| (run-at-time 0.15 nil | |
| #'my/highlight-indentation-current-column))) | |
| :config | |
| (setf (cadar highlight-indentation-current-column-hooks) | |
| #'my/highlight-indentation-current-column-with-timer) | |
| :custom-face | |
| (highlight-indentation-current-column-face | |
| ((t (:background ,(alect-get-color 'dark 'magenta-bg+1))))) | |
| (highlight-indentation-face ((t (:inherit hl-line)))) | |
| :hook | |
| ((python-mode markdown-mode yaml-mode) . highlight-indentation-mode) | |
| ((python-mode markdown-mode yaml-mode) . highlight-indentation-current-column-mode)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment