comparison lisp/vc.el @ 83022:abaf78268f22

Merged in changes from CVS HEAD Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-51 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-52 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-62
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 23 Jan 2004 21:51:08 +0000
parents 82c3b4da43ca 97c8dfb8be3d
children 03a73693678e
comparison
equal deleted inserted replaced
83021:32bf8e7cc0c2 83022:abaf78268f22
5 5
6 ;; Author: FSF (see below for full credits) 6 ;; Author: FSF (see below for full credits)
7 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> 7 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
8 ;; Keywords: tools 8 ;; Keywords: tools
9 9
10 ;; $Id: vc.el,v 1.363 2004/01/21 11:05:51 uid65624 Exp $ 10 ;; $Id: vc.el,v 1.365 2004/01/23 11:20:55 uid65624 Exp $
11 11
12 ;; This file is part of GNU Emacs. 12 ;; This file is part of GNU Emacs.
13 13
14 ;; GNU Emacs is free software; you can redistribute it and/or modify 14 ;; GNU Emacs is free software; you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by 15 ;; it under the terms of the GNU General Public License as published by
2814 2814
2815 ;; internal buffer-local variables 2815 ;; internal buffer-local variables
2816 (defvar vc-annotate-parent-file nil) 2816 (defvar vc-annotate-parent-file nil)
2817 (defvar vc-annotate-parent-rev nil) 2817 (defvar vc-annotate-parent-rev nil)
2818 (defvar vc-annotate-parent-display-mode nil) 2818 (defvar vc-annotate-parent-display-mode nil)
2819 (make-local-variable 'vc-annotate-parent-file)
2820 (make-local-variable 'vc-annotate-parent-rev)
2821 (make-local-variable 'vc-annotate-parent-display-mode)
2822 2819
2823 (defconst vc-annotate-font-lock-keywords 2820 (defconst vc-annotate-font-lock-keywords
2824 ;; The fontification is done by vc-annotate-lines instead of font-lock. 2821 ;; The fontification is done by vc-annotate-lines instead of font-lock.
2825 '((vc-annotate-lines))) 2822 '((vc-annotate-lines)))
2826 2823
3036 buffer-file-name 3033 buffer-file-name
3037 (get-buffer temp-buffer-name) 3034 (get-buffer temp-buffer-name)
3038 vc-annotate-version)) 3035 vc-annotate-version))
3039 (save-excursion 3036 (save-excursion
3040 (set-buffer temp-buffer-name) 3037 (set-buffer temp-buffer-name)
3041 (setq vc-annotate-parent-file bfn) 3038 (set (make-local-variable 'vc-annotate-parent-file) bfn)
3042 (setq vc-annotate-parent-rev vc-annotate-version) 3039 (set (make-local-variable 'vc-annotate-parent-rev) vc-annotate-version)
3043 (setq vc-annotate-parent-display-mode vc-annotate-display-mode)) 3040 (set (make-local-variable 'vc-annotate-parent-display-mode)
3041 vc-annotate-display-mode))
3044 3042
3045 ;; Don't use the temp-buffer-name until the buffer is created 3043 ;; Don't use the temp-buffer-name until the buffer is created
3046 ;; (only after `with-output-to-temp-buffer'.) 3044 ;; (only after `with-output-to-temp-buffer'.)
3047 (setq vc-annotate-buffers 3045 (setq vc-annotate-buffers
3048 (append vc-annotate-buffers 3046 (append vc-annotate-buffers
3133 (message "Cannot diff from any version prior to %s" rev-at-line) 3131 (message "Cannot diff from any version prior to %s" rev-at-line)
3134 (save-window-excursion 3132 (save-window-excursion
3135 (vc-version-diff vc-annotate-parent-file prev-rev rev-at-line)) 3133 (vc-version-diff vc-annotate-parent-file prev-rev rev-at-line))
3136 (switch-to-buffer "*vc-diff*")))))) 3134 (switch-to-buffer "*vc-diff*"))))))
3137 3135
3138 (defun vc-current-line ()
3139 "Return the current buffer's line number."
3140 (let ((oldpoint (point)) start)
3141 (save-excursion
3142 (save-restriction
3143 (goto-char (point-min))
3144 (widen)
3145 (forward-line 0)
3146 (setq start (point))
3147 (goto-char oldpoint)
3148 (forward-line 0)
3149 (1+ (count-lines (point-min) (point)))))))
3150
3151 (defun vc-annotate-warp-version (revspec) 3136 (defun vc-annotate-warp-version (revspec)
3152 "Annotate the version described by REVSPEC. 3137 "Annotate the version described by REVSPEC.
3153 3138
3154 If REVSPEC is a positive integer, warp that many versions 3139 If REVSPEC is a positive integer, warp that many versions
3155 forward, if possible, otherwise echo a warning message. If 3140 forward, if possible, otherwise echo a warning message. If
3157 if possible, otherwise echo a warning message. If REVSPEC is a 3142 if possible, otherwise echo a warning message. If REVSPEC is a
3158 string, then it describes a revision number, so warp to that 3143 string, then it describes a revision number, so warp to that
3159 revision." 3144 revision."
3160 (if (not (equal major-mode 'vc-annotate-mode)) 3145 (if (not (equal major-mode 'vc-annotate-mode))
3161 (message "Cannot be invoked outside of a vc annotate buffer") 3146 (message "Cannot be invoked outside of a vc annotate buffer")
3162 (let* ((oldline (vc-current-line)) 3147 (let* ((oldline (line-at-pos))
3163 (revspeccopy revspec) 3148 (revspeccopy revspec)
3164 (newrev nil)) 3149 (newrev nil))
3165 (cond 3150 (cond
3166 ((and (integerp revspec) (> revspec 0)) 3151 ((and (integerp revspec) (> revspec 0))
3167 (setq newrev vc-annotate-parent-rev) 3152 (setq newrev vc-annotate-parent-rev)
3189 (vc-annotate nil newrev vc-annotate-parent-display-mode)) 3174 (vc-annotate nil newrev vc-annotate-parent-display-mode))
3190 (kill-buffer (current-buffer)) ;; kill the buffer we started from 3175 (kill-buffer (current-buffer)) ;; kill the buffer we started from
3191 (switch-to-buffer (car (car (last vc-annotate-buffers)))) 3176 (switch-to-buffer (car (car (last vc-annotate-buffers))))
3192 (goto-line (min oldline (progn (goto-char (point-max)) 3177 (goto-line (min oldline (progn (goto-char (point-max))
3193 (previous-line) 3178 (previous-line)
3194 (vc-current-line)))))))) 3179 (line-at-pos))))))))
3195 3180
3196 (defun vc-annotate-car-last-cons (a-list) 3181 (defun vc-annotate-car-last-cons (a-list)
3197 "Return car of last cons in association list A-LIST." 3182 "Return car of last cons in association list A-LIST."
3198 (if (not (eq nil (cdr a-list))) 3183 (if (not (eq nil (cdr a-list)))
3199 (vc-annotate-car-last-cons (cdr a-list)) 3184 (vc-annotate-car-last-cons (cdr a-list))