Mercurial > emacs
annotate lisp/vc/vc-annotate.el @ 112453:06719a229a46 default tip
* calc/calc.el (calc-default-power-reference-level)
(calc-default-field-reference-level): New variables.
* calc/calc-units.el (math-standard-units): Add dB and Np.
(math-logunits): New variable.
(math-extract-logunits, math-logcombine, calcFunc-luplus)
(calcFunc-luminus, calc-luplus, calc-luminus, math-logunit-level)
(calcFunc-fieldlevel, calcFunc-powerlevel, calc-level): New
functions.
(math-find-base-units-rec): Add entry for ln(10).
* calc/calc-help.el (calc-u-prefix-help): Add logarithmic help.
(calc-ul-prefix-help): New function.
* calc/calc-ext.el (calc-init-extensions): Autoload new units
functions. Add keybindings for new units functions.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Sun, 23 Jan 2011 23:08:04 -0600 |
parents | ef719132ddfa |
children |
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, |
112228
417b1e4d63cd
Merge from emacs-23
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
110015
diff
changeset
|
4 ;; 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
96202
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 |
108971
d928a6a7c3f2
* lisp/finder.el (finder-known-keywords): Add keyword "vc"
Juri Linkov <juri@jurta.org>
parents:
108970
diff
changeset
|
8 ;; Keywords: vc tools |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
109302
diff
changeset
|
9 ;; Package: vc |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
10 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
11 ;; 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
|
12 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
13 ;; 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
|
14 ;; 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
|
15 ;; 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
|
16 ;; (at your option) any later version. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
17 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
18 ;; 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
|
19 ;; 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
|
20 ;; 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
|
21 ;; 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
|
22 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
23 ;; 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
|
24 ;; 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
|
25 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
26 ;;; Commentary: |
99841
fd7d46b20afe
* allout.el (allout-mode): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96517
diff
changeset
|
27 ;; |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
28 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
29 (require 'vc-hooks) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
30 (require 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
31 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
32 ;;; Code: |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
33 (eval-when-compile |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
34 (require 'cl)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
35 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
36 (defcustom vc-annotate-display-mode 'fullscale |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
37 "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
|
38 :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
|
39 (const :tag "Scale to Oldest" scale) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
40 (const :tag "Scale Oldest->Newest" fullscale) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
41 (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
|
42 :value "20.5")) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
43 :group 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
44 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
45 (defcustom vc-annotate-color-map |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
46 (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
|
47 ;; A custom sorted TTY colormap |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
48 (let* ((colors |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
49 (sort |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
50 (delq nil |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
51 (mapcar (lambda (x) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
52 (if (not (or |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
53 (string-equal (car x) "white") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
54 (string-equal (car x) "black") )) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
55 (car x))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
56 (tty-color-alist))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
57 (lambda (a b) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
58 (cond |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
59 ((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
|
60 ((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
|
61 ((string-equal a "yellow") t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
62 ((string-equal b "yellow") nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
63 ((string-equal a "cyan") t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
64 ((string-equal b "cyan") nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
65 ((string-equal a "green") t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
66 ((string-equal b "green") nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
67 ((string-equal a "magenta") t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
68 ((string-equal b "magenta") nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
69 (t (string< a b)))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
70 (date 20.) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
71 (delta (/ (- 360. date) (1- (length colors))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
72 (mapcar (lambda (x) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
73 (prog1 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
74 (cons date x) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
75 (setq date (+ date delta)))) colors)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
76 ;; 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
|
77 '(( 20. . "#FF3F3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
78 ( 40. . "#FF6C3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
79 ( 60. . "#FF993F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
80 ( 80. . "#FFC63F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
81 (100. . "#FFF33F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
82 (120. . "#DDFF3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
83 (140. . "#B0FF3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
84 (160. . "#83FF3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
85 (180. . "#56FF3F") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
86 (200. . "#3FFF56") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
87 (220. . "#3FFF83") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
88 (240. . "#3FFFB0") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
89 (260. . "#3FFFDD") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
90 (280. . "#3FF3FF") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
91 (300. . "#3FC6FF") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
92 (320. . "#3F99FF") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
93 (340. . "#3F6CFF") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
94 (360. . "#3F3FFF"))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
95 "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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 :type 'alist |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
101 :group 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
102 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
103 (defcustom vc-annotate-very-old-color "#3F3FFF" |
99841
fd7d46b20afe
* allout.el (allout-mode): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96517
diff
changeset
|
104 "Color for lines older than the current color range in \\[vc-annotate]." |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
105 :type 'string |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
106 :group 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
107 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
108 (defcustom vc-annotate-background "black" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
109 "Background color for \\[vc-annotate]. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
110 Default color is used if nil." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
111 :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
|
112 :group 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
113 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
114 (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
|
115 "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
|
116 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
|
117 :type '(repeat number) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
118 :group 'vc) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
119 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
120 (defvar vc-annotate-mode-map |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
121 (let ((m (make-sparse-keymap))) |
96475
fa83184d8296
(vc-annotate-mode-map): Bind to lower case keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96206
diff
changeset
|
122 (define-key m "a" 'vc-annotate-revision-previous-to-line) |
fa83184d8296
(vc-annotate-mode-map): Bind to lower case keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96206
diff
changeset
|
123 (define-key m "d" 'vc-annotate-show-diff-revision-at-line) |
fa83184d8296
(vc-annotate-mode-map): Bind to lower case keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96206
diff
changeset
|
124 (define-key m "D" 'vc-annotate-show-changeset-diff-revision-at-line) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
125 (define-key m "f" 'vc-annotate-find-revision-at-line) |
96475
fa83184d8296
(vc-annotate-mode-map): Bind to lower case keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96206
diff
changeset
|
126 (define-key m "j" 'vc-annotate-revision-at-line) |
fa83184d8296
(vc-annotate-mode-map): Bind to lower case keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96206
diff
changeset
|
127 (define-key m "l" 'vc-annotate-show-log-revision-at-line) |
fa83184d8296
(vc-annotate-mode-map): Bind to lower case keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96206
diff
changeset
|
128 (define-key m "n" 'vc-annotate-next-revision) |
fa83184d8296
(vc-annotate-mode-map): Bind to lower case keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96206
diff
changeset
|
129 (define-key m "p" 'vc-annotate-prev-revision) |
fa83184d8296
(vc-annotate-mode-map): Bind to lower case keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96206
diff
changeset
|
130 (define-key m "w" 'vc-annotate-working-revision) |
fa83184d8296
(vc-annotate-mode-map): Bind to lower case keys.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96206
diff
changeset
|
131 (define-key m "v" 'vc-annotate-toggle-annotation-visibility) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
132 m) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
133 "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
|
134 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
135 ;;; Annotate functionality |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
136 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
137 ;; 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
|
138 ;; 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
|
139 ;; 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
|
140 ;; 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
|
141 ;; days", along with autoscaling support. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
142 (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
|
143 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
144 ;; internal buffer-local variables |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
145 (defvar vc-annotate-backend nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
146 (defvar vc-annotate-parent-file nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
147 (defvar vc-annotate-parent-rev nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
148 (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
|
149 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
150 (defconst vc-annotate-font-lock-keywords |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
151 ;; 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
|
152 '((vc-annotate-lines))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
153 |
96206
5a490e8feb43
(vc-annotate-mode): Derive from special-mode
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96204
diff
changeset
|
154 (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
|
155 "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
|
156 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
157 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
|
158 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
|
159 menu items." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
160 ;; 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
|
161 ;; 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
|
162 (add-to-invisibility-spec 'foo) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
163 (remove-from-invisibility-spec 'foo) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
164 (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
|
165 (set (make-local-variable 'font-lock-defaults) |
107374
dc9565b08f10
Add .dir-locals.el support for file-less buffers.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106988
diff
changeset
|
166 '(vc-annotate-font-lock-keywords t)) |
dc9565b08f10
Add .dir-locals.el support for file-less buffers.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106988
diff
changeset
|
167 (hack-dir-local-variables-non-file-buffer)) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
168 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
169 (defun vc-annotate-toggle-annotation-visibility () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
170 "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
|
171 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
172 (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
|
173 'remove-from-invisibility-spec |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
174 'add-to-invisibility-spec) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
175 'vc-annotate-annotation) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
176 (force-window-update (current-buffer))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
177 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
178 (defun vc-annotate-display-default (ratio) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
179 "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
|
180 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
|
181 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
|
182 (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
|
183 (message "Redisplaying annotation...") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
184 (vc-annotate-display ratio) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
185 (message "Redisplaying annotation...done")) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
186 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
187 (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
|
188 "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
|
189 ;; 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
|
190 (caar (last color-map))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
191 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
192 (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
|
193 (let ((bol (point)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
194 (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
|
195 (inhibit-read-only t)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
196 (assert (>= (point) bol)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
197 (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
|
198 date)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
199 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
200 (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
|
201 "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
|
202 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
|
203 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
|
204 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
|
205 (interactive "P") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
206 (let ((newest 0.0) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
207 (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
|
208 (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
|
209 date) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
210 (message "Redisplaying annotation...") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
211 ;; 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
|
212 (save-excursion |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
213 (goto-char (point-min)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
214 (while (not (eobp)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
215 (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
|
216 (when (> date newest) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
217 (setq newest date)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
218 (when (< date oldest) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
219 (setq oldest date))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
220 (forward-line 1))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
221 (vc-annotate-display |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
222 (/ (- (if full newest current) oldest) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
223 (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
|
224 (if full newest)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
225 (message "Redisplaying annotation...done \(%s\)" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
226 (if full |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
227 (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
|
228 (- current oldest) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
229 (- current newest)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
230 (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
|
231 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
232 ;; Menu -- Using easymenu.el |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
233 (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
|
234 "VC Annotate Display Menu" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
235 `("VC-Annotate" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
236 ["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
|
237 (setq vc-annotate-display-mode nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
238 (vc-annotate-display-select)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
239 :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
|
240 ,@(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
|
241 (mapcar (lambda (element) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
242 (let ((days (* element oldest-in-map))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
243 `[,(format "Span %.1f days" days) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
244 (vc-annotate-display-select nil ,days) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
245 :style toggle :selected |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
246 (eql vc-annotate-display-mode ,days) ])) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
247 vc-annotate-menu-elements)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
248 ["Span ..." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
249 (vc-annotate-display-select |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
250 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
|
251 "--" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
252 ["Span to Oldest" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
253 (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
|
254 (vc-annotate-display-select nil 'scale)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
255 :help |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
256 "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
|
257 :style toggle :selected |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
258 (eq vc-annotate-display-mode 'scale)] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
259 ["Span Oldest->Newest" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
260 (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
|
261 (vc-annotate-display-select nil 'fullscale)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
262 :help |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
263 "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
|
264 :style toggle :selected |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
265 (eq vc-annotate-display-mode 'fullscale)] |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
266 "--" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
267 ["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
|
268 :help |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
269 "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
|
270 ["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
|
271 :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
|
272 ["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
|
273 :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
|
274 ["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
|
275 :help |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
276 "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
|
277 ["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
|
278 :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
|
279 ["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
|
280 :help "Visit the annotation of the working revision of this file"] |
96517
b250e775669b
(vc-annotate-mode-menu): Add separator.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96475
diff
changeset
|
281 "--" |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
282 ["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
|
283 :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
|
284 ["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
|
285 :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
|
286 ["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
|
287 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
|
288 :enable |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
289 (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
|
290 :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
|
291 ["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
|
292 :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
|
293 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
294 (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
|
295 "Highlight the output of \\[vc-annotate]. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
296 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
|
297 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
|
298 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
|
299 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
300 (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
|
301 (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
|
302 (cond ((null vc-annotate-display-mode) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
303 ;; 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
|
304 (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
|
305 (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
|
306 ;; One of the auto-scaling modes |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
307 ((eq vc-annotate-display-mode 'scale) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
308 (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
|
309 ((eq vc-annotate-display-mode 'fullscale) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
310 (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
|
311 ((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
|
312 (vc-annotate-display-default |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
313 (/ vc-annotate-display-mode |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
314 (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
|
315 (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
|
316 vc-annotate-display-mode)))) |
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 ;;;###autoload |
109302
60516122d066
Merge changes from emacs-23 branch.
Chong Yidong <cyd@stupidchicken.com>
parents:
109011
diff
changeset
|
319 (defun vc-annotate (file rev &optional display-mode buf move-point-to vc-bk) |
109011
6c39bda25895
Merge from emacs-23
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
320 "Display the edit history of the current FILE using colors. |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
321 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
322 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
|
323 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
|
324 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
|
325 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
|
326 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
|
327 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
|
328 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
329 With a prefix argument, this command asks two questions in the |
109011
6c39bda25895
Merge from emacs-23
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
330 minibuffer. First, you may enter a revision number REV; then the buffer |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
331 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
|
332 \(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
|
333 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
|
334 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
|
335 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
|
336 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
|
337 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
338 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
|
339 |
109302
60516122d066
Merge changes from emacs-23 branch.
Chong Yidong <cyd@stupidchicken.com>
parents:
109011
diff
changeset
|
340 If VC-BK is given used that VC backend. |
60516122d066
Merge changes from emacs-23 branch.
Chong Yidong <cyd@stupidchicken.com>
parents:
109011
diff
changeset
|
341 |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
342 Customization variables: |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
343 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
344 `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
|
345 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
|
346 `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
|
347 `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
|
348 (interactive |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
349 (save-current-buffer |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
350 (vc-ensure-vc-buffer) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
351 (list buffer-file-name |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
352 (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
|
353 (if (null current-prefix-arg) def |
109011
6c39bda25895
Merge from emacs-23
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
354 (vc-read-revision |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
355 (format "Annotate from revision (default %s): " def) |
109011
6c39bda25895
Merge from emacs-23
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108971
diff
changeset
|
356 (list buffer-file-name) nil def))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
357 (if (null current-prefix-arg) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
358 vc-annotate-display-mode |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
359 (float (string-to-number |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
360 (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
|
361 nil nil "20"))))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
362 (vc-ensure-vc-buffer) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
363 (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
|
364 (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
|
365 (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
|
366 ;; 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
|
367 ;; 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
|
368 ;; strange results occasionally in the case of REV != WORKFILE-REV. |
102463
8e50ad0da4e8
(vc-annotate): Use widened line number (Bug#2612).
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
369 (current-line (or move-point-to (unless buf |
8e50ad0da4e8
(vc-annotate): Use widened line number (Bug#2612).
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
370 (save-restriction |
8e50ad0da4e8
(vc-annotate): Use widened line number (Bug#2612).
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
371 (widen) |
8e50ad0da4e8
(vc-annotate): Use widened line number (Bug#2612).
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
372 (line-number-at-pos)))))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
373 (message "Annotating...") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
374 ;; 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
|
375 ;; 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
|
376 ;; 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
|
377 (when buf (with-current-buffer buf |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
378 (rename-buffer temp-buffer-name t) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
379 ;; 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
|
380 (setq temp-buffer-name (buffer-name)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
381 (with-output-to-temp-buffer temp-buffer-name |
109302
60516122d066
Merge changes from emacs-23 branch.
Chong Yidong <cyd@stupidchicken.com>
parents:
109011
diff
changeset
|
382 (let ((backend (or vc-bk (vc-backend file))) |
104949
4fab4cdb3614
* vc-annotate.el (vc-annotate): Use the main file's coding-system to
Juanma Barranquero <lekktu@gmail.com>
parents:
102463
diff
changeset
|
383 (coding-system-for-read buffer-file-coding-system)) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
384 (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
|
385 (get-buffer temp-buffer-name) rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
386 ;; 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
|
387 ;; 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
|
388 ;; with-output-to-temp-buffer |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
389 (with-current-buffer temp-buffer-name |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
390 (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
|
391 (vc-annotate-mode)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
392 (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
|
393 (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
|
394 (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
|
395 (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
|
396 display-mode)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
397 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
398 (with-current-buffer temp-buffer-name |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
399 (vc-exec-after |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
400 `(progn |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
401 ;; 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
|
402 ;; 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
|
403 ;; of the user's cursor :-( |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
404 (when ,current-line ;(and (bobp)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
405 (goto-line ,current-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
406 (setq vc-sentinel-movepoint (point))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
407 (unless (active-minibuffer-window) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
408 (message "Annotating... done"))))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
409 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
410 (defun vc-annotate-prev-revision (prefix) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
411 "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
|
412 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
413 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
|
414 revisions previous." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
415 (interactive "p") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
416 (vc-annotate-warp-revision (- 0 prefix))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
417 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
418 (defun vc-annotate-next-revision (prefix) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
419 "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
|
420 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
421 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
|
422 revisions after." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
423 (interactive "p") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
424 (vc-annotate-warp-revision prefix)) |
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-working-revision () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
427 "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
|
428 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
429 (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
|
430 (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
|
431 (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
|
432 (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
|
433 (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
|
434 (vc-annotate-warp-revision warp-rev))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
435 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
436 (defun vc-annotate-extract-revision-at-line () |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
437 "Extract the revision number of the current line. |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
438 Return a cons (REV . FILENAME)." |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
439 ;; This function must be invoked from a buffer in vc-annotate-mode |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
440 (let ((rev (vc-call-backend vc-annotate-backend |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
441 'annotate-extract-revision-at-line))) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
442 (if (or (null rev) (consp rev)) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
443 rev |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
444 (cons rev vc-annotate-parent-file)))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
445 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
446 (defun vc-annotate-revision-at-line () |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
447 "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
|
448 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
449 (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
|
450 (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
|
451 (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
|
452 (if (not rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
453 (message "Cannot extract revision number from the current line") |
106988
05efa1881381
(vc-annotate-revision-at-line): Compare file
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
454 (if (and (equal (car rev-at-line) vc-annotate-parent-rev) |
05efa1881381
(vc-annotate-revision-at-line): Compare file
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
455 (string= (cdr rev-at-line) vc-annotate-parent-file)) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
456 (message "Already at revision %s" rev-at-line) |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
457 (vc-annotate-warp-revision (car rev-at-line) (cdr rev-at-line))))))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
458 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
459 (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
|
460 "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
|
461 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
462 (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
|
463 (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
|
464 (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
|
465 (if (not rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
466 (message "Cannot extract revision number from the current line") |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
467 (switch-to-buffer-other-window |
109302
60516122d066
Merge changes from emacs-23 branch.
Chong Yidong <cyd@stupidchicken.com>
parents:
109011
diff
changeset
|
468 (vc-find-revision (cdr rev-at-line) (car rev-at-line) vc-annotate-backend)))))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
469 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
470 (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
|
471 "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
|
472 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
473 (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
|
474 (message "Cannot be invoked outside of a vc annotate buffer") |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
475 (let* ((rev-at-line (vc-annotate-extract-revision-at-line)) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
476 (prev-rev nil) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
477 (rev (car rev-at-line)) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
478 (fname (cdr rev-at-line))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
479 (if (not rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
480 (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
|
481 (setq prev-rev |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
482 (vc-call-backend vc-annotate-backend 'previous-revision |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
483 fname rev)) |
106250
456620b3e939
(vc-annotate-revision-previous-to-line): Really use previous revision.
Johan Bockgård <bojohan@gnu.org>
parents:
106157
diff
changeset
|
484 (vc-annotate-warp-revision prev-rev fname))))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
485 |
106517
badae536951d
(log-view-vc-backend, log-view-vc-fileset): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
106472
diff
changeset
|
486 (defvar log-view-vc-backend) |
badae536951d
(log-view-vc-backend, log-view-vc-fileset): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
106472
diff
changeset
|
487 (defvar log-view-vc-fileset) |
badae536951d
(log-view-vc-backend, log-view-vc-fileset): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
106472
diff
changeset
|
488 |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
489 (defun vc-annotate-show-log-revision-at-line () |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
490 "Visit the log of the revision at line. |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
491 If the VC backend supports it, only show the log entry for the revision. |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
492 If a *vc-change-log* buffer exists and already shows a log for |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
493 the file in question, search for the log entry required and move point ." |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
494 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
495 (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
|
496 (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
|
497 (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
|
498 (if (not rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
499 (message "Cannot extract revision number from the current line") |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
500 (let ((backend vc-annotate-backend) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
501 (log-buf (get-buffer "*vc-change-log*")) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
502 pos) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
503 (if (and |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
504 log-buf |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
505 ;; Look for a log buffer that already displays the correct file. |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
506 (with-current-buffer log-buf |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
507 (and (eq backend log-view-vc-backend) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
508 (null (cdr log-view-vc-fileset)) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
509 (string= (car log-view-vc-fileset) (cdr rev-at-line)) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
510 ;; Check if the entry we require can be found. |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
511 (vc-call-backend |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
512 backend 'show-log-entry (car rev-at-line)) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
513 (setq pos (point))))) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
514 (progn |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
515 (pop-to-buffer log-buf) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
516 (goto-char pos)) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
517 ;; Ask the backend to display a single log entry. |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
518 (vc-print-log-internal |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
519 vc-annotate-backend (list (cdr rev-at-line)) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106250
diff
changeset
|
520 (car rev-at-line) t 1))))))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
521 |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
522 (defun vc-annotate-show-diff-revision-at-line-internal (filediff) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
523 (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
|
524 (message "Cannot be invoked outside of a vc annotate buffer") |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
525 (let* ((rev-at-line (vc-annotate-extract-revision-at-line)) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
526 (prev-rev nil) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
527 (rev (car rev-at-line)) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
528 (fname (cdr rev-at-line))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
529 (if (not rev-at-line) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
530 (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
|
531 (setq prev-rev |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
532 (vc-call-backend vc-annotate-backend 'previous-revision |
109302
60516122d066
Merge changes from emacs-23 branch.
Chong Yidong <cyd@stupidchicken.com>
parents:
109011
diff
changeset
|
533 (if filediff fname nil) rev)) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
534 (if (not prev-rev) |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
535 (message "Cannot diff from any revision prior to %s" rev) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
536 (save-window-excursion |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
537 (vc-diff-internal |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
538 nil |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
539 ;; 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
|
540 ;; `vc-deduce-fileset' returns. |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
541 (list vc-annotate-backend |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
542 (if filediff |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
543 (list fname) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
544 nil)) |
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
545 prev-rev rev)) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
546 (switch-to-buffer "*vc-diff*")))))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
547 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
548 (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
|
549 "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
|
550 (interactive) |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
551 (vc-annotate-show-diff-revision-at-line-internal t)) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
552 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
553 (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
|
554 "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
|
555 (interactive) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
556 (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
|
557 (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
|
558 (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
|
559 |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
560 (defun vc-annotate-warp-revision (revspec &optional file) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
561 "Annotate the revision described by REVSPEC. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
562 |
99841
fd7d46b20afe
* allout.el (allout-mode): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96517
diff
changeset
|
563 If REVSPEC is a positive integer, warp that many revisions forward, |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
564 if possible, otherwise echo a warning message. If REVSPEC is a |
99841
fd7d46b20afe
* allout.el (allout-mode): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96517
diff
changeset
|
565 negative integer, warp that many revisions backward, if possible, |
fd7d46b20afe
* allout.el (allout-mode): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96517
diff
changeset
|
566 otherwise echo a warning message. If REVSPEC is a string, then it |
fd7d46b20afe
* allout.el (allout-mode): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96517
diff
changeset
|
567 describes a revision number, so warp to that revision." |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
568 (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
|
569 (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
|
570 (let* ((buf (current-buffer)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
571 (oldline (line-number-at-pos)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
572 (revspeccopy revspec) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
573 (newrev nil)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
574 (cond |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
575 ((and (integerp revspec) (> revspec 0)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
576 (setq newrev vc-annotate-parent-rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
577 (while (and (> revspec 0) newrev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
578 (setq newrev (vc-call-backend vc-annotate-backend 'next-revision |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
579 (or file vc-annotate-parent-file) newrev)) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
580 (setq revspec (1- revspec))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
581 (unless newrev |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
582 (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
|
583 revspeccopy vc-annotate-parent-rev))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
584 ((and (integerp revspec) (< revspec 0)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
585 (setq newrev vc-annotate-parent-rev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
586 (while (and (< revspec 0) newrev) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
587 (setq newrev (vc-call-backend vc-annotate-backend 'previous-revision |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
588 (or file vc-annotate-parent-file) newrev)) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
589 (setq revspec (1+ revspec))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
590 (unless newrev |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
591 (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
|
592 (- 0 revspeccopy) vc-annotate-parent-rev))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
593 ((stringp revspec) (setq newrev revspec)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
594 (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
|
595 (when newrev |
105670
6f463ea7a91a
Make vc-annotate work through copies and renames.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104949
diff
changeset
|
596 (vc-annotate (or file vc-annotate-parent-file) newrev |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
597 vc-annotate-parent-display-mode |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
598 buf |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
599 ;; 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
|
600 ;; place the point in the line. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
601 (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
|
602 (forward-line -1) |
109302
60516122d066
Merge changes from emacs-23 branch.
Chong Yidong <cyd@stupidchicken.com>
parents:
109011
diff
changeset
|
603 (line-number-at-pos))) |
60516122d066
Merge changes from emacs-23 branch.
Chong Yidong <cyd@stupidchicken.com>
parents:
109011
diff
changeset
|
604 vc-annotate-backend))))) |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
605 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
606 (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
|
607 "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
|
608 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
|
609 nil if no such cell exists." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
610 (let ((i 1) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
611 (tmp-cons (car a-list))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
612 (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
|
613 (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
|
614 (setq i (+ i 1))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
615 tmp-cons)) ; Return the appropriate value |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
616 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
617 (defun vc-annotate-convert-time (time) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
618 "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
|
619 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
|
620 `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
|
621 (/ (+ (* (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
|
622 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
623 (defun vc-annotate-difference (&optional offset) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
624 "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
|
625 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
|
626 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
|
627 or OFFSET if present." |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
628 (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
|
629 (when next-time |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
630 (- (or offset |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
631 (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
|
632 next-time)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
633 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
634 (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
|
635 "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
|
636 (vc-annotate-convert-time (current-time))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
637 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
638 (defvar vc-annotate-offset nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
639 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
640 (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
|
641 "Highlight `vc-annotate' output in the current buffer. |
99841
fd7d46b20afe
* allout.el (allout-mode): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96517
diff
changeset
|
642 RATIO is the expansion that should be applied to `vc-annotate-color-map'. |
96202
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
643 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
|
644 (when (/= ratio 1.0) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
645 (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
|
646 (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
|
647 vc-annotate-color-map))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
648 (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
|
649 (font-lock-mode 1)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
650 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
651 (defun vc-annotate-lines (limit) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
652 (while (< (point) limit) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
653 (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
|
654 (start (point)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
655 (end (progn (forward-line 1) (point)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
656 (when difference |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
657 (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
|
658 (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
|
659 ;; 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
|
660 (face-name (concat "vc-annotate-face-" |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
661 (if (string-equal |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
662 (substring (cdr color) 0 1) "#") |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
663 (substring (cdr color) 1) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
664 (cdr color)))) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
665 ;; Make the face if not done. |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
666 (face (or (intern-soft face-name) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
667 (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
|
668 (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
|
669 (when vc-annotate-background |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
670 (set-face-background tmp-face |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
671 vc-annotate-background)) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
672 tmp-face)))) ; Return the face |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
673 (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
|
674 ;; 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
|
675 nil) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
676 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
677 (provide 'vc-annotate) |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
678 |
2bd68cb03fe1
* vc.el: Move vc-annotate variables and functions ...
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff
changeset
|
679 ;;; vc-annotate.el ends here |