(provide 'git-modeline)
(defvar git--state-mark-modeline t) (defvar git--state-mark-tooltip nil)
(defun git--state-mark-modeline-dot (color)
(propertize " "
'help-echo 'git--state-mark-tooltip
'display
`(image :type xpm
:data ,(format "/* XPM */
static char * data[] = {
\"18 13 3 1\",
\" c None\",
\"+ c #000000\",
\". c %s\",
\" \",
\" +++++ \",
\" +.....+ \",
\" +.......+ \",
\" +.........+ \",
\" +.........+ \",
\" +.........+ \",
\" +.........+ \",
\" +.........+ \",
\" +.......+ \",
\" +.....+ \",
\" +++++ \",
\" \"};"
color)
:ascent center)))
(defun git--install-state-mark-modeline (color)
(push `(git--state-mark-modeline
,(git--state-mark-modeline-dot color))
mode-line-format)
(force-mode-line-update t))
(defun git--uninstall-state-mark-modeline ()
(setq mode-line-format
(remove-if #'(lambda (mode) (eq (car-safe mode)
'git--state-mark-modeline))
mode-line-format))
(force-mode-line-update t))
(defun git--update-state-mark-tooltip (tooltip)
(setq git--state-mark-tooltip tooltip))
(defun git--update-state-mark (color)
(git--uninstall-state-mark-modeline)
(git--install-state-mark-modeline color))