From 355bab6730c5a20ee45f323507c217e37b157a4d Mon Sep 17 00:00:00 2001 From: mattkae Date: Tue, 22 Nov 2022 16:46:16 -0500 Subject: Work in progress on annotate lens --- lisp/vc-annotate-lens-mode.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lisp/vc-annotate-lens-mode.el (limited to 'lisp/vc-annotate-lens-mode.el') diff --git a/lisp/vc-annotate-lens-mode.el b/lisp/vc-annotate-lens-mode.el new file mode 100644 index 0000000..00f674e --- /dev/null +++ b/lisp/vc-annotate-lens-mode.el @@ -0,0 +1,24 @@ + +;;; Code: + +(make-variable-buffer-local + (defvar vc-annotate-lens-cursor-position 0 + "Holds the cursor position from the last run of post-command-hooks.")) + +(defun do-stuff-if-moved-post-command () + (interactive) + (unless (equal (line-number-at-pos) vc-annotate-lens-cursor-position) + (vc-region-history line-number-at-pos) + (message "%s" vc-annotate-lens-cursor-position)) + (setq vc-annotate-lens-cursor-position (line-number-at-pos))) + +(define-minor-mode vc-annotate-lens-mode + "Show 'vc-annotate' information when you move to a line." + :lighter " vc-annotate-lens" + ) + +(add-hook 'vc-annotate-lens-mode-on-hook (lambda () (add-hook 'post-command-hook #'do-stuff-if-moved-post-command))) +(add-hook 'vc-annotate-lens-mode-off-hook (lambda () (remove-hook 'post-command-hook #'do-stuff-if-moved-post-command))) + +(provide 'vc-annotate-lens-mode) +;;; vc-annotate-lens-mode.el ends here. -- cgit v1.2.1