Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jdtsmith/098adb413fb88554d53cf1f4d17d5d88 to your computer and use it in GitHub Desktop.
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
(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