GNU bug report logs -
#9205
24.0.50; colored mark in vc mode-line
Previous Next
Reported by: pmlists <at> free.fr (Peter Münster)
Date: Sat, 30 Jul 2011 17:59:02 UTC
Severity: wishlist
Tags: patch, wontfix
Found in version 24.0.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
Here a little feature request for vc:
--8<---------------cut here---------------start------------->8---
;; Make it immediately obvious, if file is modified or not, by a red or
;; a green point in the modeline.
;; Code is from psvn.el by Stefan Reichoer (GNU GPL)
(defvar vc-state-mark-modeline t)
(defun vc-mark-modeline-dot (color)
(propertize " "
'display
`(image :type xpm
:data ,(format "/* XPM */
static char * data[] = {
\"18 13 3 1\",
\" c None\",
\"+ c #000000\",
\". c %s\",
\" \",
\" +++++ \",
\" +.....+ \",
\" +.......+ \",
\" +.........+ \",
\" +.........+ \",
\" +.........+ \",
\" +.........+ \",
\" +.........+ \",
\" +.......+ \",
\" +.....+ \",
\" +++++ \",
\" \"};"
color)
:ascent center)))
(defsubst vc-state->color (stat)
"Interpret vc-state symbol to mode line color"
(case stat
('edited "tomato" )
('up-to-date "GreenYellow" )
;; what is missing here??
;; ('unknown "gray" )
;; ('added "blue" )
;; ('deleted "red" )
;; ('unmerged "purple" )
(t "red")))
(defun vc-install-state-mark-modeline (color)
(push `(vc-state-mark-modeline ,(vc-mark-modeline-dot color))
mode-line-format))
(defun vc-uninstall-state-mark-modeline ()
(setq mode-line-format
(remove-if #'(lambda (mode) (eq (car-safe mode)
'vc-state-mark-modeline))
mode-line-format)))
(defadvice vc-default-mode-line-string
(before my-before-vc-mode-line-string activate)
(let* ((backend-name (symbol-name backend))
(state (vc-state file backend))
(color (vc-state->color state)))
(vc-uninstall-state-mark-modeline)
(vc-install-state-mark-modeline color)))
--8<---------------cut here---------------end--------------->8---
Cheers,
--
Peter
This bug report was last modified 6 years and 16 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.