Mercurial > emacs
comparison lisp/vc.el @ 40958:4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
set-buffer-modified-p to nil after `vc-exec-after'.
* log-view.el (log-view-mode-map): Bind "q", "z", "m" and "d".
(log-view-mode): Make read-only.
(log-view-current-file): Do final `expand-file-name' in the
current `default-directory'.
(log-view-current-tag): Take an optional `where' arg.
(log-view-diff): New user command.
author | Sam Steingold <sds@gnu.org> |
---|---|
date | Mon, 12 Nov 2001 23:01:17 +0000 |
parents | f5a9c609626a |
children | cb1ebde1c4c9 |
comparison
equal
deleted
inserted
replaced
40957:721d19071a5f | 40958:4b4504c5aa56 |
---|---|
4 | 4 |
5 ;; Author: FSF (see below for full credits) | 5 ;; Author: FSF (see below for full credits) |
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
7 ;; Keywords: tools | 7 ;; Keywords: tools |
8 | 8 |
9 ;; $Id: vc.el,v 1.317 2001/10/29 12:26:15 spiegel Exp $ | 9 ;; $Id: vc.el,v 1.318 2001/11/09 14:55:52 spiegel Exp $ |
10 | 10 |
11 ;; This file is part of GNU Emacs. | 11 ;; This file is part of GNU Emacs. |
12 | 12 |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | 13 ;; GNU Emacs is free software; you can redistribute it and/or modify |
14 ;; it under the terms of the GNU General Public License as published by | 14 ;; it under the terms of the GNU General Public License as published by |
88 ;; do not generally need to be aware of these properties. For example, | 88 ;; do not generally need to be aware of these properties. For example, |
89 ;; `vc-sys-workfile-version' should compute the workfile version and | 89 ;; `vc-sys-workfile-version' should compute the workfile version and |
90 ;; return it; it should not look it up in the property, and it needn't | 90 ;; return it; it should not look it up in the property, and it needn't |
91 ;; store it there either. However, if a backend-specific function does | 91 ;; store it there either. However, if a backend-specific function does |
92 ;; store a value in a property, that value takes precedence over any | 92 ;; store a value in a property, that value takes precedence over any |
93 ;; value that the generic code might want to set (check for uses of | 93 ;; value that the generic code might want to set (check for uses of |
94 ;; the macro `with-vc-properties' in vc.el). | 94 ;; the macro `with-vc-properties' in vc.el). |
95 ;; | 95 ;; |
96 ;; In the list of functions below, each identifier needs to be prepended | 96 ;; In the list of functions below, each identifier needs to be prepended |
97 ;; with `vc-sys-'. Some of the functions are mandatory (marked with a | 97 ;; with `vc-sys-'. Some of the functions are mandatory (marked with a |
98 ;; `*'), others are optional (`-'). | 98 ;; `*'), others are optional (`-'). |
101 ;; | 101 ;; |
102 ;; * registered (file) | 102 ;; * registered (file) |
103 ;; | 103 ;; |
104 ;; Return non-nil if FILE is registered in this backend. | 104 ;; Return non-nil if FILE is registered in this backend. |
105 ;; | 105 ;; |
106 ;; * state (file) | 106 ;; * state (file) |
107 ;; | 107 ;; |
108 ;; Return the current version control state of FILE. For a list of | 108 ;; Return the current version control state of FILE. For a list of |
109 ;; possible values, see `vc-state'. This function should do a full and | 109 ;; possible values, see `vc-state'. This function should do a full and |
110 ;; reliable state computation; it is usually called immediately after | 110 ;; reliable state computation; it is usually called immediately after |
111 ;; C-x v v. If you want to use a faster heuristic when visiting a | 111 ;; C-x v v. If you want to use a faster heuristic when visiting a |
294 ;; pass the value of (vc-diff-switches-list BACKEND) to the backend | 294 ;; pass the value of (vc-diff-switches-list BACKEND) to the backend |
295 ;; command. It should return a status of either 0 (no differences | 295 ;; command. It should return a status of either 0 (no differences |
296 ;; found), or 1 (either non-empty diff or the diff is run | 296 ;; found), or 1 (either non-empty diff or the diff is run |
297 ;; asynchronously). | 297 ;; asynchronously). |
298 ;; | 298 ;; |
299 ;; - diff-tree (dir &optional rev1 rev2) | 299 ;; - diff-tree (dir &optional rev1 rev2) |
300 ;; | 300 ;; |
301 ;; Insert the diff for all files at and below DIR into the *vc-diff* | 301 ;; Insert the diff for all files at and below DIR into the *vc-diff* |
302 ;; buffer. The meaning of REV1 and REV2 is the same as for | 302 ;; buffer. The meaning of REV1 and REV2 is the same as for |
303 ;; vc-BACKEND-diff. The default implementation does an explicit tree | 303 ;; vc-BACKEND-diff. The default implementation does an explicit tree |
304 ;; walk, calling vc-BACKEND-diff for each individual file. | 304 ;; walk, calling vc-BACKEND-diff for each individual file. |
305 ;; | 305 ;; |
306 ;; - annotate-command (file buf rev) | 306 ;; - annotate-command (file buf rev) |
307 ;; | 307 ;; |
562 (260. . "#00FFA1") | 562 (260. . "#00FFA1") |
563 (280. . "#00FFD9") | 563 (280. . "#00FFD9") |
564 (300. . "#00EEFF") | 564 (300. . "#00EEFF") |
565 (320. . "#00B6FF") | 565 (320. . "#00B6FF") |
566 (340. . "#007EFF")) | 566 (340. . "#007EFF")) |
567 "*ASSOCIATION list of age versus color, for \\[vc-annotate]. | 567 "*ASSOCIATION list of age versus color, for \\[vc-annotate]. |
568 Ages are given in units of fractional days. Default is eighteen steps | 568 Ages are given in units of fractional days. Default is eighteen steps |
569 using a twenty day increment." | 569 using a twenty day increment." |
570 :type 'alist | 570 :type 'alist |
571 :group 'vc) | 571 :group 'vc) |
572 | 572 |
1059 (defun vc-default-workfile-unchanged-p (backend file) | 1059 (defun vc-default-workfile-unchanged-p (backend file) |
1060 "Default check whether FILE is unchanged: diff against master version." | 1060 "Default check whether FILE is unchanged: diff against master version." |
1061 (zerop (vc-call diff file (vc-workfile-version file)))) | 1061 (zerop (vc-call diff file (vc-workfile-version file)))) |
1062 | 1062 |
1063 (defun vc-default-latest-on-branch-p (backend file) | 1063 (defun vc-default-latest-on-branch-p (backend file) |
1064 "Default check whether the current workfile version of FILE is the | 1064 "Default check whether the current workfile version of FILE is the |
1065 latest on its branch." | 1065 latest on its branch." |
1066 t) | 1066 t) |
1067 | 1067 |
1068 (defun vc-recompute-state (file) | 1068 (defun vc-recompute-state (file) |
1069 "Force a recomputation of the version control state of FILE. | 1069 "Force a recomputation of the version control state of FILE. |
1830 (list (file-relative-name file-rel1) | 1830 (list (file-relative-name file-rel1) |
1831 (file-relative-name file-rel2)))) | 1831 (file-relative-name file-rel2)))) |
1832 (vc-call diff file rel1 rel2)))) | 1832 (vc-call diff file rel1 rel2)))) |
1833 | 1833 |
1834 (defmacro vc-diff-switches-list (backend) | 1834 (defmacro vc-diff-switches-list (backend) |
1835 "Make a list of `diff-switches', `vc-diff-switches', | 1835 "Make a list of `diff-switches', `vc-diff-switches', |
1836 and `vc-BACKEND-diff-switches'." | 1836 and `vc-BACKEND-diff-switches'." |
1837 `(append | 1837 `(append |
1838 (if (listp diff-switches) diff-switches (list diff-switches)) | 1838 (if (listp diff-switches) diff-switches (list diff-switches)) |
1839 (if (listp vc-diff-switches) vc-diff-switches (list vc-diff-switches)) | 1839 (if (listp vc-diff-switches) vc-diff-switches (list vc-diff-switches)) |
1840 (let ((backend-switches | 1840 (let ((backend-switches |
1841 (eval (intern (concat "vc-" (symbol-name ',backend) | 1841 (eval (intern (concat "vc-" (symbol-name ',backend) |
1842 "-diff-switches"))))) | 1842 "-diff-switches"))))) |
1843 (if (listp backend-switches) backend-switches (list backend-switches))))) | 1843 (if (listp backend-switches) backend-switches (list backend-switches))))) |
1844 | 1844 |
1845 (defun vc-default-diff-tree (backend dir rel1 rel2) | 1845 (defun vc-default-diff-tree (backend dir rel1 rel2) |
1846 "Default implementation for diffing an entire tree at and below DIR. | 1846 "Default implementation for diffing an entire tree at and below DIR. |
1847 The meaning of REL1 and REL2 is the same as for `vc-version-diff'." | 1847 The meaning of REL1 and REL2 is the same as for `vc-version-diff'." |
1848 ;; This implementation does an explicit tree walk, and calls | 1848 ;; This implementation does an explicit tree walk, and calls |
1849 ;; vc-BACKEND-diff directly for each file. An optimization | 1849 ;; vc-BACKEND-diff directly for each file. An optimization |
1850 ;; would be to use `vc-diff-internal', so that diffs can be local, | 1850 ;; would be to use `vc-diff-internal', so that diffs can be local, |
1851 ;; and to call it only for files that are actually changed. | 1851 ;; and to call it only for files that are actually changed. |
1852 ;; However, this is expensive for some backends, and so it is left | 1852 ;; However, this is expensive for some backends, and so it is left |
1853 ;; to backend-specific implementations. | 1853 ;; to backend-specific implementations. |
1854 (setq default-directory dir) | 1854 (setq default-directory dir) |
1855 (vc-file-tree-walk | 1855 (vc-file-tree-walk |
1856 default-directory | 1856 default-directory |
1857 (lambda (f) | 1857 (lambda (f) |
1858 (vc-exec-after | 1858 (vc-exec-after |
1859 `(let ((coding-system-for-read (vc-coding-system-for-diff ',f))) | 1859 `(let ((coding-system-for-read (vc-coding-system-for-diff ',f))) |
1860 (message "Looking at %s" ',f) | 1860 (message "Looking at %s" ',f) |
1861 (vc-call-backend ',(vc-backend f) | 1861 (vc-call-backend ',(vc-backend f) |
1862 'diff ',f ',rel1 ',rel2)))))) | 1862 'diff ',f ',rel1 ',rel2)))))) |
1863 | 1863 |
1864 (defun vc-coding-system-for-diff (file) | 1864 (defun vc-coding-system-for-diff (file) |
1865 "Return the coding system for reading diff output for FILE." | 1865 "Return the coding system for reading diff output for FILE." |
1866 (or coding-system-for-read | 1866 (or coding-system-for-read |
1867 ;; if we already have this file open, | 1867 ;; if we already have this file open, |
1868 ;; use the buffer's coding system | 1868 ;; use the buffer's coding system |
1869 (let ((buf (find-buffer-visiting file))) | 1869 (let ((buf (find-buffer-visiting file))) |
1870 (if buf (with-current-buffer buf | 1870 (if buf (with-current-buffer buf |
1871 buffer-file-coding-system))) | 1871 buffer-file-coding-system))) |
1872 ;; otherwise, try to find one based on the file name | 1872 ;; otherwise, try to find one based on the file name |
2436 (vc-call print-log file) | 2436 (vc-call print-log file) |
2437 (set-buffer "*vc*") | 2437 (set-buffer "*vc*") |
2438 (pop-to-buffer (current-buffer)) | 2438 (pop-to-buffer (current-buffer)) |
2439 (if (fboundp 'log-view-mode) (log-view-mode)) | 2439 (if (fboundp 'log-view-mode) (log-view-mode)) |
2440 (vc-exec-after | 2440 (vc-exec-after |
2441 `(progn | 2441 `(let ((inhibit-read-only t)) |
2442 (goto-char (point-max)) (forward-line -1) | 2442 (goto-char (point-max)) (forward-line -1) |
2443 (while (looking-at "=*\n") | 2443 (while (looking-at "=*\n") |
2444 (delete-char (- (match-end 0) (match-beginning 0))) | 2444 (delete-char (- (match-end 0) (match-beginning 0))) |
2445 (forward-line -1)) | 2445 (forward-line -1)) |
2446 (goto-char (point-min)) | 2446 (goto-char (point-min)) |
2451 (if (fboundp 'log-view-goto-rev) | 2451 (if (fboundp 'log-view-goto-rev) |
2452 (log-view-goto-rev ',(vc-workfile-version file)) | 2452 (log-view-goto-rev ',(vc-workfile-version file)) |
2453 (if (vc-find-backend-function ',(vc-backend file) 'show-log-entry) | 2453 (if (vc-find-backend-function ',(vc-backend file) 'show-log-entry) |
2454 (vc-call-backend ',(vc-backend file) | 2454 (vc-call-backend ',(vc-backend file) |
2455 'show-log-entry | 2455 'show-log-entry |
2456 ',(vc-workfile-version file)))))))) | 2456 ',(vc-workfile-version file)))) |
2457 (set-buffer-modified-p nil))))) | |
2457 | 2458 |
2458 (defun vc-default-comment-history (backend file) | 2459 (defun vc-default-comment-history (backend file) |
2459 "Return a string with all log entries that were made under BACKEND for FILE." | 2460 "Return a string with all log entries that were made under BACKEND for FILE." |
2460 (if (vc-find-backend-function backend 'print-log) | 2461 (if (vc-find-backend-function backend 'print-log) |
2461 (with-temp-buffer | 2462 (with-temp-buffer |
2881 (defun vc-annotate-display-default (&optional ratio) | 2882 (defun vc-annotate-display-default (&optional ratio) |
2882 "Use the default color spectrum for VC Annotate mode, scaling the | 2883 "Use the default color spectrum for VC Annotate mode, scaling the |
2883 colormap by RATIO, if present. Use the current time as offset." | 2884 colormap by RATIO, if present. Use the current time as offset." |
2884 (interactive "e") | 2885 (interactive "e") |
2885 (message "Redisplaying annotation...") | 2886 (message "Redisplaying annotation...") |
2886 (vc-annotate-display | 2887 (vc-annotate-display |
2887 (if ratio (vc-annotate-time-span vc-annotate-color-map ratio))) | 2888 (if ratio (vc-annotate-time-span vc-annotate-color-map ratio))) |
2888 (message "Redisplaying annotation...done")) | 2889 (message "Redisplaying annotation...done")) |
2889 | 2890 |
2890 (defun vc-annotate-display-autoscale (&optional full) | 2891 (defun vc-annotate-display-autoscale (&optional full) |
2891 "Re-display annotation using colormap scaled from the current time | 2892 "Re-display annotation using colormap scaled from the current time |
2906 (if (< date oldest) | 2907 (if (< date oldest) |
2907 (setq oldest date)))) | 2908 (setq oldest date)))) |
2908 (vc-annotate-display | 2909 (vc-annotate-display |
2909 (vc-annotate-time-span ;return the scaled colormap. | 2910 (vc-annotate-time-span ;return the scaled colormap. |
2910 vc-annotate-color-map | 2911 vc-annotate-color-map |
2911 (/ (- (if full newest current) oldest) | 2912 (/ (- (if full newest current) oldest) |
2912 (vc-annotate-car-last-cons vc-annotate-color-map))) | 2913 (vc-annotate-car-last-cons vc-annotate-color-map))) |
2913 (if full newest)) | 2914 (if full newest)) |
2914 (message "Redisplaying annotation...done \(%s\)" | 2915 (message "Redisplaying annotation...done \(%s\)" |
2915 (if full | 2916 (if full |
2916 (format "Spanned from %.1f to %.1f days old" | 2917 (format "Spanned from %.1f to %.1f days old" |
2917 (- current oldest) | 2918 (- current oldest) |
2918 (- current newest)) | 2919 (- current newest)) |
2919 (format "Spanned to %.1f days old" (- current oldest)))))) | 2920 (format "Spanned to %.1f days old" (- current oldest)))))) |
2920 | 2921 |
2921 ;; Menu -- Using easymenu.el | 2922 ;; Menu -- Using easymenu.el |
2931 (oldest-in-map (vc-annotate-car-last-cons vc-annotate-color-map))) | 2932 (oldest-in-map (vc-annotate-car-last-cons vc-annotate-color-map))) |
2932 (while menu-elements | 2933 (while menu-elements |
2933 (let* ((element (car menu-elements)) | 2934 (let* ((element (car menu-elements)) |
2934 (days (* element oldest-in-map))) | 2935 (days (* element oldest-in-map))) |
2935 (setq menu-elements (cdr menu-elements)) | 2936 (setq menu-elements (cdr menu-elements)) |
2936 (setq menu-def | 2937 (setq menu-def |
2937 (append menu-def | 2938 (append menu-def |
2938 `([,(format "Span %.1f days" days) | 2939 `([,(format "Span %.1f days" days) |
2939 (unless (and (numberp vc-annotate-display-mode) | 2940 (unless (and (numberp vc-annotate-display-mode) |
2940 (= vc-annotate-display-mode ,days)) | 2941 (= vc-annotate-display-mode ,days)) |
2941 (vc-annotate-display-select nil ,days)) | 2942 (vc-annotate-display-select nil ,days)) |
2942 :style toggle :selected | 2943 :style toggle :selected |
2943 (and (numberp vc-annotate-display-mode) | 2944 (and (numberp vc-annotate-display-mode) |
2944 (= vc-annotate-display-mode ,days)) ]))))) | 2945 (= vc-annotate-display-mode ,days)) ]))))) |
2945 (setq menu-def | 2946 (setq menu-def |
2946 (append menu-def | 2947 (append menu-def |
2947 (list | 2948 (list |
2948 ["Span ..." | 2949 ["Span ..." |
2949 (let ((days | 2950 (let ((days |
2950 (float (string-to-number | 2951 (float (string-to-number |
2951 (read-string "Span how many days? "))))) | 2952 (read-string "Span how many days? "))))) |
2952 (vc-annotate-display-select nil days)) t]) | 2953 (vc-annotate-display-select nil days)) t]) |
2953 (list "--") | 2954 (list "--") |
2954 (list | 2955 (list |
2955 ["Span to Oldest" | 2956 ["Span to Oldest" |
2956 (unless (eq vc-annotate-display-mode 'scale) | 2957 (unless (eq vc-annotate-display-mode 'scale) |
2957 (vc-annotate-display-select nil 'scale)) | 2958 (vc-annotate-display-select nil 'scale)) |
2958 :style toggle :selected | 2959 :style toggle :selected |
2959 (eq vc-annotate-display-mode 'scale)]) | 2960 (eq vc-annotate-display-mode 'scale)]) |
2960 (list | 2961 (list |
2961 ["Span Oldest->Newest" | 2962 ["Span Oldest->Newest" |
2962 (unless (eq vc-annotate-display-mode 'fullscale) | 2963 (unless (eq vc-annotate-display-mode 'fullscale) |
2963 (vc-annotate-display-select nil 'fullscale)) | 2964 (vc-annotate-display-select nil 'fullscale)) |
2964 :style toggle :selected | 2965 :style toggle :selected |
2965 (eq vc-annotate-display-mode 'fullscale)]))) | 2966 (eq vc-annotate-display-mode 'fullscale)]))) |
2966 ;; Define the menu | 2967 ;; Define the menu |
2967 (if (or (featurep 'easymenu) (load "easymenu" t)) | 2968 (if (or (featurep 'easymenu) (load "easymenu" t)) |
2968 (easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map | 2969 (easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map |
2969 "VC Annotate Display Menu" menu-def)))) | 2970 "VC Annotate Display Menu" menu-def)))) |
2970 | 2971 |
2971 (defun vc-annotate-display-select (&optional buffer mode) | 2972 (defun vc-annotate-display-select (&optional buffer mode) |
2972 "Do the default or chosen annotation display as specified in the | 2973 "Do the default or chosen annotation display as specified in the |
2973 customizable variable `vc-annotate-display-mode'." | 2974 customizable variable `vc-annotate-display-mode'." |
2976 (when buffer | 2977 (when buffer |
2977 (set-buffer buffer) | 2978 (set-buffer buffer) |
2978 (display-buffer buffer)) | 2979 (display-buffer buffer)) |
2979 (if (not vc-annotate-mode) ; Turn on vc-annotate-mode if not done | 2980 (if (not vc-annotate-mode) ; Turn on vc-annotate-mode if not done |
2980 (vc-annotate-mode)) | 2981 (vc-annotate-mode)) |
2981 (cond ((null vc-annotate-display-mode) (vc-annotate-display-default | 2982 (cond ((null vc-annotate-display-mode) (vc-annotate-display-default |
2982 vc-annotate-ratio)) | 2983 vc-annotate-ratio)) |
2983 ((symbolp vc-annotate-display-mode) ; One of the auto-scaling modes | 2984 ((symbolp vc-annotate-display-mode) ; One of the auto-scaling modes |
2984 (cond ((eq vc-annotate-display-mode 'scale) | 2985 (cond ((eq vc-annotate-display-mode 'scale) |
2985 (vc-annotate-display-autoscale)) | 2986 (vc-annotate-display-autoscale)) |
2986 ((eq vc-annotate-display-mode 'fullscale) | 2987 ((eq vc-annotate-display-mode 'fullscale) |
2987 (vc-annotate-display-autoscale t)) | 2988 (vc-annotate-display-autoscale t)) |
2988 (t (error "No such display mode: %s" | 2989 (t (error "No such display mode: %s" |
2989 vc-annotate-display-mode)))) | 2990 vc-annotate-display-mode)))) |
2990 ((numberp vc-annotate-display-mode) ; A fixed number of days lookback | 2991 ((numberp vc-annotate-display-mode) ; A fixed number of days lookback |
2991 (vc-annotate-display-default | 2992 (vc-annotate-display-default |
2992 (/ vc-annotate-display-mode (vc-annotate-car-last-cons | 2993 (/ vc-annotate-display-mode (vc-annotate-car-last-cons |
2993 vc-annotate-color-map)))) | 2994 vc-annotate-color-map)))) |
2994 (t (error "Error in display mode select")))) | 2995 (t (error "Error in display mode select")))) |
2995 | 2996 |
2996 ;;;; (defun vc-BACKEND-annotate-command (file buffer) ...) | 2997 ;;;; (defun vc-BACKEND-annotate-command (file buffer) ...) |
2997 ;;;; Execute "annotate" on FILE by using `call-process' and insert | 2998 ;;;; Execute "annotate" on FILE by using `call-process' and insert |
3026 (interactive "P") | 3027 (interactive "P") |
3027 (vc-ensure-vc-buffer) | 3028 (vc-ensure-vc-buffer) |
3028 (let* ((temp-buffer-name (concat "*Annotate " (buffer-name) "*")) | 3029 (let* ((temp-buffer-name (concat "*Annotate " (buffer-name) "*")) |
3029 (temp-buffer-show-function 'vc-annotate-display-select) | 3030 (temp-buffer-show-function 'vc-annotate-display-select) |
3030 (rev (vc-workfile-version (buffer-file-name))) | 3031 (rev (vc-workfile-version (buffer-file-name))) |
3031 (vc-annotate-version | 3032 (vc-annotate-version |
3032 (if prefix (read-string | 3033 (if prefix (read-string |
3033 (format "Annotate from version: (default %s) " rev) | 3034 (format "Annotate from version: (default %s) " rev) |
3034 nil nil rev) | 3035 nil nil rev) |
3035 rev))) | 3036 rev))) |
3036 (if prefix | 3037 (if prefix |
3037 (setq vc-annotate-display-mode | 3038 (setq vc-annotate-display-mode |
3038 (float (string-to-number | 3039 (float (string-to-number |
3039 (read-string "Annotate span days: (default 20) " | 3040 (read-string "Annotate span days: (default 20) " |
3040 nil nil "20"))))) | 3041 nil nil "20"))))) |
3041 (setq vc-annotate-backend (vc-backend (buffer-file-name))) | 3042 (setq vc-annotate-backend (vc-backend (buffer-file-name))) |
3042 (message "Annotating...") | 3043 (message "Annotating...") |
3043 (if (not (vc-find-backend-function vc-annotate-backend 'annotate-command)) | 3044 (if (not (vc-find-backend-function vc-annotate-backend 'annotate-command)) |
3044 (error "Sorry, annotating is not implemented for %s" | 3045 (error "Sorry, annotating is not implemented for %s" |
3096 "Calculate the difference, in days, from the current time and the | 3097 "Calculate the difference, in days, from the current time and the |
3097 time returned from the backend function annotate-time. If OFFSET is | 3098 time returned from the backend function annotate-time. If OFFSET is |
3098 set, use it as the time base instead of the current time." | 3099 set, use it as the time base instead of the current time." |
3099 (let ((next-time (vc-call-backend vc-annotate-backend 'annotate-time))) | 3100 (let ((next-time (vc-call-backend vc-annotate-backend 'annotate-time))) |
3100 (if next-time | 3101 (if next-time |
3101 (- (or offset | 3102 (- (or offset |
3102 (vc-call-backend vc-annotate-backend 'annotate-current-time)) | 3103 (vc-call-backend vc-annotate-backend 'annotate-current-time)) |
3103 next-time)))) | 3104 next-time)))) |
3104 | 3105 |
3105 (defun vc-default-annotate-current-time (backend) | 3106 (defun vc-default-annotate-current-time (backend) |
3106 "Return the current time, encoded as fractional days." | 3107 "Return the current time, encoded as fractional days." |
3107 (vc-annotate-convert-time (current-time))) | 3108 (vc-annotate-convert-time (current-time))) |
3108 | 3109 |
3109 (defun vc-annotate-display (&optional color-map offset) | 3110 (defun vc-annotate-display (&optional color-map offset) |
3110 "Do the VC-Annotate display in BUFFER using COLOR-MAP, and time | 3111 "Do the VC-Annotate display in BUFFER using COLOR-MAP, and time |
3111 offset OFFSET (defaults to the present time). You probably want | 3112 offset OFFSET (defaults to the present time). You probably want |
3112 `vc-annotate-select' instead, after setting | 3113 `vc-annotate-select' instead, after setting |
3113 `vc-annotate-display-mode'" | 3114 `vc-annotate-display-mode'" |
3131 ;; Make the face if not done. | 3132 ;; Make the face if not done. |
3132 (face (or (intern-soft face-name) | 3133 (face (or (intern-soft face-name) |
3133 (let ((tmp-face (make-face (intern face-name)))) | 3134 (let ((tmp-face (make-face (intern face-name)))) |
3134 (set-face-foreground tmp-face (cdr color)) | 3135 (set-face-foreground tmp-face (cdr color)) |
3135 (if vc-annotate-background | 3136 (if vc-annotate-background |
3136 (set-face-background tmp-face | 3137 (set-face-background tmp-face |
3137 vc-annotate-background)) | 3138 vc-annotate-background)) |
3138 tmp-face))) ; Return the face | 3139 tmp-face))) ; Return the face |
3139 (point (point)) | 3140 (point (point)) |
3140 overlay) | 3141 overlay) |
3141 (forward-line 1) | 3142 (forward-line 1) |