Skip to content

Instantly share code, notes, and snippets.

@amitp
Last active August 29, 2015 14:10
Show Gist options
  • Save amitp/15edb4638bc43bac4ca2 to your computer and use it in GitHub Desktop.
Save amitp/15edb4638bc43bac4ca2 to your computer and use it in GitHub Desktop.
emacs git-gutter showing linum instead of symbols
(defun git-gutter:view-set-overlays (diffinfos)
(save-excursion
(goto-char (point-min))
(cl-loop with curline = 1
for info in diffinfos
for start-line = (plist-get info :start-line)
for end-line = (plist-get info :end-line)
for type = (plist-get info :type)
do
(progn
(forward-line (- start-line curline))
(cl-case type
((modified added)
(setq curline start-line)
(while (and (<= curline end-line) (not (eobp)))
(git-gutter:view-at-pos (propertize (format "%5d" curline) 'face (git-gutter:select-face type)) (point))
(cl-incf curline)
(forward-line 1)))
(deleted
(git-gutter:view-at-pos (propertize (format "%5d" curline) 'face (git-gutter:select-face type)) (point))
(forward-line 1)
(setq curline (1+ end-line))))))))
; make sure there's room for the linum
(setq git-gutter:window-width 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment