comparison lisp/vc.el @ 33546:4f99fed47d24

(vc-annotate): Changed handling of prefix arg; now asks for both version and ratio in the minibuffer.
author André Spiegel <spiegel@gnu.org>
date Thu, 16 Nov 2000 13:39:10 +0000
parents c558cd950ace
children 714a4c4917cd
comparison
equal deleted inserted replaced
33545:5411250e7971 33546:4f99fed47d24
3 ;; Copyright (C) 1992,93,94,95,96,97,98,2000 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992,93,94,95,96,97,98,2000 Free Software Foundation, Inc.
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 7
8 ;; $Id: vc.el,v 1.284 2000/10/26 20:53:11 monnier Exp $ 8 ;; $Id: vc.el,v 1.285 2000/10/27 12:13:19 spiegel Exp $
9 9
10 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
11 11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify 12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by 13 ;; it under the terms of the GNU General Public License as published by
145 ;; Find changelog entries for FILES, or for all files at or below 145 ;; Find changelog entries for FILES, or for all files at or below
146 ;; the default-directory if FILES is nil. 146 ;; the default-directory if FILES is nil.
147 ;; * latest-on-branch-p (file) 147 ;; * latest-on-branch-p (file)
148 ;; - cancel-version (file writable) 148 ;; - cancel-version (file writable)
149 ;; - rename-file (old new) 149 ;; - rename-file (old new)
150 ;; - annotate-command (file buf) 150 ;; - annotate-command (file buf rev)
151 ;; - annotate-difference (pos) 151 ;; - annotate-difference (pos)
152 ;; Only required if `annotate-command' is defined for the backend. 152 ;; Only required if `annotate-command' is defined for the backend.
153 153
154 (require 'vc-hooks) 154 (require 'vc-hooks)
155 (require 'ring) 155 (require 'ring)
2610 ;;;; (defun vc-BACKEND-annotate-command (file buffer) ...) 2610 ;;;; (defun vc-BACKEND-annotate-command (file buffer) ...)
2611 ;;;; Execute "annotate" on FILE by using `call-process' and insert 2611 ;;;; Execute "annotate" on FILE by using `call-process' and insert
2612 ;;;; the contents in BUFFER. 2612 ;;;; the contents in BUFFER.
2613 2613
2614 ;;;###autoload 2614 ;;;###autoload
2615 (defun vc-annotate (ratio) 2615 (defun vc-annotate (prefix)
2616 "Display the result of the \"Annotate\" command using colors. 2616 "Display the result of the \"Annotate\" command using colors.
2617 \"Annotate\" is defined by `vc-BACKEND-annotate-command'. New lines 2617 \"Annotate\" is defined by `vc-BACKEND-annotate-command'. New lines
2618 are displayed in red, old in blue. A prefix argument specifies a 2618 are displayed in red, old in blue. When given a prefix argument, asks
2619 factor for stretching the time scale. 2619 for a version to annotate from, and a factor for stretching the time
2620 scale.
2620 2621
2621 `vc-annotate-menu-elements' customizes the menu elements of the 2622 `vc-annotate-menu-elements' customizes the menu elements of the
2622 mode-specific menu. `vc-annotate-color-map' and 2623 mode-specific menu. `vc-annotate-color-map' and
2623 `vc-annotate-very-old-color' defines the mapping of time to 2624 `vc-annotate-very-old-color' defines the mapping of time to
2624 colors. `vc-annotate-background' specifies the background color." 2625 colors. `vc-annotate-background' specifies the background color."
2625 (interactive "p") 2626 (interactive "P")
2626 (vc-ensure-vc-buffer) 2627 (vc-ensure-vc-buffer)
2627 (message "Annotating...")
2628 (let ((temp-buffer-name (concat "*Annotate " (buffer-name) "*")) 2628 (let ((temp-buffer-name (concat "*Annotate " (buffer-name) "*"))
2629 (temp-buffer-show-function 'vc-annotate-display) 2629 (temp-buffer-show-function 'vc-annotate-display)
2630 (vc-annotate-ratio ratio) 2630 (vc-annotate-version
2631 (vc-annotate-backend (vc-backend (buffer-file-name)))) 2631 (if prefix (read-string
2632 (format "Annotate from version: (default %s) "
2633 (vc-workfile-version (buffer-file-name)))
2634 nil nil (vc-workfile-version (buffer-file-name)))))
2635 (vc-annotate-ratio
2636 (if prefix (string-to-number
2637 (read-string "Annotate ratio: (default 1.0) "
2638 nil nil "1.0"))))
2639 (vc-annotate-backend (vc-backend (buffer-file-name))))
2640 (message "Annotating...")
2632 (if (not (vc-find-backend-function vc-annotate-backend 'annotate-command)) 2641 (if (not (vc-find-backend-function vc-annotate-backend 'annotate-command))
2633 (error "Sorry, annotating is not implemented for %s" 2642 (error "Sorry, annotating is not implemented for %s"
2634 vc-annotate-backend)) 2643 vc-annotate-backend))
2635 (with-output-to-temp-buffer temp-buffer-name 2644 (with-output-to-temp-buffer temp-buffer-name
2636 (vc-call-backend vc-annotate-backend 'annotate-command 2645 (vc-call-backend vc-annotate-backend 'annotate-command
2637 (file-name-nondirectory (buffer-file-name)) 2646 (file-name-nondirectory (buffer-file-name))
2638 (get-buffer temp-buffer-name))) 2647 (get-buffer temp-buffer-name)
2648 vc-annotate-version))
2639 ;; Don't use the temp-buffer-name until the buffer is created 2649 ;; Don't use the temp-buffer-name until the buffer is created
2640 ;; (only after `with-output-to-temp-buffer'.) 2650 ;; (only after `with-output-to-temp-buffer'.)
2641 (setq vc-annotate-buffers 2651 (setq vc-annotate-buffers
2642 (append vc-annotate-buffers 2652 (append vc-annotate-buffers
2643 (list (cons (get-buffer temp-buffer-name) vc-annotate-backend))))) 2653 (list (cons (get-buffer temp-buffer-name) vc-annotate-backend)))))