diff options
| author | André Spiegel | 2001-03-10 10:44:35 +0000 |
|---|---|---|
| committer | André Spiegel | 2001-03-10 10:44:35 +0000 |
| commit | ad339989e50c06b5465428ea416f8e6e1007707f (patch) | |
| tree | 45583357304e610b472174cb2ca396f8496c42b2 | |
| parent | b18f5523f42e8699cf7a3e6b35eeaf21ae045ad6 (diff) | |
| download | emacs-ad339989e50c06b5465428ea416f8e6e1007707f.tar.gz emacs-ad339989e50c06b5465428ea416f8e6e1007707f.zip | |
(vc-do-command): If the destination buffer is already current, don't
set it up and don't erase it. Updated doc string to reflect that.
(vc-version-diff): When doing a single file diff, don't switch to the
*vc-diff* buffer before the command. This is to preserve local variable
bindings that might affect the diff command.
(vc-print-log): Don't switch to the *vc* buffer before the command, so
that local variable bindings are preserved.
| -rw-r--r-- | lisp/vc.el | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index b8240e1fac8..8fbd2bc27e9 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -5,7 +5,7 @@ | |||
| 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.296 2001/02/01 17:41:06 fx Exp $ | 8 | ;; $Id: vc.el,v 1.297 2001/02/26 13:45:06 spiegel Exp $ |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
| @@ -240,7 +240,7 @@ | |||
| 240 | ;; | 240 | ;; |
| 241 | ;; * print-log (file) | 241 | ;; * print-log (file) |
| 242 | ;; | 242 | ;; |
| 243 | ;; Insert the revision log of FILE into the current buffer. | 243 | ;; Insert the revision log of FILE into the *vc* buffer. |
| 244 | ;; | 244 | ;; |
| 245 | ;; - show-log-entry (version) | 245 | ;; - show-log-entry (version) |
| 246 | ;; | 246 | ;; |
| @@ -277,7 +277,7 @@ | |||
| 277 | ;; | 277 | ;; |
| 278 | ;; * diff (file &optional rev1 rev2) | 278 | ;; * diff (file &optional rev1 rev2) |
| 279 | ;; | 279 | ;; |
| 280 | ;; Insert the diff for FILE into the current buffer. If REV1 and REV2 | 280 | ;; Insert the diff for FILE into the *vc-diff* buffer. If REV1 and REV2 |
| 281 | ;; are non-nil, report differences from REV1 to REV2. If REV1 is nil, | 281 | ;; are non-nil, report differences from REV1 to REV2. If REV1 is nil, |
| 282 | ;; use the current workfile version (as found in the repository) as the | 282 | ;; use the current workfile version (as found in the repository) as the |
| 283 | ;; older version; if REV2 is nil, use the current workfile contents as | 283 | ;; older version; if REV2 is nil, use the current workfile contents as |
| @@ -826,19 +826,24 @@ and is passed 3 argument: the COMMAND, the FILE and the FLAGS.") | |||
| 826 | 826 | ||
| 827 | (defun vc-do-command (buffer okstatus command file &rest flags) | 827 | (defun vc-do-command (buffer okstatus command file &rest flags) |
| 828 | "Execute a version control command, notifying user and checking for errors. | 828 | "Execute a version control command, notifying user and checking for errors. |
| 829 | Output from COMMAND goes to BUFFER, or *vc* if BUFFER is nil or the current | 829 | Output from COMMAND goes to BUFFER, or *vc* if BUFFER is nil or the |
| 830 | buffer (which is assumed to be properly setup) if BUFFER is t. The | 830 | current buffer if BUFFER is t. If the destination buffer is not |
| 831 | command is considered successful if its exit status does not exceed | 831 | already current, set it up properly and erase it. The command is |
| 832 | OKSTATUS (if OKSTATUS is nil, that means to ignore errors, if it is 'async, | 832 | considered successful if its exit status does not exceed OKSTATUS (if |
| 833 | that means not to wait for termination of the subprocess). FILE is | 833 | OKSTATUS is nil, that means to ignore errors, if it is 'async, that |
| 834 | the name of the working file (may also be nil, to execute commands | 834 | means not to wait for termination of the subprocess). FILE is the |
| 835 | that don't expect a file name). If an optional list of FLAGS is present, | 835 | name of the working file (may also be nil, to execute commands that |
| 836 | don't expect a file name). If an optional list of FLAGS is present, | ||
| 836 | that is inserted into the command line before the filename." | 837 | that is inserted into the command line before the filename." |
| 837 | (and file (setq file (expand-file-name file))) | 838 | (and file (setq file (expand-file-name file))) |
| 838 | (if vc-command-messages | 839 | (if vc-command-messages |
| 839 | (message "Running %s on %s..." command file)) | 840 | (message "Running %s on %s..." command file)) |
| 840 | (save-current-buffer | 841 | (save-current-buffer |
| 841 | (unless (eq buffer t) (vc-setup-buffer buffer)) | 842 | (unless (or (eq buffer t) |
| 843 | (and (stringp buffer) | ||
| 844 | (string= (buffer-name) buffer)) | ||
| 845 | (eq buffer (current-buffer))) | ||
| 846 | (vc-setup-buffer buffer)) | ||
| 842 | (let ((squeezed nil) | 847 | (let ((squeezed nil) |
| 843 | (inhibit-read-only t) | 848 | (inhibit-read-only t) |
| 844 | (status 0)) | 849 | (status 0)) |
| @@ -1727,17 +1732,18 @@ files in or below it." | |||
| 1727 | rel2-default ") ") | 1732 | rel2-default ") ") |
| 1728 | "Newer version (default: current source): ") | 1733 | "Newer version (default: current source): ") |
| 1729 | nil nil rel2-default)))) | 1734 | nil nil rel2-default)))) |
| 1730 | (vc-setup-buffer "*vc-diff*") | ||
| 1731 | (if (file-directory-p file) | 1735 | (if (file-directory-p file) |
| 1732 | ;; recursive directory diff | 1736 | ;; recursive directory diff |
| 1733 | (let ((inhibit-read-only t)) | 1737 | (progn |
| 1738 | (vc-setup-buffer "*vc-diff*") | ||
| 1734 | (if (string-equal rel1 "") (setq rel1 nil)) | 1739 | (if (string-equal rel1 "") (setq rel1 nil)) |
| 1735 | (if (string-equal rel2 "") (setq rel2 nil)) | 1740 | (if (string-equal rel2 "") (setq rel2 nil)) |
| 1736 | (insert "Diffs between " | 1741 | (let ((inhibit-read-only t)) |
| 1737 | (or rel1 "last version checked in") | 1742 | (insert "Diffs between " |
| 1738 | " and " | 1743 | (or rel1 "last version checked in") |
| 1739 | (or rel2 "current workfile(s)") | 1744 | " and " |
| 1740 | ":\n\n") | 1745 | (or rel2 "current workfile(s)") |
| 1746 | ":\n\n")) | ||
| 1741 | (setq default-directory (file-name-as-directory file)) | 1747 | (setq default-directory (file-name-as-directory file)) |
| 1742 | ;; FIXME: this should do a single exec in CVS. | 1748 | ;; FIXME: this should do a single exec in CVS. |
| 1743 | (vc-file-tree-walk | 1749 | (vc-file-tree-walk |
| @@ -1759,7 +1765,7 @@ files in or below it." | |||
| 1759 | file | 1765 | file |
| 1760 | (vc-version-backup-file file rel2)))) | 1766 | (vc-version-backup-file file rel2)))) |
| 1761 | (if (and file-rel1 file-rel2) | 1767 | (if (and file-rel1 file-rel2) |
| 1762 | (apply 'vc-do-command t 1 "diff" nil | 1768 | (apply 'vc-do-command "*vc-diff*" 1 "diff" nil |
| 1763 | (append (if (listp diff-switches) | 1769 | (append (if (listp diff-switches) |
| 1764 | diff-switches | 1770 | diff-switches |
| 1765 | (list diff-switches)) | 1771 | (list diff-switches)) |
| @@ -1768,8 +1774,8 @@ files in or below it." | |||
| 1768 | (list vc-diff-switches)) | 1774 | (list vc-diff-switches)) |
| 1769 | (list (file-relative-name file-rel1) | 1775 | (list (file-relative-name file-rel1) |
| 1770 | (file-relative-name file-rel2)))) | 1776 | (file-relative-name file-rel2)))) |
| 1771 | (cd (file-name-directory file)) | ||
| 1772 | (vc-call diff file rel1 rel2)))) | 1777 | (vc-call diff file rel1 rel2)))) |
| 1778 | (set-buffer "*vc-diff*") | ||
| 1773 | (if (and (zerop (buffer-size)) | 1779 | (if (and (zerop (buffer-size)) |
| 1774 | (not (get-buffer-process (current-buffer)))) | 1780 | (not (get-buffer-process (current-buffer)))) |
| 1775 | (progn | 1781 | (progn |
| @@ -2363,9 +2369,8 @@ allowed and simply skipped)." | |||
| 2363 | (interactive) | 2369 | (interactive) |
| 2364 | (vc-ensure-vc-buffer) | 2370 | (vc-ensure-vc-buffer) |
| 2365 | (let ((file buffer-file-name)) | 2371 | (let ((file buffer-file-name)) |
| 2366 | (vc-setup-buffer nil) | ||
| 2367 | (setq default-directory (file-name-directory file)) | ||
| 2368 | (vc-call print-log file) | 2372 | (vc-call print-log file) |
| 2373 | (set-buffer "*vc*") | ||
| 2369 | (pop-to-buffer (current-buffer)) | 2374 | (pop-to-buffer (current-buffer)) |
| 2370 | (if (fboundp 'log-view-mode) (log-view-mode)) | 2375 | (if (fboundp 'log-view-mode) (log-view-mode)) |
| 2371 | (vc-exec-after | 2376 | (vc-exec-after |