all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: emacs-devel@gnu.org
Subject: RFC: faces for the VC info on the modeline
Date: Fri, 06 Aug 2010 21:13:26 +0200	[thread overview]
Message-ID: <87k4o34krt.fsf@telefonica.net> (raw)

This is a quick and dirty implementation.

I don't understand Miles suggestion about using an alist, so took the
simple route.

Please don't be too hard when criticizing the colors I chose ;-)

(Eli, I hope this answers your question from the vc-mode-line thread)

--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -51,6 +51,78 @@ BACKEND, use `vc-handled-backends'."
 (defvar vc-header-alist ())
 (make-obsolete-variable 'vc-header-alist 'vc-BACKEND-header "21.1")
 
+(defface vc-up-to-date-state
+  '((((class color) (background light))
+     :foreground "blue1")
+    (((class color) (background dark))
+     :foreground "white"))
+  "Face for VC modeline state when the file is up to date."
+  :version "24.1"
+  :group 'vc)
+
+(defface vc-needs-update-state
+  '((((class color) (background light))
+     :foreground "blue1")
+    (((class color) (background dark))
+     :foreground "white"))
+  "Face for VC modeline state when the file needs update."
+  :version "24.1"
+  :group 'vc)
+
+(defface vc-locked-state
+  '((((class color) (background light))
+     :foreground "blue1" :weight bold)
+    (((class color) (background dark))
+     :foreground "white" :weight bold))
+  "Face for VC modeline state when the file locked."
+  :version "24.1"
+  :group 'vc)
+
+(defface vc-locally-added-state
+  '((((class color) (background light))
+     :foreground "red" :weight bold)
+    (((class color) (background dark))
+     :foreground "red" :weight bold))
+  "Face for VC modeline state when the file is locally added."
+  :version "24.1"
+  :group 'vc)
+
+(defface vc-conflict-state
+  '((((class color) (background light))
+     :foreground "black" :background "red")
+    (((class color) (background dark))
+     :foreground "white" :background "red"))
+  "Face for VC modeline state when the file contains merge conflicts."
+  :version "24.1"
+  :group 'vc)
+
+(defface vc-removed-state
+  '((((class color) (background light))
+     :foreground "black" :background "red" :weight bold)
+    (((class color) (background dark))
+     :foreground "white" :background "red" :weight bold))
+  "Face for VC modeline state when the file was removed from the VC system."
+  :version "24.1"
+  :group 'vc)
+
+(defface vc-missing-state
+  '((((class color) (background light))
+     :foreground "black" :background "red" :weight bold)
+    (((class color) (background dark))
+     :foreground "white" :background "red" :weight bold))
+  "Face for VC modeline state when the file is missing from the file system."
+  :version "24.1"
+  :group 'vc)
+
+(defface vc-edited-state
+  '((((class color) (background light))
+     :foreground "red")
+    (((class color) (background dark))
+     :foreground "red"))
+  "Face for VC modeline state when the file is up to date."
+  :version "24.1"
+  :group 'vc)
+  
 (defcustom vc-ignore-dir-regexp
   ;; Stop SMB, automounter, AFS, and DFS host lookups.
   locate-dominating-stop-dir-regexp
@@ -819,33 +891,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"))))
 





                 reply	other threads:[~2010-08-06 19:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k4o34krt.fsf@telefonica.net \
    --to=ofv@wanadoo.es \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.