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: Re: Two feature ideas for diffs Date: Sat, 09 Nov 2013 03:30:10 +0100 Message-ID: <87fvr61f4d.fsf@wanadoo.es> References: <527BCD00.9090105@openmailbox.org> <87d2mcdrgu.fsf@yandex.ru> <877gcia4c5.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1383964237 26593 80.91.229.3 (9 Nov 2013 02:30:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Nov 2013 02:30:37 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 09 03:30:42 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VeyJt-0002cN-27 for ged-emacs-devel@m.gmane.org; Sat, 09 Nov 2013 03:30:41 +0100 Original-Received: from localhost ([::1]:54141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeyJr-00079L-QV for ged-emacs-devel@m.gmane.org; Fri, 08 Nov 2013 21:30:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeyJg-00078O-4n for emacs-devel@gnu.org; Fri, 08 Nov 2013 21:30:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeyJa-0007Gm-3v for emacs-devel@gnu.org; Fri, 08 Nov 2013 21:30:27 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:56702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeyJZ-0007Gg-R1 for emacs-devel@gnu.org; Fri, 08 Nov 2013 21:30:22 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VeyJX-0002G0-Rr for emacs-devel@gnu.org; Sat, 09 Nov 2013 03:30:19 +0100 Original-Received: from 247.red-83-46-215.dynamicip.rima-tde.net ([83.46.215.247]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 09 Nov 2013 03:30:19 +0100 Original-Received: from ofv by 247.red-83-46-215.dynamicip.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 09 Nov 2013 03:30:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 189 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 247.red-83-46-215.dynamicip.rima-tde.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:/4VU+gedMHEQbHNwSbXLroQ326w= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:165085 Archived-At: Michael Heerdegen writes: > Hi all, > >> Check out https://github.com/dgutov/diff-hl > > That's nice. > > In addition, I would like to see the vc state in the mode-line. I see > "Git-master" in the mode-line and a mouse echo telling the state ("Up to > date"; "Locally modified" etc.). But I want to see the state from the > indicator The char between "Git" and "master" indicates the VC state. `-' means up to date, `:' means "modified", etc > - preferably by using faces. I implemented that on my personal branch of Emacs. IIRC I submitted it for inclusion, but possibly it went lost on the mailing list. diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 1d67dee..657980c 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -204,12 +204,12 @@ matching the resulting Git log output, and KEYWORDS is a list of (?M 'edited) (?A 'added) (?D 'removed) - (?U 'edited) ;; FIXME + (?U 'conflict) (?T 'edited))) ;; FIXME (defun vc-git-state (file) "Git-specific version of `vc-state'." - ;; FIXME: This can't set 'ignored or 'conflict yet + ;; FIXME: This can't set 'ignored yet. ;; The 'ignored state could be detected with `git ls-files -i -o ;; --exclude-standard` It also can't set 'needs-update or ;; 'needs-merge. The rough equivalent would be that upstream branch @@ -781,6 +781,7 @@ If LIMIT is non-nil, show no more than this many entries." ,(format "--pretty=tformat:%s" (car vc-git-root-log-format)) "--abbrev-commit")) + '("--follow") (when limit (list "-n" (format "%s" limit))) (when start-revision (list start-revision)) '("--"))))))) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index c47bc4c..3140157 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -34,6 +34,93 @@ ;; Customization Variables (the rest is in vc.el) +(defvar vc-ignore-vc-files nil) +(make-obsolete-variable 'vc-ignore-vc-files + "set `vc-handled-backends' to nil to disable VC." + "21.1") + +(defvar vc-master-templates ()) +(make-obsolete-variable 'vc-master-templates + "to define master templates for a given BACKEND, use +vc-BACKEND-master-templates. To enable or disable VC for a given +BACKEND, use `vc-handled-backends'." + "21.1") + +(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 @@ -788,33 +875,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"))))