From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.devel Subject: RFC: faces for the VC info on the modeline Date: Fri, 06 Aug 2010 21:13:26 +0200 Message-ID: <87k4o34krt.fsf@telefonica.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1281122032 7815 80.91.229.12 (6 Aug 2010 19:13:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 6 Aug 2010 19:13:52 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 06 21:13:50 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OhSMX-0002N7-SH for ged-emacs-devel@m.gmane.org; Fri, 06 Aug 2010 21:13:50 +0200 Original-Received: from localhost ([127.0.0.1]:47376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OhSMX-0006HH-0X for ged-emacs-devel@m.gmane.org; Fri, 06 Aug 2010 15:13:49 -0400 Original-Received: from [140.186.70.92] (port=37437 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OhSMP-0006Er-K8 for emacs-devel@gnu.org; Fri, 06 Aug 2010 15:13:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OhSMO-0005Sr-Hw for emacs-devel@gnu.org; Fri, 06 Aug 2010 15:13:41 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:60124) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OhSMO-0005Sb-78 for emacs-devel@gnu.org; Fri, 06 Aug 2010 15:13:40 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OhSMJ-0002Df-Fe for emacs-devel@gnu.org; Fri, 06 Aug 2010 21:13:35 +0200 Original-Received: from 83.42.13.171 ([83.42.13.171]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Aug 2010 21:13:35 +0200 Original-Received: from ofv by 83.42.13.171 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Aug 2010 21:13:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 134 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 83.42.13.171 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:1okHmH7hV64C7LI5D9HslcAaFvM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:128406 Archived-At: 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"))))