Mercurial > emacs
comparison lisp/vc.el @ 50894:4dc2d45403ec
(with-vc-properties, with-vc-file, edit-vc-file):
Add `declare's for debugging and indentation.
(vc-do-command): Use `remq'.
(vc-buffer-context): Remove unused var `curbuf'.
(vc-next-action-dired): Remove unused var `dired-dir'.
(vc-switches): New fun.
(vc-diff-switches-list): Use it.
(vc-dired-hook): Remove unused var `cvs-dir'.
(vc-dired-purge): Remove unused var `subdir'.
(vc-cancel-version): Remove unused var `config'.
(vc-rename-master): Use dolist iso mapcar.
(vc-rename-file): Remove redundant tests.
Clear the properties of the old file name.
(vc-annotate): Pass the complete filename to `annotate-command'.
(vc-annotate-lines): Remove unused var `overlay'.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 08 May 2003 17:41:16 +0000 |
parents | f614a2396578 |
children | dd6110a63907 |
comparison
equal
deleted
inserted
replaced
50893:60a9c1f0319a | 50894:4dc2d45403ec |
---|---|
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.349 2003/02/05 23:13:21 lektu Exp $ | 9 ;; $Id: vc.el,v 1.350 2003/02/19 18:56:38 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 |
749 (defmacro with-vc-properties (file form settings) | 749 (defmacro with-vc-properties (file form settings) |
750 "Execute FORM, then maybe set per-file properties for FILE. | 750 "Execute FORM, then maybe set per-file properties for FILE. |
751 SETTINGS is an association list of property/value pairs. After | 751 SETTINGS is an association list of property/value pairs. After |
752 executing FORM, set those properties from SETTINGS that have not yet | 752 executing FORM, set those properties from SETTINGS that have not yet |
753 been updated to their corresponding values." | 753 been updated to their corresponding values." |
754 (declare (debug t)) | |
754 `(let ((vc-touched-properties (list t))) | 755 `(let ((vc-touched-properties (list t))) |
755 ,form | 756 ,form |
756 (mapcar (lambda (setting) | 757 (mapcar (lambda (setting) |
757 (let ((property (car setting))) | 758 (let ((property (car setting))) |
758 (unless (memq property vc-touched-properties) | 759 (unless (memq property vc-touched-properties) |
773 "Check out a writable copy of FILE if necessary, then execute BODY. | 774 "Check out a writable copy of FILE if necessary, then execute BODY. |
774 Check in FILE with COMMENT (a string) after BODY has been executed. | 775 Check in FILE with COMMENT (a string) after BODY has been executed. |
775 FILE is passed through `expand-file-name'; BODY executed within | 776 FILE is passed through `expand-file-name'; BODY executed within |
776 `save-excursion'. If FILE is not under version control, or locked by | 777 `save-excursion'. If FILE is not under version control, or locked by |
777 somebody else, signal error." | 778 somebody else, signal error." |
779 (declare (debug t) (indent 2)) | |
778 (let ((filevar (make-symbol "file"))) | 780 (let ((filevar (make-symbol "file"))) |
779 `(let ((,filevar (expand-file-name ,file))) | 781 `(let ((,filevar (expand-file-name ,file))) |
780 (or (vc-backend ,filevar) | 782 (or (vc-backend ,filevar) |
781 (error (format "File not under version control: `%s'" file))) | 783 (error (format "File not under version control: `%s'" file))) |
782 (unless (vc-editable-p ,filevar) | 784 (unless (vc-editable-p ,filevar) |
786 (vc-checkout ,filevar t)))) | 788 (vc-checkout ,filevar t)))) |
787 (save-excursion | 789 (save-excursion |
788 ,@body) | 790 ,@body) |
789 (vc-checkin ,filevar nil ,comment)))) | 791 (vc-checkin ,filevar nil ,comment)))) |
790 | 792 |
791 (put 'with-vc-file 'lisp-indent-function 2) | |
792 | |
793 ;;;###autoload | 793 ;;;###autoload |
794 (defmacro edit-vc-file (file comment &rest body) | 794 (defmacro edit-vc-file (file comment &rest body) |
795 "Edit FILE under version control, executing body. | 795 "Edit FILE under version control, executing body. |
796 Checkin with COMMENT after executing BODY. | 796 Checkin with COMMENT after executing BODY. |
797 This macro uses `with-vc-file', passing args to it. | 797 This macro uses `with-vc-file', passing args to it. |
798 However, before executing BODY, find FILE, and after BODY, save buffer." | 798 However, before executing BODY, find FILE, and after BODY, save buffer." |
799 (declare (debug t) (indent 2)) | |
799 (let ((filevar (make-symbol "file"))) | 800 (let ((filevar (make-symbol "file"))) |
800 `(let ((,filevar (expand-file-name ,file))) | 801 `(let ((,filevar (expand-file-name ,file))) |
801 (with-vc-file | 802 (with-vc-file |
802 ,filevar ,comment | 803 ,filevar ,comment |
803 (set-buffer (find-file-noselect ,filevar)) | 804 (set-buffer (find-file-noselect ,filevar)) |
804 ,@body | 805 ,@body |
805 (save-buffer))))) | 806 (save-buffer))))) |
806 | |
807 (put 'edit-vc-file 'lisp-indent-function 2) | |
808 | 807 |
809 (defun vc-ensure-vc-buffer () | 808 (defun vc-ensure-vc-buffer () |
810 "Make sure that the current buffer visits a version-controlled file." | 809 "Make sure that the current buffer visits a version-controlled file." |
811 (if vc-dired-mode | 810 (if vc-dired-mode |
812 (set-buffer (find-file-noselect (dired-get-filename))) | 811 (set-buffer (find-file-noselect (dired-get-filename))) |
872 (defvar vc-post-command-functions nil | 871 (defvar vc-post-command-functions nil |
873 "Hook run at the end of `vc-do-command'. | 872 "Hook run at the end of `vc-do-command'. |
874 Each function is called inside the buffer in which the command was run | 873 Each function is called inside the buffer in which the command was run |
875 and is passed 3 arguments: the COMMAND, the FILE and the FLAGS.") | 874 and is passed 3 arguments: the COMMAND, the FILE and the FLAGS.") |
876 | 875 |
876 (defvar w32-quote-process-args) | |
877 ;;;###autoload | 877 ;;;###autoload |
878 (defun vc-do-command (buffer okstatus command file &rest flags) | 878 (defun vc-do-command (buffer okstatus command file &rest flags) |
879 "Execute a VC command, notifying user and checking for errors. | 879 "Execute a VC command, notifying user and checking for errors. |
880 Output from COMMAND goes to BUFFER, or *vc* if BUFFER is nil or the | 880 Output from COMMAND goes to BUFFER, or *vc* if BUFFER is nil or the |
881 current buffer if BUFFER is t. If the destination buffer is not | 881 current buffer if BUFFER is t. If the destination buffer is not |
893 (unless (or (eq buffer t) | 893 (unless (or (eq buffer t) |
894 (and (stringp buffer) | 894 (and (stringp buffer) |
895 (string= (buffer-name) buffer)) | 895 (string= (buffer-name) buffer)) |
896 (eq buffer (current-buffer))) | 896 (eq buffer (current-buffer))) |
897 (vc-setup-buffer buffer)) | 897 (vc-setup-buffer buffer)) |
898 (let ((squeezed nil) | 898 (let ((squeezed (remq nil flags)) |
899 (inhibit-read-only t) | 899 (inhibit-read-only t) |
900 (status 0)) | 900 (status 0)) |
901 (setq squeezed (delq nil (copy-sequence flags))) | |
902 (when file | 901 (when file |
903 ;; FIXME: file-relative-name can return a bogus result because | 902 ;; FIXME: file-relative-name can return a bogus result because |
904 ;; it doesn't look at the actual file-system to see if symlinks | 903 ;; it doesn't look at the actual file-system to see if symlinks |
905 ;; come into play. | 904 ;; come into play. |
906 (setq squeezed (append squeezed (list (file-relative-name file))))) | 905 (setq squeezed (append squeezed (list (file-relative-name file))))) |
984 (vc-position-context (mark-marker)))) | 983 (vc-position-context (mark-marker)))) |
985 ;; Make the right thing happen in transient-mark-mode. | 984 ;; Make the right thing happen in transient-mark-mode. |
986 (mark-active nil) | 985 (mark-active nil) |
987 ;; We may want to reparse the compilation buffer after revert | 986 ;; We may want to reparse the compilation buffer after revert |
988 (reparse (and (boundp 'compilation-error-list) ;compile loaded | 987 (reparse (and (boundp 'compilation-error-list) ;compile loaded |
989 (let ((curbuf (current-buffer))) | 988 ;; Construct a list; each elt is nil or a buffer |
990 ;; Construct a list; each elt is nil or a buffer | 989 ;; iff that buffer is a compilation output buffer |
991 ;; iff that buffer is a compilation output buffer | 990 ;; that contains markers into the current buffer. |
992 ;; that contains markers into the current buffer. | 991 (save-current-buffer |
993 (save-excursion | 992 (mapcar (lambda (buffer) |
994 (mapcar (lambda (buffer) | 993 (set-buffer buffer) |
995 (set-buffer buffer) | 994 (let ((errors (or |
996 (let ((errors (or | 995 compilation-old-error-list |
997 compilation-old-error-list | 996 compilation-error-list)) |
998 compilation-error-list)) | 997 (buffer-error-marked-p nil)) |
999 (buffer-error-marked-p nil)) | 998 (while (and (consp errors) |
1000 (while (and (consp errors) | 999 (not buffer-error-marked-p)) |
1001 (not buffer-error-marked-p)) | 1000 (and (markerp (cdr (car errors))) |
1002 (and (markerp (cdr (car errors))) | 1001 (eq buffer |
1003 (eq buffer | 1002 (marker-buffer |
1004 (marker-buffer | 1003 (cdr (car errors)))) |
1005 (cdr (car errors)))) | 1004 (setq buffer-error-marked-p t)) |
1006 (setq buffer-error-marked-p t)) | 1005 (setq errors (cdr errors))) |
1007 (setq errors (cdr errors))) | 1006 (if buffer-error-marked-p buffer))) |
1008 (if buffer-error-marked-p buffer))) | 1007 (buffer-list)))))) |
1009 (buffer-list))))))) | |
1010 (list point-context mark-context reparse))) | 1008 (list point-context mark-context reparse))) |
1011 | 1009 |
1012 (defun vc-restore-buffer-context (context) | 1010 (defun vc-restore-buffer-context (context) |
1013 "Restore point/mark, and reparse any affected compilation buffers. | 1011 "Restore point/mark, and reparse any affected compilation buffers. |
1014 CONTEXT is that which `vc-buffer-context' returns." | 1012 CONTEXT is that which `vc-buffer-context' returns." |
1230 (defvar vc-dired-window-configuration) | 1228 (defvar vc-dired-window-configuration) |
1231 | 1229 |
1232 (defun vc-next-action-dired (file rev comment) | 1230 (defun vc-next-action-dired (file rev comment) |
1233 "Call `vc-next-action-on-file' on all the marked files. | 1231 "Call `vc-next-action-on-file' on all the marked files. |
1234 Ignores FILE and REV, but passes on COMMENT." | 1232 Ignores FILE and REV, but passes on COMMENT." |
1235 (let ((dired-buffer (current-buffer)) | 1233 (let ((dired-buffer (current-buffer))) |
1236 (dired-dir default-directory)) | |
1237 (dired-map-over-marks | 1234 (dired-map-over-marks |
1238 (let ((file (dired-get-filename))) | 1235 (let ((file (dired-get-filename))) |
1239 (message "Processing %s..." file) | 1236 (message "Processing %s..." file) |
1240 (vc-next-action-on-file file nil comment) | 1237 (vc-next-action-on-file file nil comment) |
1241 (set-buffer dired-buffer) | 1238 (set-buffer dired-buffer) |
1853 file | 1850 file |
1854 (vc-version-backup-file file rel2))) | 1851 (vc-version-backup-file file rel2))) |
1855 (coding-system-for-read (vc-coding-system-for-diff file))) | 1852 (coding-system-for-read (vc-coding-system-for-diff file))) |
1856 (if (and file-rel1 file-rel2) | 1853 (if (and file-rel1 file-rel2) |
1857 (apply 'vc-do-command "*vc-diff*" 1 "diff" nil | 1854 (apply 'vc-do-command "*vc-diff*" 1 "diff" nil |
1858 (append (if (listp diff-switches) | 1855 (append (vc-switches nil 'diff) |
1859 diff-switches | 1856 (list (file-relative-name file-rel1) |
1860 (list diff-switches)) | 1857 (file-relative-name file-rel2)))) |
1861 (if (listp vc-diff-switches) | |
1862 vc-diff-switches | |
1863 (list vc-diff-switches)) | |
1864 (list (file-relative-name file-rel1) | |
1865 (file-relative-name file-rel2)))) | |
1866 (vc-call diff file rel1 rel2)))) | 1858 (vc-call diff file rel1 rel2)))) |
1867 | 1859 |
1868 (defmacro vc-diff-switches-list (backend) | 1860 |
1869 "Return the list of switches to use for executing diff under BACKEND." | 1861 (defun vc-switches (backend op) |
1870 `(append | 1862 (let ((switches |
1871 (if (listp diff-switches) diff-switches (list diff-switches)) | 1863 (or (if backend |
1872 (if (listp vc-diff-switches) vc-diff-switches (list vc-diff-switches)) | 1864 (let ((sym (vc-make-backend-sym |
1873 (let* ((backend-switches-symbol | 1865 backend (intern (concat (symbol-name op) |
1874 (intern (concat "vc-" (downcase (symbol-name ,backend)) | 1866 "-switches"))))) |
1875 "-diff-switches"))) | 1867 (if (boundp sym) (symbol-value sym)))) |
1876 (backend-switches | 1868 (let ((sym (intern (format "vc-%s-switches" (symbol-name op))))) |
1877 (if (boundp backend-switches-symbol) | 1869 (if (boundp sym) (symbol-value sym))) |
1878 (eval backend-switches-symbol) | 1870 (cond |
1879 nil))) | 1871 ((eq op 'diff) diff-switches))))) |
1880 (if (listp backend-switches) backend-switches (list backend-switches))))) | 1872 (if (stringp switches) (list switches) |
1873 ;; If not a list, return nil. | |
1874 ;; This is so we can set vc-diff-switches to t to override | |
1875 ;; any switches in diff-switches. | |
1876 (if (listp switches) switches)))) | |
1877 | |
1878 (defun vc-diff-switches-list (backend) (vc-switches backend 'diff)) | |
1879 ;; (defmacro vc-diff-switches-list (backend) `(vc-switches ',backend 'diff)) | |
1881 | 1880 |
1882 (defun vc-default-diff-tree (backend dir rel1 rel2) | 1881 (defun vc-default-diff-tree (backend dir rel1 rel2) |
1883 "List differences for all registered files at and below DIR. | 1882 "List differences for all registered files at and below DIR. |
1884 The meaning of REL1 and REL2 is the same as for `vc-version-diff'." | 1883 The meaning of REL1 and REL2 is the same as for `vc-version-diff'." |
1885 ;; This implementation does an explicit tree walk, and calls | 1884 ;; This implementation does an explicit tree walk, and calls |
2190 | 2189 |
2191 (defun vc-dired-hook () | 2190 (defun vc-dired-hook () |
2192 "Reformat the listing according to version control. | 2191 "Reformat the listing according to version control. |
2193 Called by dired after any portion of a vc-dired buffer has been read in." | 2192 Called by dired after any portion of a vc-dired buffer has been read in." |
2194 (message "Getting version information... ") | 2193 (message "Getting version information... ") |
2195 (let (subdir filename (buffer-read-only nil) cvs-dir) | 2194 (let (subdir filename (buffer-read-only nil)) |
2196 (goto-char (point-min)) | 2195 (goto-char (point-min)) |
2197 (while (not (eobp)) | 2196 (while (not (eobp)) |
2198 (cond | 2197 (cond |
2199 ;; subdir header line | 2198 ;; subdir header line |
2200 ((setq subdir (dired-get-subdir)) | 2199 ((setq subdir (dired-get-subdir)) |
2249 (goto-char (point-min)) | 2248 (goto-char (point-min)) |
2250 (message "No files locked under %s" default-directory))))) | 2249 (message "No files locked under %s" default-directory))))) |
2251 | 2250 |
2252 (defun vc-dired-purge () | 2251 (defun vc-dired-purge () |
2253 "Remove empty subdirs." | 2252 "Remove empty subdirs." |
2254 (let (subdir) | 2253 (goto-char (point-min)) |
2255 (goto-char (point-min)) | 2254 (while (dired-get-subdir) |
2256 (while (setq subdir (dired-get-subdir)) | 2255 (forward-line 2) |
2257 (forward-line 2) | 2256 (if (dired-get-filename nil t) |
2258 (if (dired-get-filename nil t) | 2257 (if (not (dired-next-subdir 1 t)) |
2259 (if (not (dired-next-subdir 1 t)) | 2258 (goto-char (point-max))) |
2260 (goto-char (point-max))) | 2259 (forward-line -2) |
2261 (forward-line -2) | 2260 (if (not (string= (dired-current-directory) default-directory)) |
2262 (if (not (string= (dired-current-directory) default-directory)) | 2261 (dired-do-kill-lines t "") |
2263 (dired-do-kill-lines t "") | 2262 ;; We cannot remove the top level directory. |
2264 ;; We cannot remove the top level directory. | 2263 ;; Just make it look a little nicer. |
2265 ;; Just make it look a little nicer. | 2264 (forward-line 1) |
2266 (forward-line 1) | 2265 (kill-line) |
2267 (kill-line) | 2266 (if (not (dired-next-subdir 1 t)) |
2268 (if (not (dired-next-subdir 1 t)) | 2267 (goto-char (point-max)))))) |
2269 (goto-char (point-max)))))) | 2268 (goto-char (point-min))) |
2270 (goto-char (point-min)))) | |
2271 | 2269 |
2272 (defun vc-dired-buffers-for-dir (dir) | 2270 (defun vc-dired-buffers-for-dir (dir) |
2273 "Return a list of all vc-dired buffers that currently display DIR." | 2271 "Return a list of all vc-dired buffers that currently display DIR." |
2274 (let (result) | 2272 (let (result) |
2275 ;; Check whether dired is loaded. | 2273 ;; Check whether dired is loaded. |
2563 A prefix argument NOREVERT means do not revert the buffer afterwards." | 2561 A prefix argument NOREVERT means do not revert the buffer afterwards." |
2564 (interactive "P") | 2562 (interactive "P") |
2565 (vc-ensure-vc-buffer) | 2563 (vc-ensure-vc-buffer) |
2566 (let* ((file (buffer-file-name)) | 2564 (let* ((file (buffer-file-name)) |
2567 (backend (vc-backend file)) | 2565 (backend (vc-backend file)) |
2568 (target (vc-workfile-version file)) | 2566 (target (vc-workfile-version file))) |
2569 (config (current-window-configuration)) done) | |
2570 (cond | 2567 (cond |
2571 ((not (vc-find-backend-function backend 'cancel-version)) | 2568 ((not (vc-find-backend-function backend 'cancel-version)) |
2572 (error "Sorry, canceling versions is not supported under %s" backend)) | 2569 (error "Sorry, canceling versions is not supported under %s" backend)) |
2573 ((not (vc-call latest-on-branch-p file)) | 2570 ((not (vc-call latest-on-branch-p file)) |
2574 (error "This is not the latest version; VC cannot cancel it")) | 2571 (error "This is not the latest version; VC cannot cancel it")) |
2679 (copy-file file modified-file 'ok-if-already-exists) | 2676 (copy-file file modified-file 'ok-if-already-exists) |
2680 ;; If we have a local copy of the unmodified file, handle that | 2677 ;; If we have a local copy of the unmodified file, handle that |
2681 ;; here and not in vc-revert-file because we don't want to | 2678 ;; here and not in vc-revert-file because we don't want to |
2682 ;; delete that copy -- it is still useful for OLD-BACKEND. | 2679 ;; delete that copy -- it is still useful for OLD-BACKEND. |
2683 (if unmodified-file | 2680 (if unmodified-file |
2684 (copy-file unmodified-file file 'ok-if-already-exists) | 2681 (copy-file unmodified-file file |
2682 'ok-if-already-exists 'keep-date) | |
2685 (if (y-or-n-p "Get base version from master? ") | 2683 (if (y-or-n-p "Get base version from master? ") |
2686 (vc-revert-file file)))) | 2684 (vc-revert-file file)))) |
2687 (vc-call-backend new-backend 'receive-file file rev)) | 2685 (vc-call-backend new-backend 'receive-file file rev)) |
2688 (when modified-file | 2686 (when modified-file |
2689 (vc-switch-backend file new-backend) | 2687 (vc-switch-backend file new-backend) |
2724 (error "This is unsafe in the presence of symbolic links")) | 2722 (error "This is unsafe in the presence of symbolic links")) |
2725 (rename-file | 2723 (rename-file |
2726 oldmaster | 2724 oldmaster |
2727 (catch 'found | 2725 (catch 'found |
2728 ;; If possible, keep the master file in the same directory. | 2726 ;; If possible, keep the master file in the same directory. |
2729 (mapcar (lambda (f) | 2727 (dolist (f masters) |
2730 (if (and f (string= (file-name-directory (expand-file-name f)) | 2728 (if (and f (string= (file-name-directory (expand-file-name f)) dir)) |
2731 dir)) | 2729 (throw 'found f))) |
2732 (throw 'found f))) | |
2733 masters) | |
2734 ;; If not, just use the first possible place. | 2730 ;; If not, just use the first possible place. |
2735 (mapcar (lambda (f) | 2731 (dolist (f masters) |
2736 (and f | 2732 (and f (or (not (setq dir (file-name-directory f))) |
2737 (or (not (setq dir (file-name-directory f))) | 2733 (file-directory-p dir)) |
2738 (file-directory-p dir)) | 2734 (throw 'found f))) |
2739 (throw 'found f))) | |
2740 masters) | |
2741 (error "New file lacks a version control directory"))))) | 2735 (error "New file lacks a version control directory"))))) |
2742 | 2736 |
2743 ;;;###autoload | 2737 ;;;###autoload |
2744 (defun vc-rename-file (old new) | 2738 (defun vc-rename-file (old new) |
2745 "Rename file OLD to NEW, and rename its master file likewise." | 2739 "Rename file OLD to NEW, and rename its master file likewise." |
2746 (interactive "fVC rename file: \nFRename to: ") | 2740 (interactive "fVC rename file: \nFRename to: ") |
2747 (let ((oldbuf (get-file-buffer old)) | 2741 (let ((oldbuf (get-file-buffer old)) |
2748 (backend (vc-backend old))) | 2742 (backend (vc-backend old))) |
2749 (unless (or (null backend) (vc-find-backend-function backend 'rename-file)) | 2743 (unless (vc-find-backend-function backend 'rename-file) |
2750 (error "Renaming files under %s is not supported in VC" backend)) | 2744 (error "Renaming files under %s is not supported in VC" backend)) |
2751 (if (and oldbuf (buffer-modified-p oldbuf)) | 2745 (if (and oldbuf (buffer-modified-p oldbuf)) |
2752 (error "Please save files before moving them")) | 2746 (error "Please save files before moving them")) |
2753 (if (get-file-buffer new) | 2747 (if (get-file-buffer new) |
2754 (error "Already editing new file name")) | 2748 (error "Already editing new file name")) |
2755 (if (file-exists-p new) | 2749 (if (file-exists-p new) |
2756 (error "New file already exists")) | 2750 (error "New file already exists")) |
2757 (when backend | 2751 (vc-call-backend backend 'rename-file old new) |
2758 (if (and backend (not (vc-up-to-date-p old))) | 2752 (vc-file-clearprops old) |
2759 (error "Please check in files before moving them")) | |
2760 (vc-call-backend backend 'rename-file old new)) | |
2761 ;; Move the actual file (unless the backend did it already) | 2753 ;; Move the actual file (unless the backend did it already) |
2762 (if (or (not backend) (file-exists-p old)) | 2754 (if (or (not backend) (file-exists-p old)) |
2763 (rename-file old new)) | 2755 (rename-file old new)) |
2764 ;; ?? Renaming a file might change its contents due to keyword expansion. | 2756 ;; ?? Renaming a file might change its contents due to keyword expansion. |
2765 ;; We should really check out a new copy if the old copy was precisely equal | 2757 ;; We should really check out a new copy if the old copy was precisely equal |
3054 (if prefix | 3046 (if prefix |
3055 (setq vc-annotate-display-mode | 3047 (setq vc-annotate-display-mode |
3056 (float (string-to-number | 3048 (float (string-to-number |
3057 (read-string "Annotate span days: (default 20) " | 3049 (read-string "Annotate span days: (default 20) " |
3058 nil nil "20"))))) | 3050 nil nil "20"))))) |
3059 (setq vc-annotate-backend (vc-backend (buffer-file-name))) | 3051 (setq vc-annotate-backend (vc-backend buffer-file-name)) |
3060 (message "Annotating...") | 3052 (message "Annotating...") |
3061 (if (not (vc-find-backend-function vc-annotate-backend 'annotate-command)) | 3053 (if (not (vc-find-backend-function vc-annotate-backend 'annotate-command)) |
3062 (error "Sorry, annotating is not implemented for %s" | 3054 (error "Sorry, annotating is not implemented for %s" |
3063 vc-annotate-backend)) | 3055 vc-annotate-backend)) |
3064 (with-output-to-temp-buffer temp-buffer-name | 3056 (with-output-to-temp-buffer temp-buffer-name |
3065 (vc-call-backend vc-annotate-backend 'annotate-command | 3057 (vc-call-backend vc-annotate-backend 'annotate-command |
3066 (file-name-nondirectory (buffer-file-name)) | 3058 buffer-file-name |
3067 (get-buffer temp-buffer-name) | 3059 (get-buffer temp-buffer-name) |
3068 vc-annotate-version)) | 3060 vc-annotate-version)) |
3069 ;; Don't use the temp-buffer-name until the buffer is created | 3061 ;; Don't use the temp-buffer-name until the buffer is created |
3070 ;; (only after `with-output-to-temp-buffer'.) | 3062 ;; (only after `with-output-to-temp-buffer'.) |
3071 (setq vc-annotate-buffers | 3063 (setq vc-annotate-buffers |
3149 (set-face-foreground tmp-face (cdr color)) | 3141 (set-face-foreground tmp-face (cdr color)) |
3150 (if vc-annotate-background | 3142 (if vc-annotate-background |
3151 (set-face-background tmp-face | 3143 (set-face-background tmp-face |
3152 vc-annotate-background)) | 3144 vc-annotate-background)) |
3153 tmp-face))) ; Return the face | 3145 tmp-face))) ; Return the face |
3154 (point (point)) | 3146 (point (point))) |
3155 overlay) | |
3156 (forward-line 1) | 3147 (forward-line 1) |
3157 (put-text-property point (point) 'face face))) | 3148 (put-text-property point (point) 'face face))) |
3158 ;; Pretend to font-lock there were no matches. | 3149 ;; Pretend to font-lock there were no matches. |
3159 nil)) | 3150 nil)) |
3160 | 3151 |