aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Spiegel2001-11-15 10:31:17 +0000
committerAndré Spiegel2001-11-15 10:31:17 +0000
commit6f1ecae40316416e14029ef64012e91919bc0bd7 (patch)
treeca10a340c2cb05ce64c1cd0c27717c79f66f08e0
parent9b784ab8cf9f536959a6a41f37f3c35ec71a55d1 (diff)
downloademacs-6f1ecae40316416e14029ef64012e91919bc0bd7.tar.gz
emacs-6f1ecae40316416e14029ef64012e91919bc0bd7.zip
Documentation fixes.
-rw-r--r--lisp/vc.el196
1 files changed, 110 insertions, 86 deletions
diff --git a/lisp/vc.el b/lisp/vc.el
index 99a39033c2e..6b1d80996ce 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -6,7 +6,7 @@
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.318 2001/11/09 14:55:52 spiegel Exp $ 9;; $Id: vc.el,v 1.319 2001/11/12 23:01:17 sds Exp $
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -36,10 +36,10 @@
36;; Martin Lorentzson <martinl@gnu.org> 36;; Martin Lorentzson <martinl@gnu.org>
37;; Dave Love <fx@gnu.org> 37;; Dave Love <fx@gnu.org>
38;; Stefan Monnier <monnier@cs.yale.edu> 38;; Stefan Monnier <monnier@cs.yale.edu>
39;; John David Smith <jdsmith@astro.cornell.edu> 39;; J.D. Smith <jdsmith@alum.mit.edu>
40;; Andre Spiegel <spiegel@gnu.org> 40;; Andre Spiegel <spiegel@gnu.org>
41;; Richard Stallman <rms@gnu.org> 41;; Richard Stallman <rms@gnu.org>
42;; ttn@netcom.com 42;; Thien-Thi Nguyen <ttn@gnu.org>
43 43
44;;; Commentary: 44;;; Commentary:
45 45
@@ -484,7 +484,7 @@ These are passed to the checkin program by \\[vc-register]."
484 :version "20.3") 484 :version "20.3")
485 485
486(defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS") 486(defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS")
487 "*List of directory names to be ignored while recursively walking file trees." 487 "*List of directory names to be ignored when walking directory trees."
488 :type '(repeat string) 488 :type '(repeat string)
489 :group 'vc) 489 :group 'vc)
490 490
@@ -508,14 +508,14 @@ specific to any particular backend."
508 508
509;;;###autoload 509;;;###autoload
510(defcustom vc-checkout-hook nil 510(defcustom vc-checkout-hook nil
511 "*Normal hook (list of functions) run after a file has been checked out. 511 "*Normal hook (list of functions) run after checking out a file.
512See `run-hooks'." 512See `run-hooks'."
513 :type 'hook 513 :type 'hook
514 :group 'vc 514 :group 'vc
515 :version "21.1") 515 :version "21.1")
516 516
517(defcustom vc-annotate-display-mode nil 517(defcustom vc-annotate-display-mode nil
518 "Which mode to color the annotations with by default." 518 "Which mode to color the output of \\[vc-annotate] with by default."
519 :type '(choice (const :tag "Default" nil) 519 :type '(choice (const :tag "Default" nil)
520 (const :tag "Scale to Oldest" scale) 520 (const :tag "Scale to Oldest" scale)
521 (const :tag "Scale Oldest->Newest" fullscale) 521 (const :tag "Scale Oldest->Newest" fullscale)
@@ -533,7 +533,7 @@ See `run-hooks'."
533 533
534;;;###autoload 534;;;###autoload
535(defcustom vc-before-checkin-hook nil 535(defcustom vc-before-checkin-hook nil
536 "*Normal hook (list of functions) run before a file gets checked in. 536 "*Normal hook (list of functions) run before a file is checked in.
537See `run-hooks'." 537See `run-hooks'."
538 :type 'hook 538 :type 'hook
539 :group 'vc) 539 :group 'vc)
@@ -564,14 +564,14 @@ version control backend imposes itself."
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].
568Ages are given in units of fractional days. Default is eighteen steps 568Ages are given in units of fractional days. Default is eighteen steps
569using a twenty day increment." 569using a twenty day increment."
570 :type 'alist 570 :type 'alist
571 :group 'vc) 571 :group 'vc)
572 572
573(defcustom vc-annotate-very-old-color "#0046FF" 573(defcustom vc-annotate-very-old-color "#0046FF"
574 "*Color for lines older than CAR of last cons in `vc-annotate-color-map'." 574 "*Color for lines older than the current color range in \\[vc-annotate]]."
575 :type 'string 575 :type 'string
576 :group 'vc) 576 :group 'vc)
577 577
@@ -615,7 +615,7 @@ the file's version control type in `vc-header-alist'."
615 615
616(defcustom vc-comment-alist 616(defcustom vc-comment-alist
617 '((nroff-mode ".\\\"" "")) 617 '((nroff-mode ".\\\"" ""))
618 "*Special comment delimiters to be used in generating vc headers only. 618 "*Special comment delimiters for generating VC headers.
619Add an entry in this list if you need to override the normal `comment-start' 619Add an entry in this list if you need to override the normal `comment-start'
620and `comment-end' variables. This will only be necessary if the mode language 620and `comment-end' variables. This will only be necessary if the mode language
621is sensitive to blank lines." 621is sensitive to blank lines."
@@ -625,12 +625,12 @@ is sensitive to blank lines."
625 (string :tag "Comment End"))) 625 (string :tag "Comment End")))
626 :group 'vc) 626 :group 'vc)
627 627
628;; Default is to be extra careful for super-user.
629;; TODO: This variable is no longer used; the corresponding checks
630;; are always done now. If that turns out to be fast enough,
631;; the variable can be obsoleted.
632(defcustom vc-checkout-carefully (= (user-uid) 0) 628(defcustom vc-checkout-carefully (= (user-uid) 0)
633 "*Non-nil means be extra-careful in checkout. 629 "*This variable is obsolete
630The corresponding checks are always done now.
631From the old doc string:
632
633Non-nil means be extra-careful in checkout.
634Verify that the file really is not locked 634Verify that the file really is not locked
635and that its contents match what the master file says." 635and that its contents match what the master file says."
636 :type 'boolean 636 :type 'boolean
@@ -722,10 +722,10 @@ The keys are \(BUFFER . BACKEND\). See also `vc-annotate-get-backend'.")
722 (setq vc-comment-ring (make-ring vc-maximum-comment-ring-size))) 722 (setq vc-comment-ring (make-ring vc-maximum-comment-ring-size)))
723 723
724(defmacro with-vc-properties (file form settings) 724(defmacro with-vc-properties (file form settings)
725 "Execute FORM, then set per-file properties for FILE, 725 "Execute FORM, then maybe set per-file properties for FILE.
726but only those that have not been set during the execution of FORM. 726SETTINGS is an association list of property/value pairs. After
727SETTINGS is a list of two-element lists, each of which has the 727executing FORM, set those properties from SETTINGS that have not yet
728 form (PROPERTY . VALUE)." 728been updated to their corresponding values."
729 `(let ((vc-touched-properties (list t)) 729 `(let ((vc-touched-properties (list t))
730 (filename ,file)) 730 (filename ,file))
731 ,form 731 ,form
@@ -739,13 +739,14 @@ SETTINGS is a list of two-element lists, each of which has the
739;; Random helper functions 739;; Random helper functions
740 740
741(defsubst vc-editable-p (file) 741(defsubst vc-editable-p (file)
742 "Return non-nil if FILE can be edited."
742 (or (eq (vc-checkout-model file) 'implicit) 743 (or (eq (vc-checkout-model file) 'implicit)
743 (memq (vc-state file) '(edited needs-merge)))) 744 (memq (vc-state file) '(edited needs-merge))))
744 745
745;; Two macros for elisp programming 746;; Two macros for elisp programming
746;;;###autoload 747;;;###autoload
747(defmacro with-vc-file (file comment &rest body) 748(defmacro with-vc-file (file comment &rest body)
748 "Check out a writable copy of FILE if necessary and execute the body. 749 "Check out a writable copy of FILE if necessary, then execute BODY.
749Check in FILE with COMMENT (a string) after BODY has been executed. 750Check in FILE with COMMENT (a string) after BODY has been executed.
750FILE is passed through `expand-file-name'; BODY executed within 751FILE is passed through `expand-file-name'; BODY executed within
751`save-excursion'. If FILE is not under version control, or locked by 752`save-excursion'. If FILE is not under version control, or locked by
@@ -803,7 +804,7 @@ The only difference with the default filter is to insert S after markers."
803 (set-marker (process-mark p) (point)))))) 804 (set-marker (process-mark p) (point))))))
804 805
805(defun vc-setup-buffer (&optional buf) 806(defun vc-setup-buffer (&optional buf)
806 "Prepare BUF for executing a VC command and make it the current buffer. 807 "Prepare BUF for executing a VC command and make it current.
807BUF defaults to \"*vc*\", can be a string and will be created if necessary." 808BUF defaults to \"*vc*\", can be a string and will be created if necessary."
808 (unless buf (setq buf "*vc*")) 809 (unless buf (setq buf "*vc*"))
809 (let ((camefrom (current-buffer)) 810 (let ((camefrom (current-buffer))
@@ -847,11 +848,11 @@ Else, add CODE to the process' sentinel."
847(defvar vc-post-command-functions nil 848(defvar vc-post-command-functions nil
848 "Hook run at the end of `vc-do-command'. 849 "Hook run at the end of `vc-do-command'.
849Each function is called inside the buffer in which the command was run 850Each function is called inside the buffer in which the command was run
850and is passed 3 argument: the COMMAND, the FILE and the FLAGS.") 851and is passed 3 arguments: the COMMAND, the FILE and the FLAGS.")
851 852
852;;;###autoload 853;;;###autoload
853(defun vc-do-command (buffer okstatus command file &rest flags) 854(defun vc-do-command (buffer okstatus command file &rest flags)
854 "Execute a version control command, notifying user and checking for errors. 855 "Execute a VC command, notifying user and checking for errors.
855Output from COMMAND goes to BUFFER, or *vc* if BUFFER is nil or the 856Output from COMMAND goes to BUFFER, or *vc* if BUFFER is nil or the
856current buffer if BUFFER is t. If the destination buffer is not 857current buffer if BUFFER is t. If the destination buffer is not
857already current, set it up properly and erase it. The command is 858already current, set it up properly and erase it. The command is
@@ -922,7 +923,8 @@ if markers are destroyed or corrupted."
922 (min (point-max) (+ posn 100))))) 923 (min (point-max) (+ posn 100)))))
923 924
924(defun vc-find-position-by-context (context) 925(defun vc-find-position-by-context (context)
925 "Return the position of CONTEXT in the current buffer, or nil if not found." 926 "Return the position of CONTEXT in the current buffer.
927If CONTEXT cannot be found, return nil."
926 (let ((context-string (nth 2 context))) 928 (let ((context-string (nth 2 context)))
927 (if (equal "" context-string) 929 (if (equal "" context-string)
928 (point-max) 930 (point-max)
@@ -1018,8 +1020,8 @@ CONTEXT is that which `vc-buffer-context' returns."
1018 (if new-mark (set-mark new-mark)))))) 1020 (if new-mark (set-mark new-mark))))))
1019 1021
1020(defun vc-revert-buffer1 (&optional arg no-confirm) 1022(defun vc-revert-buffer1 (&optional arg no-confirm)
1021 "Revert buffer, trying to keep point and mark where user expects them. 1023 "Revert buffer, keeping point and mark where user expects them.
1022Tries to be clever in the face of changes due to expanded version control 1024Try to be clever in the face of changes due to expanded version control
1023key words. This is important for typeahead to work as expected. 1025key words. This is important for typeahead to work as expected.
1024ARG and NO-CONFIRM are passed on to `revert-buffer'." 1026ARG and NO-CONFIRM are passed on to `revert-buffer'."
1025 (interactive "P") 1027 (interactive "P")
@@ -1047,7 +1049,7 @@ NOT-URGENT means it is ok to continue if the user says not to save."
1047 (error "Aborted"))))) 1049 (error "Aborted")))))
1048 1050
1049(defun vc-workfile-unchanged-p (file) 1051(defun vc-workfile-unchanged-p (file)
1050 "Has FILE changed since last checkout?" 1052 "Return non-nil if FILE has not changed since the last checkout."
1051 (let ((checkout-time (vc-file-getprop file 'vc-checkout-time)) 1053 (let ((checkout-time (vc-file-getprop file 'vc-checkout-time))
1052 (lastmod (nth 5 (file-attributes file)))) 1054 (lastmod (nth 5 (file-attributes file))))
1053 (if checkout-time 1055 (if checkout-time
@@ -1057,12 +1059,14 @@ NOT-URGENT means it is ok to continue if the user says not to save."
1057 unchanged)))) 1059 unchanged))))
1058 1060
1059(defun vc-default-workfile-unchanged-p (backend file) 1061(defun vc-default-workfile-unchanged-p (backend file)
1060 "Default check whether FILE is unchanged: diff against master version." 1062 "Check if FILE is unchanged by diffing against the master version.
1063Return non-nil if FILE is unchanged."
1061 (zerop (vc-call diff file (vc-workfile-version file)))) 1064 (zerop (vc-call diff file (vc-workfile-version file))))
1062 1065
1063(defun vc-default-latest-on-branch-p (backend file) 1066(defun vc-default-latest-on-branch-p (backend file)
1064 "Default check whether the current workfile version of FILE is the 1067 "Return non-nil if FILE is the latest on its branch.
1065latest on its branch." 1068This default implementation always returns non-nil, which means that
1069editing non-current versions is not supported by default."
1066 t) 1070 t)
1067 1071
1068(defun vc-recompute-state (file) 1072(defun vc-recompute-state (file)
@@ -1072,7 +1076,7 @@ function `vc-BACKEND-state', not the heuristic."
1072 (vc-file-setprop file 'vc-state (vc-call state file))) 1076 (vc-file-setprop file 'vc-state (vc-call state file)))
1073 1077
1074(defun vc-next-action-on-file (file verbose &optional comment) 1078(defun vc-next-action-on-file (file verbose &optional comment)
1075 "Do The Right Thing for a given version-controlled FILE. 1079 "Do The Right Thing for a given FILE under version control.
1076If COMMENT is specified, it will be used as an admin or checkin comment. 1080If COMMENT is specified, it will be used as an admin or checkin comment.
1077If VERBOSE is non-nil, query the user rather than using default parameters." 1081If VERBOSE is non-nil, query the user rather than using default parameters."
1078 (let ((visited (get-file-buffer file)) 1082 (let ((visited (get-file-buffer file))
@@ -1229,7 +1233,7 @@ Ignores FILE and REV, but passes on COMMENT."
1229 1233
1230;;;###autoload 1234;;;###autoload
1231(defun vc-next-action (verbose) 1235(defun vc-next-action (verbose)
1232 "Do the next logical checkin or checkout operation on the current file. 1236 "Do the next logical version control operation on the current file.
1233 1237
1234If you call this from within a VC dired buffer with no files marked, 1238If you call this from within a VC dired buffer with no files marked,
1235it will operate on the file in the current line. 1239it will operate on the file in the current line.
@@ -1557,12 +1561,13 @@ Runs the normal hook `vc-checkin-hook'."
1557 'vc-checkin-hook)) 1561 'vc-checkin-hook))
1558 1562
1559(defun vc-comment-to-change-log (&optional whoami file-name) 1563(defun vc-comment-to-change-log (&optional whoami file-name)
1560 "Enter last VC comment into change log file for current buffer's file. 1564 "Enter last VC comment into the change log for the current file.
1561Optional arg (interactive prefix) non-nil means prompt for user name and site. 1565WHOAMI (interactive prefix) non-nil means prompt for user name
1562Second arg is file name of change log. \ 1566and site. FILE-NAME is the name of the change log; if nil, use
1563If nil, uses `change-log-default-name'. 1567`change-log-default-name'.
1564 1568
1565May be useful as a `vc-checkin-hook' to update change logs automatically." 1569This may be useful as a `vc-checkin-hook' to update change logs
1570automatically."
1566 (interactive (if current-prefix-arg 1571 (interactive (if current-prefix-arg
1567 (list current-prefix-arg 1572 (list current-prefix-arg
1568 (prompt-for-change-log-name)))) 1573 (prompt-for-change-log-name))))
@@ -1604,7 +1609,11 @@ May be useful as a `vc-checkin-hook' to update change logs automatically."
1604 (insert "\n")))) 1609 (insert "\n"))))
1605 1610
1606(defun vc-finish-logentry (&optional nocomment) 1611(defun vc-finish-logentry (&optional nocomment)
1607 "Complete the operation implied by the current log entry." 1612 "Complete the operation implied by the current log entry.
1613Use the contents of the current buffer as a check-in or registration
1614comment. If the optional arg NOCOMMENT is non-nil, then don't check
1615the buffer contents as a comment, and don't add it to
1616`vc-comment-ring'."
1608 (interactive) 1617 (interactive)
1609 ;; Check and record the comment, if any. 1618 ;; Check and record the comment, if any.
1610 (unless nocomment 1619 (unless nocomment
@@ -1658,6 +1667,8 @@ May be useful as a `vc-checkin-hook' to update change logs automatically."
1658;; Code for access to the comment ring 1667;; Code for access to the comment ring
1659 1668
1660(defun vc-new-comment-index (stride len) 1669(defun vc-new-comment-index (stride len)
1670 "Return the comment index STRIDE elements from the current one.
1671LEN is the length of `vc-comment-ring'."
1661 (mod (cond 1672 (mod (cond
1662 (vc-comment-ring-index (+ vc-comment-ring-index stride)) 1673 (vc-comment-ring-index (+ vc-comment-ring-index stride))
1663 ;; Initialize the index on the first use of this command 1674 ;; Initialize the index on the first use of this command
@@ -1668,7 +1679,8 @@ May be useful as a `vc-checkin-hook' to update change logs automatically."
1668 len)) 1679 len))
1669 1680
1670(defun vc-previous-comment (arg) 1681(defun vc-previous-comment (arg)
1671 "Cycle backwards through comment history." 1682 "Cycle backwards through comment history.
1683With a numeric prefix ARG, go back ARG comments."
1672 (interactive "*p") 1684 (interactive "*p")
1673 (let ((len (ring-length vc-comment-ring))) 1685 (let ((len (ring-length vc-comment-ring)))
1674 (if (<= len 0) 1686 (if (<= len 0)
@@ -1679,12 +1691,15 @@ May be useful as a `vc-checkin-hook' to update change logs automatically."
1679 (insert (ring-ref vc-comment-ring vc-comment-ring-index))))) 1691 (insert (ring-ref vc-comment-ring vc-comment-ring-index)))))
1680 1692
1681(defun vc-next-comment (arg) 1693(defun vc-next-comment (arg)
1682 "Cycle forwards through comment history." 1694 "Cycle forwards through comment history.
1695With a numeric prefix ARG, go forward ARG comments."
1683 (interactive "*p") 1696 (interactive "*p")
1684 (vc-previous-comment (- arg))) 1697 (vc-previous-comment (- arg)))
1685 1698
1686(defun vc-comment-search-reverse (str &optional stride) 1699(defun vc-comment-search-reverse (str &optional stride)
1687 "Search backwards through comment history for substring match." 1700 "Search backwards through comment history for substring match of STR.
1701If the optional argument STRIDE is present, that is a step-width to use
1702when going through the comment ring."
1688 ;; Why substring rather than regexp ? -sm 1703 ;; Why substring rather than regexp ? -sm
1689 (interactive 1704 (interactive
1690 (list (read-string "Comment substring: " nil nil vc-last-comment-match))) 1705 (list (read-string "Comment substring: " nil nil vc-last-comment-match)))
@@ -1702,7 +1717,7 @@ May be useful as a `vc-checkin-hook' to update change logs automatically."
1702 (vc-previous-comment 0))) 1717 (vc-previous-comment 0)))
1703 1718
1704(defun vc-comment-search-forward (str) 1719(defun vc-comment-search-forward (str)
1705 "Search forwards through comment history for substring match." 1720 "Search forwards through comment history for a substring match of STR."
1706 (interactive 1721 (interactive
1707 (list (read-string "Comment substring: " nil nil vc-last-comment-match))) 1722 (list (read-string "Comment substring: " nil nil vc-last-comment-match)))
1708 (vc-comment-search-reverse str -1)) 1723 (vc-comment-search-reverse str -1))
@@ -1712,10 +1727,12 @@ May be useful as a `vc-checkin-hook' to update change logs automatically."
1712;;;###autoload 1727;;;###autoload
1713(defun vc-diff (historic &optional not-urgent) 1728(defun vc-diff (historic &optional not-urgent)
1714 "Display diffs between file versions. 1729 "Display diffs between file versions.
1715Normally this compares the current file and buffer with the most recent 1730Normally this compares the current file and buffer with the most
1716checked in version of that file. This uses no arguments. 1731recent checked in version of that file. This uses no arguments. With
1717With a prefix argument, it reads the file name to use 1732a prefix argument HISTORIC, it reads the file name to use and two
1718and two version designators specifying which versions to compare." 1733version designators specifying which versions to compare. The
1734optional argument NOT-URGENT non-nil means it is ok to say no to
1735saving the buffer."
1719 (interactive (list current-prefix-arg t)) 1736 (interactive (list current-prefix-arg t))
1720 (if historic 1737 (if historic
1721 (call-interactively 'vc-version-diff) 1738 (call-interactively 'vc-version-diff)
@@ -1727,9 +1744,11 @@ and two version designators specifying which versions to compare."
1727 (vc-version-diff file nil nil))))) 1744 (vc-version-diff file nil nil)))))
1728 1745
1729(defun vc-version-diff (file rel1 rel2) 1746(defun vc-version-diff (file rel1 rel2)
1730 "For FILE, report diffs between two stored versions REL1 and REL2 of it. 1747 "List the differences between FILE's versions REL1 and REL2.
1731If FILE is a directory, generate diffs between versions for all registered 1748If REL1 is empty or nil it means to use the current workfile version;
1732files in or below it." 1749REL2 empty or nil means the current file contents. FILE may also be
1750a directory, in that case, generate diffs between the correponding
1751versions of all registered files in or below it."
1733 (interactive 1752 (interactive
1734 (let ((file (expand-file-name 1753 (let ((file (expand-file-name
1735 (read-file-name (if buffer-file-name 1754 (read-file-name (if buffer-file-name
@@ -1832,8 +1851,7 @@ actually call the backend, but performs a local diff."
1832 (vc-call diff file rel1 rel2)))) 1851 (vc-call diff file rel1 rel2))))
1833 1852
1834(defmacro vc-diff-switches-list (backend) 1853(defmacro vc-diff-switches-list (backend)
1835 "Make a list of `diff-switches', `vc-diff-switches', 1854 "Return the list of switches to use for executing diff under BACKEND."
1836and `vc-BACKEND-diff-switches'."
1837 `(append 1855 `(append
1838 (if (listp diff-switches) diff-switches (list diff-switches)) 1856 (if (listp diff-switches) diff-switches (list diff-switches))
1839 (if (listp vc-diff-switches) vc-diff-switches (list vc-diff-switches)) 1857 (if (listp vc-diff-switches) vc-diff-switches (list vc-diff-switches))
@@ -1843,7 +1861,7 @@ and `vc-BACKEND-diff-switches'."
1843 (if (listp backend-switches) backend-switches (list backend-switches))))) 1861 (if (listp backend-switches) backend-switches (list backend-switches)))))
1844 1862
1845(defun vc-default-diff-tree (backend dir rel1 rel2) 1863(defun vc-default-diff-tree (backend dir rel1 rel2)
1846 "Default implementation for diffing an entire tree at and below DIR. 1864 "List differences for all registered files at and below DIR.
1847The meaning of REL1 and REL2 is the same as for `vc-version-diff'." 1865The meaning of REL1 and REL2 is the same as for `vc-version-diff'."
1848 ;; This implementation does an explicit tree walk, and calls 1866 ;; This implementation does an explicit tree walk, and calls
1849 ;; vc-BACKEND-diff directly for each file. An optimization 1867 ;; vc-BACKEND-diff directly for each file. An optimization
@@ -1877,9 +1895,9 @@ The meaning of REL1 and REL2 is the same as for `vc-version-diff'."
1877 1895
1878;;;###autoload 1896;;;###autoload
1879(defun vc-version-other-window (rev) 1897(defun vc-version-other-window (rev)
1880 "Visit version REV of the current buffer in another window. 1898 "Visit version REV of the current file in another window.
1881If the current buffer is named `F', the version is named `F.~REV~'. 1899If the current file is named `F', the version is named `F.~REV~'.
1882If `F.~REV~' already exists, it is used instead of being re-created." 1900If `F.~REV~' already exists, use it instead of checking it out again."
1883 (interactive "sVersion to visit (default is workfile version): ") 1901 (interactive "sVersion to visit (default is workfile version): ")
1884 (vc-ensure-vc-buffer) 1902 (vc-ensure-vc-buffer)
1885 (let* ((file buffer-file-name) 1903 (let* ((file buffer-file-name)
@@ -1898,7 +1916,7 @@ If `F.~REV~' already exists, it is used instead of being re-created."
1898 1916
1899;;;###autoload 1917;;;###autoload
1900(defun vc-insert-headers () 1918(defun vc-insert-headers ()
1901 "Insert headers in a file for use with your version control system. 1919 "Insert headers into a file for use with a version control system.
1902Headers desired are inserted at point, and are pulled from 1920Headers desired are inserted at point, and are pulled from
1903the variable `vc-BACKEND-header'." 1921the variable `vc-BACKEND-header'."
1904 (interactive) 1922 (interactive)
@@ -1929,7 +1947,7 @@ the variable `vc-BACKEND-header'."
1929 1947
1930(defun vc-clear-headers (&optional file) 1948(defun vc-clear-headers (&optional file)
1931 "Clear all version headers in the current buffer (or FILE). 1949 "Clear all version headers in the current buffer (or FILE).
1932I.e. reset them to the non-expanded form." 1950The headers are reset to their non-expanded form."
1933 (let* ((filename (or file buffer-file-name)) 1951 (let* ((filename (or file buffer-file-name))
1934 (visited (find-buffer-visiting filename)) 1952 (visited (find-buffer-visiting filename))
1935 (backend (vc-backend filename))) 1953 (backend (vc-backend filename)))
@@ -2343,7 +2361,7 @@ With prefix arg READ-SWITCHES, specify a value to override
2343;; Named-configuration entry points 2361;; Named-configuration entry points
2344 2362
2345(defun vc-snapshot-precondition (dir) 2363(defun vc-snapshot-precondition (dir)
2346 "Scan the tree below DIR, looking for non-uptodate files. 2364 "Scan the tree below DIR, looking for files not up-to-date.
2347If any file is not up-to-date, return the name of the first such file. 2365If any file is not up-to-date, return the name of the first such file.
2348\(This means, neither snapshot creation nor retrieval is allowed.\) 2366\(This means, neither snapshot creation nor retrieval is allowed.\)
2349If one or more of the files are currently visited, return `visited'. 2367If one or more of the files are currently visited, return `visited'.
@@ -2457,7 +2475,7 @@ allowed and simply skipped)."
2457 (set-buffer-modified-p nil))))) 2475 (set-buffer-modified-p nil)))))
2458 2476
2459(defun vc-default-comment-history (backend file) 2477(defun vc-default-comment-history (backend file)
2460 "Return a string with all log entries that were made under BACKEND for FILE." 2478 "Return a string with all log entries stored in BACKEND for FILE."
2461 (if (vc-find-backend-function backend 'print-log) 2479 (if (vc-find-backend-function backend 'print-log)
2462 (with-temp-buffer 2480 (with-temp-buffer
2463 (vc-call print-log file) 2481 (vc-call print-log file)
@@ -2486,7 +2504,7 @@ it if their logs are not in RCS format."
2486 2504
2487;;;###autoload 2505;;;###autoload
2488(defun vc-revert-buffer () 2506(defun vc-revert-buffer ()
2489 "Revert the current buffer's file back to the version it was based on. 2507 "Revert the current buffer's file to the version it was based on.
2490This asks for confirmation if the buffer contents are not identical 2508This asks for confirmation if the buffer contents are not identical
2491to that version. This function does not automatically pick up newer 2509to that version. This function does not automatically pick up newer
2492changes found in the master file; use \\[universal-argument] \\[vc-next-action] to do so." 2510changes found in the master file; use \\[universal-argument] \\[vc-next-action] to do so."
@@ -2713,7 +2731,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
2713 templates))) 2731 templates)))
2714 (if (or (file-symlink-p oldmaster) 2732 (if (or (file-symlink-p oldmaster)
2715 (file-symlink-p (file-name-directory oldmaster))) 2733 (file-symlink-p (file-name-directory oldmaster)))
2716 (error "This unsafe in the presence of symbolic links")) 2734 (error "This is unsafe in the presence of symbolic links"))
2717 (rename-file 2735 (rename-file
2718 oldmaster 2736 oldmaster
2719 (catch 'found 2737 (catch 'found
@@ -2872,7 +2890,7 @@ Return NIL if no match made. Associations are made based on
2872 (cdr (assoc buffer vc-annotate-buffers))) 2890 (cdr (assoc buffer vc-annotate-buffers)))
2873 2891
2874(define-derived-mode vc-annotate-mode fundamental-mode "Annotate" 2892(define-derived-mode vc-annotate-mode fundamental-mode "Annotate"
2875 "Major mode for buffers displaying output from the `annotate' command. 2893 "Major mode for output buffers of the `vc-annotate' command.
2876 2894
2877You can use the mode-specific menu to alter the time-span of the used 2895You can use the mode-specific menu to alter the time-span of the used
2878colors. See variable `vc-annotate-menu-elements' for customizing the 2896colors. See variable `vc-annotate-menu-elements' for customizing the
@@ -2880,8 +2898,9 @@ menu items."
2880 (vc-annotate-add-menu)) 2898 (vc-annotate-add-menu))
2881 2899
2882(defun vc-annotate-display-default (&optional ratio) 2900(defun vc-annotate-display-default (&optional ratio)
2883 "Use the default color spectrum for VC Annotate mode, scaling the 2901 "Display the output of \\[vc-annotate] using the default color range.
2884colormap by RATIO, if present. Use the current time as offset." 2902The color range is given by `vc-annotate-color-map', scaled by RATIO
2903if present. The current time is used as the offset."
2885 (interactive "e") 2904 (interactive "e")
2886 (message "Redisplaying annotation...") 2905 (message "Redisplaying annotation...")
2887 (vc-annotate-display 2906 (vc-annotate-display
@@ -2889,9 +2908,10 @@ colormap by RATIO, if present. Use the current time as offset."
2889 (message "Redisplaying annotation...done")) 2908 (message "Redisplaying annotation...done"))
2890 2909
2891(defun vc-annotate-display-autoscale (&optional full) 2910(defun vc-annotate-display-autoscale (&optional full)
2892 "Re-display annotation using colormap scaled from the current time 2911 "Highlight the output of \\[vc-annotate]] using an autoscaled color map.
2893to the oldest annotation in the buffer, or, with argument FULL set, to 2912Autoscaling means that the map is scaled from the current time to the
2894cover the full time range, from oldest to newest." 2913oldest annotation in the buffer, or, with argument FULL non-nil, to
2914cover the range from the oldest annotation to the newest."
2895 (interactive) 2915 (interactive)
2896 (let ((newest 0.0) 2916 (let ((newest 0.0)
2897 (oldest 999999.) ;Any CVS users at the founding of Rome? 2917 (oldest 999999.) ;Any CVS users at the founding of Rome?
@@ -2970,9 +2990,11 @@ cover the full time range, from oldest to newest."
2970 "VC Annotate Display Menu" menu-def)))) 2990 "VC Annotate Display Menu" menu-def))))
2971 2991
2972(defun vc-annotate-display-select (&optional buffer mode) 2992(defun vc-annotate-display-select (&optional buffer mode)
2973 "Do the default or chosen annotation display as specified in the 2993 "Highlight the output of \\[vc-annotate].
2974customizable variable `vc-annotate-display-mode'." 2994By default, the current buffer is highlighted, unless overridden by
2975 (interactive) 2995BUFFER. `vc-annotate-display-mode' specifies the highlighting mode to
2996use; you may override this using the second optional arg MODE."
2997 (interactive)
2976 (if mode (setq vc-annotate-display-mode mode)) 2998 (if mode (setq vc-annotate-display-mode mode))
2977 (when buffer 2999 (when buffer
2978 (set-buffer buffer) 3000 (set-buffer buffer)
@@ -3063,7 +3085,7 @@ colors. `vc-annotate-background' specifies the background color."
3063 (car (car a-list)))) 3085 (car (car a-list))))
3064 3086
3065(defun vc-annotate-time-span (a-list span &optional quantize) 3087(defun vc-annotate-time-span (a-list span &optional quantize)
3066 "Apply factor SPAN to the time-span of association list A-LIST. 3088 "Apply factor SPAN to the time-span of association list A-LIST.
3067Return the new alist. 3089Return the new alist.
3068Optionally quantize to the factor of QUANTIZE." 3090Optionally quantize to the factor of QUANTIZE."
3069 ;; Apply span to each car of every cons 3091 ;; Apply span to each car of every cons
@@ -3075,9 +3097,9 @@ Optionally quantize to the factor of QUANTIZE."
3075 a-list) span quantize)))) 3097 a-list) span quantize))))
3076 3098
3077(defun vc-annotate-compcar (threshold a-list) 3099(defun vc-annotate-compcar (threshold a-list)
3078 "Test successive cons cells of association list A-LIST against THRESHOLD. 3100 "Test successive cons cells of A-LIST against THRESHOLD.
3079Return the first cons cell which car is not less than THRESHOLD, 3101Return the first cons cell with a car that is not less than THRESHOLD,
3080nil otherwise" 3102nil if no such cell exists."
3081 (let ((i 1) 3103 (let ((i 1)
3082 (tmp-cons (car a-list))) 3104 (tmp-cons (car a-list)))
3083 (while (and tmp-cons (< (car tmp-cons) threshold)) 3105 (while (and tmp-cons (< (car tmp-cons) threshold))
@@ -3086,17 +3108,16 @@ nil otherwise"
3086 tmp-cons)) ; Return the appropriate value 3108 tmp-cons)) ; Return the appropriate value
3087 3109
3088(defun vc-annotate-convert-time (time) 3110(defun vc-annotate-convert-time (time)
3089 "Convert high/low times, as returned by `current-time' and 3111 "Convert a time value to a floating-point number of days.
3090`encode-time', to a single floating point value in units of days. 3112The argument TIME is a list as returned by `current-time' or
3091TIME is list, only the first two elements of TIME are considered, 3113`encode-time', only the first two elements of that list are considered."
3092comprising the high 16 and low 16 bits of the number of seconds since
3093Jan 1, 1970."
3094 (/ (+ (* (float (car time)) (lsh 1 16)) (cadr time)) 24 3600)) 3114 (/ (+ (* (float (car time)) (lsh 1 16)) (cadr time)) 24 3600))
3095 3115
3096(defun vc-annotate-difference (&optional offset) 3116(defun vc-annotate-difference (&optional offset)
3097 "Calculate the difference, in days, from the current time and the 3117 "Return the time span in days to the next annotation.
3098time returned from the backend function annotate-time. If OFFSET is 3118This calls the backend function annotate-time, and returns the
3099set, use it as the time base instead of the current time." 3119difference in days between the time returned and the current time,
3120or OFFSET if present."
3100 (let ((next-time (vc-call-backend vc-annotate-backend 'annotate-time))) 3121 (let ((next-time (vc-call-backend vc-annotate-backend 'annotate-time)))
3101 (if next-time 3122 (if next-time
3102 (- (or offset 3123 (- (or offset
@@ -3108,10 +3129,13 @@ set, use it as the time base instead of the current time."
3108 (vc-annotate-convert-time (current-time))) 3129 (vc-annotate-convert-time (current-time)))
3109 3130
3110(defun vc-annotate-display (&optional color-map offset) 3131(defun vc-annotate-display (&optional color-map offset)
3111 "Do the VC-Annotate display in BUFFER using COLOR-MAP, and time 3132 "Highlight `vc-annotate' output in the current buffer.
3112offset OFFSET (defaults to the present time). You probably want 3133COLOR-MAP, if present, overrides `vc-annotate-color-map'. The
3113`vc-annotate-select' instead, after setting 3134annotations are relative to the current time, unless overridden by
3114`vc-annotate-display-mode'" 3135OFFSET.
3136
3137This function is obsolete, and has been replaced by
3138`vc-annotate-select'."
3115 (save-excursion 3139 (save-excursion
3116 (goto-char (point-min)) ; Position at the top of the buffer. 3140 (goto-char (point-min)) ; Position at the top of the buffer.
3117 ;; Delete old overlays 3141 ;; Delete old overlays