[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] [emacs] 01/01: Add faces for the VC modeline state indicat
From: |
Oscar Fuentes |
Subject: |
[Emacs-diffs] [emacs] 01/01: Add faces for the VC modeline state indicator |
Date: |
Sun, 16 Nov 2014 05:16:57 +0000 |
ofv pushed a commit to branch master
in repository emacs.
commit d409545938d636156b7d0a4ce889197d8fa03e65
Author: Oscar Fuentes <address@hidden>
Date: Sun Nov 16 05:40:10 2014 +0100
Add faces for the VC modeline state indicator
* lisp/vc/vc-hooks.el:
(vc-state-faces, vc-state-base-face)
(vc-up-to-date-state, vc-needs-update-state)
(vc-locked-state, vc-locally-added-state)
(vc-conflict-state, vc-removed-state)
(vc-missing-state, vc-edited-state):
New faces.
(vc-default-mode-line-string): Use them
---
lisp/ChangeLog | 12 ++++++++
lisp/vc/vc-hooks.el | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+), 0 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 634412e..cfb7900 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
+2014-11-16 Oscar Fuentes <address@hidden>
+
+ Add faces for the VC modeline state indicator.
+ * lisp/vc/vc-hooks.el:
+ (vc-state-faces, vc-state-base-face)
+ (vc-up-to-date-state, vc-needs-update-state)
+ (vc-locked-state, vc-locally-added-state)
+ (vc-conflict-state, vc-removed-state)
+ (vc-missing-state, vc-edited-state):
+ New faces.
+ (vc-default-mode-line-string): Use them
+
2014-11-16 Stefan Monnier <address@hidden>
* emacs-lisp/backquote.el (backquote-process): Optimize away the ,'
case.
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index df660d1..6359e19 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -32,6 +32,69 @@
(eval-when-compile (require 'cl-lib))
+;; Faces
+
+(defgroup vc-state-faces nil
+ "Faces used in the mode line by the VC state indicator."
+ :group 'vc-faces
+ :group 'mode-line
+ :version "25.1")
+
+(defface vc-state-base-face
+ '((default :inherit mode-line))
+ "Base face for VC state indicator."
+ :group 'vc-faces
+ :group 'mode-line
+ :version "25.1")
+
+(defface vc-up-to-date-state
+ '((default :inherit vc-state-base-face))
+ "Face for VC modeline state when the file is up to date."
+ :version "25.1"
+ :group 'vc-faces)
+
+(defface vc-needs-update-state
+ '((default :inherit vc-state-base-face))
+ "Face for VC modeline state when the file needs update."
+ :version "25.1"
+ :group 'vc-faces)
+
+(defface vc-locked-state
+ '((default :inherit vc-state-base-face))
+ "Face for VC modeline state when the file locked."
+ :version "25.1"
+ :group 'vc-faces)
+
+(defface vc-locally-added-state
+ '((default :inherit vc-state-base-face))
+ "Face for VC modeline state when the file is locally added."
+ :version "25.1"
+ :group 'vc-faces)
+
+(defface vc-conflict-state
+ '((default :inherit vc-state-base-face))
+ "Face for VC modeline state when the file contains merge conflicts."
+ :version "25.1"
+ :group 'vc-faces)
+
+(defface vc-removed-state
+ '((default :inherit vc-state-base-face))
+ "Face for VC modeline state when the file was removed from the VC system."
+ :version "25.1"
+ :group 'vc-faces)
+
+(defface vc-missing-state
+ '((default :inherit vc-state-base-face))
+ "Face for VC modeline state when the file is missing from the file system."
+ :version "25.1"
+ :group 'vc-faces)
+
+(defface vc-edited-state
+ '((default :inherit vc-state-base-face))
+ "Face for VC modeline state when the file is up to date."
+ :version "25.1"
+ :group 'vc-faces)
+
;; Customization Variables (the rest is in vc.el)
(defcustom vc-ignore-dir-regexp
@@ -800,33 +863,42 @@ This function assumes that the file is registered."
(let* ((backend-name (symbol-name backend))
(state (vc-state file backend))
(state-echo nil)
+ (face nil)
(rev (vc-working-revision file backend)))
(propertize
(cond ((or (eq state 'up-to-date)
(eq state 'needs-update))
(setq state-echo "Up to date file")
+ (setq face 'vc-up-to-date-state)
(concat backend-name "-" rev))
((stringp state)
(setq state-echo (concat "File locked by" state))
+ (setq face 'vc-locked-state)
(concat backend-name ":" state ":" rev))
((eq state 'added)
(setq state-echo "Locally added file")
+ (setq face 'vc-locally-added-state)
(concat backend-name "@" rev))
((eq state 'conflict)
(setq state-echo "File contains conflicts after the last merge")
+ (setq face 'vc-conflict-state)
(concat backend-name "!" rev))
((eq state 'removed)
(setq state-echo "File removed from the VC system")
+ (setq face 'vc-removed-state)
(concat backend-name "!" rev))
((eq state 'missing)
(setq state-echo "File tracked by the VC system, but missing from
the file system")
+ (setq face 'vc-missing-state)
(concat backend-name "?" rev))
(t
;; Not just for the 'edited state, but also a fallback
;; for all other states. Think about different symbols
;; for 'needs-update and 'needs-merge.
(setq state-echo "Locally modified file")
+ (setq face 'vc-edited-state)
(concat backend-name ":" rev)))
+ 'face face
'help-echo (concat state-echo " under the " backend-name
" version control system"))))