Skip to content

Instantly share code, notes, and snippets.

@susam
Created June 18, 2023 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save susam/07e608fa026a96caba882d7f7cc077a2 to your computer and use it in GitHub Desktop.
Save susam/07e608fa026a96caba882d7f7cc077a2 to your computer and use it in GitHub Desktop.
(defvar previous-line-number nil)
(defun detect-line-number-change ()
(let ((current-line-number (line-number-at-pos)))
(when (and previous-line-number (/= current-line-number previous-line-number))
(message "%d => %d" previous-line-number current-line-number))
(setq previous-line-number current-line-number)))
(add-hook 'post-command-hook 'detect-line-number-change)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment