Mercurial > emacs
annotate lisp/vc-annotate.el @ 96269:603f00a9cc21
Comment typo.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 25 Jun 2008 07:49:12 +0000 |
parents | 5a490e8feb43 |
children | fa83184d8296 |
rev | line source |
---|---|
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
1 ;;; vc-annotate.el --- VC Annotate Support |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
2 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
3 ;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
4 ;; 2007, 2008 Free Software Foundation, Inc. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
5 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
6 ;; Author: Martin Lorentzson <emwson@emw.ericsson.se> |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
7 ;; Maintainer: FSF |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
8 ;; Keywords: tools |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
9 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
11 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
15 ;; (at your option) any later version. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
16 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
21 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
24 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
25 ;;; Commentary: |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
26 ;; |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
27 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
28 (require 'vc-hooks) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
29 (require 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
30 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
31 ;;; Code: |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
32 (eval-when-compile |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
33 (require 'cl)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
34 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
35 (defcustom vc-annotate-display-mode 'fullscale |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
36 "Which mode to color the output of \\[vc-annotate] with by default." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
37 :type '(choice (const :tag "By Color Map Range" nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
38 (const :tag "Scale to Oldest" scale) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
39 (const :tag "Scale Oldest->Newest" fullscale) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
40 (number :tag "Specify Fractional Number of Days" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
41 :value "20.5")) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
42 :group 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
43 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
44 (defcustom vc-annotate-color-map |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
45 (if (and (tty-display-color-p) (<= (display-color-cells) 8)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
46 ;; A custom sorted TTY colormap |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
47 (let* ((colors |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
48 (sort |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
49 (delq nil |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
50 (mapcar (lambda (x) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
51 (if (not (or |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
52 (string-equal (car x) "white") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
53 (string-equal (car x) "black") )) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
54 (car x))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
55 (tty-color-alist))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
56 (lambda (a b) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
57 (cond |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
58 ((or (string-equal a "red") (string-equal b "blue")) t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
59 ((or (string-equal b "red") (string-equal a "blue")) nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
60 ((string-equal a "yellow") t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
61 ((string-equal b "yellow") nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
62 ((string-equal a "cyan") t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
63 ((string-equal b "cyan") nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
64 ((string-equal a "green") t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
65 ((string-equal b "green") nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
66 ((string-equal a "magenta") t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
67 ((string-equal b "magenta") nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
68 (t (string< a b)))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
69 (date 20.) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
70 (delta (/ (- 360. date) (1- (length colors))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
71 (mapcar (lambda (x) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
72 (prog1 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
73 (cons date x) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
74 (setq date (+ date delta)))) colors)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
75 ;; Normal colormap: hue stepped from 0-240deg, value=1., saturation=0.75 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
76 '(( 20. . "#FF3F3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
77 ( 40. . "#FF6C3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
78 ( 60. . "#FF993F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
79 ( 80. . "#FFC63F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
80 (100. . "#FFF33F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
81 (120. . "#DDFF3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
82 (140. . "#B0FF3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
83 (160. . "#83FF3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
84 (180. . "#56FF3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
85 (200. . "#3FFF56") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
86 (220. . "#3FFF83") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
87 (240. . "#3FFFB0") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
88 (260. . "#3FFFDD") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
89 (280. . "#3FF3FF") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
90 (300. . "#3FC6FF") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
91 (320. . "#3F99FF") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
92 (340. . "#3F6CFF") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
93 (360. . "#3F3FFF"))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
94 "Association list of age versus color, for \\[vc-annotate]. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
95 Ages are given in units of fractional days. Default is eighteen |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
96 steps using a twenty day increment, from red to blue. For TTY |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
97 displays with 8 or fewer colors, the default is red to blue with |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
98 all other colors between (excluding black and white)." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
99 :type 'alist |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
100 :group 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
101 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
102 (defcustom vc-annotate-very-old-color "#3F3FFF" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
103 "Color for lines older than the current color range in \\[vc-annotate]]." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
104 :type 'string |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
105 :group 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
106 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
107 (defcustom vc-annotate-background "black" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
108 "Background color for \\[vc-annotate]. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
109 Default color is used if nil." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
110 :type '(choice (const :tag "Default background" nil) (color)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
111 :group 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
112 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
113 (defcustom vc-annotate-menu-elements '(2 0.5 0.1 0.01) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
114 "Menu elements for the mode-specific menu of VC-Annotate mode. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
115 List of factors, used to expand/compress the time scale. See `vc-annotate'." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
116 :type '(repeat number) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
117 :group 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
118 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
119 (defvar vc-annotate-mode-map |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
120 (let ((m (make-sparse-keymap))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
121 (define-key m "A" 'vc-annotate-revision-previous-to-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
122 (define-key m "D" 'vc-annotate-show-diff-revision-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
123 (define-key m "f" 'vc-annotate-find-revision-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
124 (define-key m "J" 'vc-annotate-revision-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
125 (define-key m "L" 'vc-annotate-show-log-revision-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
126 (define-key m "N" 'vc-annotate-next-revision) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
127 (define-key m "P" 'vc-annotate-prev-revision) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
128 (define-key m "W" 'vc-annotate-working-revision) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
129 (define-key m "V" 'vc-annotate-toggle-annotation-visibility) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
130 m) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
131 "Local keymap used for VC-Annotate mode.") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
132 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
133 ;;; Annotate functionality |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
134 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
135 ;; Declare globally instead of additional parameter to |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
136 ;; temp-buffer-show-function (not possible to pass more than one |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
137 ;; parameter). The use of annotate-ratio is deprecated in favor of |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
138 ;; annotate-mode, which replaces it with the more sensible "span-to |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
139 ;; days", along with autoscaling support. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
140 (defvar vc-annotate-ratio nil "Global variable.") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
141 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
142 ;; internal buffer-local variables |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
143 (defvar vc-annotate-backend nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
144 (defvar vc-annotate-parent-file nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
145 (defvar vc-annotate-parent-rev nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
146 (defvar vc-annotate-parent-display-mode nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
147 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
148 (defconst vc-annotate-font-lock-keywords |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
149 ;; The fontification is done by vc-annotate-lines instead of font-lock. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
150 '((vc-annotate-lines))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
151 |
96206
5a490e8feb43
(vc-annotate-mode): Derive from special-mode
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96204
diff
changeset
|
152 (define-derived-mode vc-annotate-mode special-mode "Annotate" |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
153 "Major mode for output buffers of the `vc-annotate' command. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
154 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
155 You can use the mode-specific menu to alter the time-span of the used |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
156 colors. See variable `vc-annotate-menu-elements' for customizing the |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
157 menu items." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
158 ;; Frob buffer-invisibility-spec so that if it is originally a naked t, |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
159 ;; it will become a list, to avoid initial annotations being invisible. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
160 (add-to-invisibility-spec 'foo) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
161 (remove-from-invisibility-spec 'foo) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
162 (set (make-local-variable 'truncate-lines) t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
163 (set (make-local-variable 'font-lock-defaults) |
96206
5a490e8feb43
(vc-annotate-mode): Derive from special-mode
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96204
diff
changeset
|
164 '(vc-annotate-font-lock-keywords t))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
165 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
166 (defun vc-annotate-toggle-annotation-visibility () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
167 "Toggle whether or not the annotation is visible." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
168 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
169 (funcall (if (memq 'vc-annotate-annotation buffer-invisibility-spec) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
170 'remove-from-invisibility-spec |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
171 'add-to-invisibility-spec) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
172 'vc-annotate-annotation) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
173 (force-window-update (current-buffer))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
174 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
175 (defun vc-annotate-display-default (ratio) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
176 "Display the output of \\[vc-annotate] using the default color range. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
177 The color range is given by `vc-annotate-color-map', scaled by RATIO. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
178 The current time is used as the offset." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
179 (interactive (progn (kill-local-variable 'vc-annotate-color-map) '(1.0))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
180 (message "Redisplaying annotation...") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
181 (vc-annotate-display ratio) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
182 (message "Redisplaying annotation...done")) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
183 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
184 (defun vc-annotate-oldest-in-map (color-map) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
185 "Return the oldest time in the COLOR-MAP." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
186 ;; Since entries should be sorted, we can just use the last one. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
187 (caar (last color-map))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
188 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
189 (defun vc-annotate-get-time-set-line-props () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
190 (let ((bol (point)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
191 (date (vc-call-backend vc-annotate-backend 'annotate-time)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
192 (inhibit-read-only t)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
193 (assert (>= (point) bol)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
194 (put-text-property bol (point) 'invisible 'vc-annotate-annotation) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
195 date)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
196 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
197 (defun vc-annotate-display-autoscale (&optional full) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
198 "Highlight the output of \\[vc-annotate] using an autoscaled color map. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
199 Autoscaling means that the map is scaled from the current time to the |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
200 oldest annotation in the buffer, or, with prefix argument FULL, to |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
201 cover the range from the oldest annotation to the newest." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
202 (interactive "P") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
203 (let ((newest 0.0) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
204 (oldest 999999.) ;Any CVS users at the founding of Rome? |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
205 (current (vc-annotate-convert-time (current-time))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
206 date) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
207 (message "Redisplaying annotation...") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
208 ;; Run through this file and find the oldest and newest dates annotated. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
209 (save-excursion |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
210 (goto-char (point-min)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
211 (while (not (eobp)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
212 (when (setq date (vc-annotate-get-time-set-line-props)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
213 (when (> date newest) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
214 (setq newest date)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
215 (when (< date oldest) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
216 (setq oldest date))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
217 (forward-line 1))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
218 (vc-annotate-display |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
219 (/ (- (if full newest current) oldest) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
220 (vc-annotate-oldest-in-map vc-annotate-color-map)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
221 (if full newest)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
222 (message "Redisplaying annotation...done \(%s\)" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
223 (if full |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
224 (format "Spanned from %.1f to %.1f days old" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
225 (- current oldest) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
226 (- current newest)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
227 (format "Spanned to %.1f days old" (- current oldest)))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
228 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
229 ;; Menu -- Using easymenu.el |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
230 (easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
231 "VC Annotate Display Menu" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
232 `("VC-Annotate" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
233 ["By Color Map Range" (unless (null vc-annotate-display-mode) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
234 (setq vc-annotate-display-mode nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
235 (vc-annotate-display-select)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
236 :style toggle :selected (null vc-annotate-display-mode)] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
237 ,@(let ((oldest-in-map (vc-annotate-oldest-in-map vc-annotate-color-map))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
238 (mapcar (lambda (element) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
239 (let ((days (* element oldest-in-map))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
240 `[,(format "Span %.1f days" days) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
241 (vc-annotate-display-select nil ,days) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
242 :style toggle :selected |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
243 (eql vc-annotate-display-mode ,days) ])) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
244 vc-annotate-menu-elements)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
245 ["Span ..." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
246 (vc-annotate-display-select |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
247 nil (float (string-to-number (read-string "Span how many days? "))))] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
248 "--" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
249 ["Span to Oldest" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
250 (unless (eq vc-annotate-display-mode 'scale) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
251 (vc-annotate-display-select nil 'scale)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
252 :help |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
253 "Use an autoscaled color map from the oldest annotation to the current time" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
254 :style toggle :selected |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
255 (eq vc-annotate-display-mode 'scale)] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
256 ["Span Oldest->Newest" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
257 (unless (eq vc-annotate-display-mode 'fullscale) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
258 (vc-annotate-display-select nil 'fullscale)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
259 :help |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
260 "Use an autoscaled color map from the oldest to the newest annotation" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
261 :style toggle :selected |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
262 (eq vc-annotate-display-mode 'fullscale)] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
263 "--" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
264 ["Toggle annotation visibility" vc-annotate-toggle-annotation-visibility |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
265 :help |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
266 "Toggle whether the annotation is visible or not"] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
267 ["Annotate previous revision" vc-annotate-prev-revision |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
268 :help "Visit the annotation of the revision previous to this one"] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
269 ["Annotate next revision" vc-annotate-next-revision |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
270 :help "Visit the annotation of the revision after this one"] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
271 ["Annotate revision at line" vc-annotate-revision-at-line |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
272 :help |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
273 "Visit the annotation of the revision identified in the current line"] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
274 ["Annotate revision previous to line" vc-annotate-revision-previous-to-line |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
275 :help "Visit the annotation of the revision before the revision at line"] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
276 ["Annotate latest revision" vc-annotate-working-revision |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
277 :help "Visit the annotation of the working revision of this file"] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
278 ["Show log of revision at line" vc-annotate-show-log-revision-at-line |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
279 :help "Visit the log of the revision at line"] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
280 ["Show diff of revision at line" vc-annotate-show-diff-revision-at-line |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
281 :help "Visit the diff of the revision at line from its previous revision"] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
282 ["Show changeset diff of revision at line" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
283 vc-annotate-show-changeset-diff-revision-at-line |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
284 :enable |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
285 (eq 'repository (vc-call-backend ,vc-annotate-backend 'revision-granularity)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
286 :help "Visit the diff of the revision at line from its previous revision"] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
287 ["Visit revision at line" vc-annotate-find-revision-at-line |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
288 :help "Visit the revision identified in the current line"])) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
289 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
290 (defun vc-annotate-display-select (&optional buffer mode) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
291 "Highlight the output of \\[vc-annotate]. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
292 By default, the current buffer is highlighted, unless overridden by |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
293 BUFFER. `vc-annotate-display-mode' specifies the highlighting mode to |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
294 use; you may override this using the second optional arg MODE." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
295 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
296 (when mode (setq vc-annotate-display-mode mode)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
297 (pop-to-buffer (or buffer (current-buffer))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
298 (cond ((null vc-annotate-display-mode) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
299 ;; The ratio is global, thus relative to the global color-map. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
300 (kill-local-variable 'vc-annotate-color-map) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
301 (vc-annotate-display-default (or vc-annotate-ratio 1.0))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
302 ;; One of the auto-scaling modes |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
303 ((eq vc-annotate-display-mode 'scale) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
304 (vc-exec-after `(vc-annotate-display-autoscale))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
305 ((eq vc-annotate-display-mode 'fullscale) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
306 (vc-exec-after `(vc-annotate-display-autoscale t))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
307 ((numberp vc-annotate-display-mode) ; A fixed number of days lookback |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
308 (vc-annotate-display-default |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
309 (/ vc-annotate-display-mode |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
310 (vc-annotate-oldest-in-map vc-annotate-color-map)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
311 (t (error "No such display mode: %s" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
312 vc-annotate-display-mode)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
313 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
314 ;;;###autoload |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
315 (defun vc-annotate (file rev &optional display-mode buf move-point-to) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
316 "Display the edit history of the current file using colors. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
317 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
318 This command creates a buffer that shows, for each line of the current |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
319 file, when it was last edited and by whom. Additionally, colors are |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
320 used to show the age of each line--blue means oldest, red means |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
321 youngest, and intermediate colors indicate intermediate ages. By |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
322 default, the time scale stretches back one year into the past; |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
323 everything that is older than that is shown in blue. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
324 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
325 With a prefix argument, this command asks two questions in the |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
326 minibuffer. First, you may enter a revision number; then the buffer |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
327 displays and annotates that revision instead of the working revision |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
328 \(type RET in the minibuffer to leave that default unchanged). Then, |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
329 you are prompted for the time span in days which the color range |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
330 should cover. For example, a time span of 20 days means that changes |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
331 over the past 20 days are shown in red to blue, according to their |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
332 age, and everything that is older than that is shown in blue. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
333 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
334 If MOVE-POINT-TO is given, move the point to that line. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
335 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
336 Customization variables: |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
337 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
338 `vc-annotate-menu-elements' customizes the menu elements of the |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
339 mode-specific menu. `vc-annotate-color-map' and |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
340 `vc-annotate-very-old-color' define the mapping of time to colors. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
341 `vc-annotate-background' specifies the background color." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
342 (interactive |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
343 (save-current-buffer |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
344 (vc-ensure-vc-buffer) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
345 (list buffer-file-name |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
346 (let ((def (vc-working-revision buffer-file-name))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
347 (if (null current-prefix-arg) def |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
348 (read-string |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
349 (format "Annotate from revision (default %s): " def) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
350 nil nil def))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
351 (if (null current-prefix-arg) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
352 vc-annotate-display-mode |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
353 (float (string-to-number |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
354 (read-string "Annotate span days (default 20): " |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
355 nil nil "20"))))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
356 (vc-ensure-vc-buffer) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
357 (setq vc-annotate-display-mode display-mode) ;Not sure why. --Stef |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
358 (let* ((temp-buffer-name (format "*Annotate %s (rev %s)*" (buffer-name) rev)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
359 (temp-buffer-show-function 'vc-annotate-display-select) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
360 ;; If BUF is specified, we presume the caller maintains current line, |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
361 ;; so we don't need to do it here. This implementation may give |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
362 ;; strange results occasionally in the case of REV != WORKFILE-REV. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
363 (current-line (or move-point-to (unless buf (line-number-at-pos))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
364 (message "Annotating...") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
365 ;; If BUF is specified it tells in which buffer we should put the |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
366 ;; annotations. This is used when switching annotations to another |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
367 ;; revision, so we should update the buffer's name. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
368 (when buf (with-current-buffer buf |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
369 (rename-buffer temp-buffer-name t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
370 ;; In case it had to be uniquified. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
371 (setq temp-buffer-name (buffer-name)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
372 (with-output-to-temp-buffer temp-buffer-name |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
373 (let ((backend (vc-backend file))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
374 (vc-call-backend backend 'annotate-command file |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
375 (get-buffer temp-buffer-name) rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
376 ;; we must setup the mode first, and then set our local |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
377 ;; variables before the show-function is called at the exit of |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
378 ;; with-output-to-temp-buffer |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
379 (with-current-buffer temp-buffer-name |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
380 (unless (equal major-mode 'vc-annotate-mode) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
381 (vc-annotate-mode)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
382 (set (make-local-variable 'vc-annotate-backend) backend) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
383 (set (make-local-variable 'vc-annotate-parent-file) file) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
384 (set (make-local-variable 'vc-annotate-parent-rev) rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
385 (set (make-local-variable 'vc-annotate-parent-display-mode) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
386 display-mode)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
387 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
388 (with-current-buffer temp-buffer-name |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
389 (vc-exec-after |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
390 `(progn |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
391 ;; Ideally, we'd rather not move point if the user has already |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
392 ;; moved it elsewhere, but really point here is not the position |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
393 ;; of the user's cursor :-( |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
394 (when ,current-line ;(and (bobp)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
395 (goto-line ,current-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
396 (setq vc-sentinel-movepoint (point))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
397 (unless (active-minibuffer-window) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
398 (message "Annotating... done"))))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
399 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
400 (defun vc-annotate-prev-revision (prefix) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
401 "Visit the annotation of the revision previous to this one. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
402 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
403 With a numeric prefix argument, annotate the revision that many |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
404 revisions previous." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
405 (interactive "p") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
406 (vc-annotate-warp-revision (- 0 prefix))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
407 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
408 (defun vc-annotate-next-revision (prefix) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
409 "Visit the annotation of the revision after this one. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
410 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
411 With a numeric prefix argument, annotate the revision that many |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
412 revisions after." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
413 (interactive "p") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
414 (vc-annotate-warp-revision prefix)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
415 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
416 (defun vc-annotate-working-revision () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
417 "Visit the annotation of the working revision of this file." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
418 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
419 (if (not (equal major-mode 'vc-annotate-mode)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
420 (message "Cannot be invoked outside of a vc annotate buffer") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
421 (let ((warp-rev (vc-working-revision vc-annotate-parent-file))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
422 (if (equal warp-rev vc-annotate-parent-rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
423 (message "Already at revision %s" warp-rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
424 (vc-annotate-warp-revision warp-rev))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
425 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
426 (defun vc-annotate-extract-revision-at-line () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
427 "Extract the revision number of the current line." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
428 ;; This function must be invoked from a buffer in vc-annotate-mode |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
429 (vc-call-backend vc-annotate-backend 'annotate-extract-revision-at-line)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
430 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
431 (defun vc-annotate-revision-at-line () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
432 "Visit the annotation of the revision identified in the current line." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
433 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
434 (if (not (equal major-mode 'vc-annotate-mode)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
435 (message "Cannot be invoked outside of a vc annotate buffer") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
436 (let ((rev-at-line (vc-annotate-extract-revision-at-line))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
437 (if (not rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
438 (message "Cannot extract revision number from the current line") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
439 (if (equal rev-at-line vc-annotate-parent-rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
440 (message "Already at revision %s" rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
441 (vc-annotate-warp-revision rev-at-line)))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
442 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
443 (defun vc-annotate-find-revision-at-line () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
444 "Visit the revision identified in the current line." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
445 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
446 (if (not (equal major-mode 'vc-annotate-mode)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
447 (message "Cannot be invoked outside of a vc annotate buffer") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
448 (let ((rev-at-line (vc-annotate-extract-revision-at-line))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
449 (if (not rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
450 (message "Cannot extract revision number from the current line") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
451 (vc-revision-other-window rev-at-line))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
452 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
453 (defun vc-annotate-revision-previous-to-line () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
454 "Visit the annotation of the revision before the revision at line." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
455 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
456 (if (not (equal major-mode 'vc-annotate-mode)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
457 (message "Cannot be invoked outside of a vc annotate buffer") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
458 (let ((rev-at-line (vc-annotate-extract-revision-at-line)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
459 (prev-rev nil)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
460 (if (not rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
461 (message "Cannot extract revision number from the current line") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
462 (setq prev-rev |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
463 (vc-call-backend vc-annotate-backend 'previous-revision |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
464 vc-annotate-parent-file rev-at-line)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
465 (vc-annotate-warp-revision prev-rev))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
466 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
467 (defun vc-annotate-show-log-revision-at-line () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
468 "Visit the log of the revision at line." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
469 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
470 (if (not (equal major-mode 'vc-annotate-mode)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
471 (message "Cannot be invoked outside of a vc annotate buffer") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
472 (let ((rev-at-line (vc-annotate-extract-revision-at-line))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
473 (if (not rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
474 (message "Cannot extract revision number from the current line") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
475 (vc-print-log rev-at-line))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
476 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
477 (defun vc-annotate-show-diff-revision-at-line-internal (fileset) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
478 (if (not (equal major-mode 'vc-annotate-mode)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
479 (message "Cannot be invoked outside of a vc annotate buffer") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
480 (let ((rev-at-line (vc-annotate-extract-revision-at-line)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
481 (prev-rev nil)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
482 (if (not rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
483 (message "Cannot extract revision number from the current line") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
484 (setq prev-rev |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
485 (vc-call-backend vc-annotate-backend 'previous-revision |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
486 vc-annotate-parent-file rev-at-line)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
487 (if (not prev-rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
488 (message "Cannot diff from any revision prior to %s" rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
489 (save-window-excursion |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
490 (vc-diff-internal |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
491 nil |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
492 ;; The value passed here should follow what |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
493 ;; `vc-deduce-fileset' returns. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
494 (cons vc-annotate-backend (cons fileset nil)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
495 prev-rev rev-at-line)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
496 (switch-to-buffer "*vc-diff*")))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
497 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
498 (defun vc-annotate-show-diff-revision-at-line () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
499 "Visit the diff of the revision at line from its previous revision." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
500 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
501 (vc-annotate-show-diff-revision-at-line-internal (list vc-annotate-parent-file))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
502 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
503 (defun vc-annotate-show-changeset-diff-revision-at-line () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
504 "Visit the diff of the revision at line from its previous revision for all files in the changeset." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
505 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
506 (when (eq 'file (vc-call-backend vc-annotate-backend 'revision-granularity)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
507 (error "The %s backend does not support changeset diffs" vc-annotate-backend)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
508 (vc-annotate-show-diff-revision-at-line-internal nil)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
509 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
510 (defun vc-annotate-warp-revision (revspec) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
511 "Annotate the revision described by REVSPEC. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
512 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
513 If REVSPEC is a positive integer, warp that many revisions |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
514 forward, if possible, otherwise echo a warning message. If |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
515 REVSPEC is a negative integer, warp that many revisions backward, |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
516 if possible, otherwise echo a warning message. If REVSPEC is a |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
517 string, then it describes a revision number, so warp to that |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
518 revision." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
519 (if (not (equal major-mode 'vc-annotate-mode)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
520 (message "Cannot be invoked outside of a vc annotate buffer") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
521 (let* ((buf (current-buffer)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
522 (oldline (line-number-at-pos)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
523 (revspeccopy revspec) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
524 (newrev nil)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
525 (cond |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
526 ((and (integerp revspec) (> revspec 0)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
527 (setq newrev vc-annotate-parent-rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
528 (while (and (> revspec 0) newrev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
529 (setq newrev (vc-call-backend vc-annotate-backend 'next-revision |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
530 vc-annotate-parent-file newrev)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
531 (setq revspec (1- revspec))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
532 (unless newrev |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
533 (message "Cannot increment %d revisions from revision %s" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
534 revspeccopy vc-annotate-parent-rev))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
535 ((and (integerp revspec) (< revspec 0)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
536 (setq newrev vc-annotate-parent-rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
537 (while (and (< revspec 0) newrev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
538 (setq newrev (vc-call-backend vc-annotate-backend 'previous-revision |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
539 vc-annotate-parent-file newrev)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
540 (setq revspec (1+ revspec))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
541 (unless newrev |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
542 (message "Cannot decrement %d revisions from revision %s" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
543 (- 0 revspeccopy) vc-annotate-parent-rev))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
544 ((stringp revspec) (setq newrev revspec)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
545 (t (error "Invalid argument to vc-annotate-warp-revision"))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
546 (when newrev |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
547 (vc-annotate vc-annotate-parent-file newrev |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
548 vc-annotate-parent-display-mode |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
549 buf |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
550 ;; Pass the current line so that vc-annotate will |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
551 ;; place the point in the line. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
552 (min oldline (progn (goto-char (point-max)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
553 (forward-line -1) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
554 (line-number-at-pos)))))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
555 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
556 (defun vc-annotate-compcar (threshold a-list) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
557 "Test successive cons cells of A-LIST against THRESHOLD. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
558 Return the first cons cell with a car that is not less than THRESHOLD, |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
559 nil if no such cell exists." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
560 (let ((i 1) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
561 (tmp-cons (car a-list))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
562 (while (and tmp-cons (< (car tmp-cons) threshold)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
563 (setq tmp-cons (car (nthcdr i a-list))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
564 (setq i (+ i 1))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
565 tmp-cons)) ; Return the appropriate value |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
566 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
567 (defun vc-annotate-convert-time (time) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
568 "Convert a time value to a floating-point number of days. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
569 The argument TIME is a list as returned by `current-time' or |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
570 `encode-time', only the first two elements of that list are considered." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
571 (/ (+ (* (float (car time)) (lsh 1 16)) (cadr time)) 24 3600)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
572 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
573 (defun vc-annotate-difference (&optional offset) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
574 "Return the time span in days to the next annotation. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
575 This calls the backend function annotate-time, and returns the |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
576 difference in days between the time returned and the current time, |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
577 or OFFSET if present." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
578 (let ((next-time (vc-annotate-get-time-set-line-props))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
579 (when next-time |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
580 (- (or offset |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
581 (vc-call-backend vc-annotate-backend 'annotate-current-time)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
582 next-time)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
583 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
584 (defun vc-default-annotate-current-time (backend) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
585 "Return the current time, encoded as fractional days." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
586 (vc-annotate-convert-time (current-time))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
587 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
588 (defvar vc-annotate-offset nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
589 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
590 (defun vc-annotate-display (ratio &optional offset) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
591 "Highlight `vc-annotate' output in the current buffer. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
592 RATIO, is the expansion that should be applied to `vc-annotate-color-map'. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
593 The annotations are relative to the current time, unless overridden by OFFSET." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
594 (when (/= ratio 1.0) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
595 (set (make-local-variable 'vc-annotate-color-map) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
596 (mapcar (lambda (elem) (cons (* (car elem) ratio) (cdr elem))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
597 vc-annotate-color-map))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
598 (set (make-local-variable 'vc-annotate-offset) offset) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
599 (font-lock-mode 1)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
600 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
601 (defun vc-annotate-lines (limit) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
602 (while (< (point) limit) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
603 (let ((difference (vc-annotate-difference vc-annotate-offset)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
604 (start (point)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
605 (end (progn (forward-line 1) (point)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
606 (when difference |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
607 (let* ((color (or (vc-annotate-compcar difference vc-annotate-color-map) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
608 (cons nil vc-annotate-very-old-color))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
609 ;; substring from index 1 to remove any leading `#' in the name |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
610 (face-name (concat "vc-annotate-face-" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
611 (if (string-equal |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
612 (substring (cdr color) 0 1) "#") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
613 (substring (cdr color) 1) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
614 (cdr color)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
615 ;; Make the face if not done. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
616 (face (or (intern-soft face-name) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
617 (let ((tmp-face (make-face (intern face-name)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
618 (set-face-foreground tmp-face (cdr color)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
619 (when vc-annotate-background |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
620 (set-face-background tmp-face |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
621 vc-annotate-background)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
622 tmp-face)))) ; Return the face |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
623 (put-text-property start end 'face face))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
624 ;; Pretend to font-lock there were no matches. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
625 nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
626 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
627 (provide 'vc-annotate) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
628 |
96204 | 629 ;; arch-tag: c3454a89-80e5-4ffd-8993-671b59612898 |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
630 ;;; vc-annotate.el ends here |