When using CVS, it's hard to tell if a file was locally modified. Looking
for the "CVS-" vs "CVS:" on the modeline is not user friendly. Below
will
highlight the CVS/RCS text on the modeline if the file was locally
modified. I'm currently using a defadvice, it would be great if something
like this was built into vc.el.
Albert
(defvar vc-mode-ext (detach-extent (make-extent 0 0 "")))
(set-extent-face vc-mode-ext 'highlight)
(defadvice vc-mode-line (after highlight activate)
"highlight CVS/RCS tag if file is modified locally"
(let* ((str vc-mode)
(hdr "^ \\(CVS\\|RCS\\)")
(locked-hdr (concat hdr "-")))
(when (and str ;; initial version may start with nil
(string-match hdr str)
(not (string-match locked-hdr str)))
(let ((substr (substring str 1)))
;; normally modeline displays whatever is in the minor-mode-alist,
;; indexed by mode. The cdr can be either a string or (extent
;; . str) or a list of them. vc-mode is normally set to a string.
;; Change the variable to specify an extent, preceded by a regular
;; space
(setq vc-mode (list " " (cons vc-mode-ext substr)))))))
Show replies by date