annotate lisp/ediff-vers.el @ 94353:f7eb2887e5b5

(define-abbrev-table): Apply props even if the table exists already.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 26 Apr 2008 01:59:04 +0000
parents 1e3a407766b9
children 878f098b5221
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1 ;;; ediff-vers.el --- version control interface to Ediff
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
2
74439
ddcbd2c1b70d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 71382
diff changeset
3 ;; Copyright (C) 1995, 1996, 1997, 2001, 2002, 2003, 2004,
79721
73661ddc7ac7 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78236
diff changeset
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
5
42602
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
6 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
7
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
9
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
78236
9355f9b7bbff Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
12 ;; the Free Software Foundation; either version 3, or (at your option)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
13 ;; any later version.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
14
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
18 ;; GNU General Public License for more details.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
19
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
23 ;; Boston, MA 02110-1301, USA.
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
24
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 35109
diff changeset
25 ;;; Commentary:
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
26
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
27 ;;; Code:
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
28
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
29 ;; Compiler pacifier
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
30 (defvar rcs-default-co-switches)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
31 (defvar sc-mode)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
32 (defvar cvs-shell)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
33 (defvar cvs-program)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
34 (defvar cvs-cookie-handle)
18054
0b9d9cbf3cd4 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
35 (defvar ediff-temp-file-prefix)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
36
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
37 (and noninteractive
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
38 (eval-when-compile
93773
d7554c14325c 2008-04-06 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 93652
diff changeset
39 (condition-case nil
d7554c14325c 2008-04-06 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 93652
diff changeset
40 ;; for compatibility with current stable version of xemacs
d7554c14325c 2008-04-06 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 93652
diff changeset
41 (progn
d7554c14325c 2008-04-06 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 93652
diff changeset
42 ;;(require 'pcvs nil 'noerror)
d7554c14325c 2008-04-06 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 93652
diff changeset
43 ;;(require 'rcs nil 'noerror)
d7554c14325c 2008-04-06 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 93652
diff changeset
44 (require 'pcvs)
d7554c14325c 2008-04-06 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 93652
diff changeset
45 (require 'rcs))
d7554c14325c 2008-04-06 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 93652
diff changeset
46 (error nil))
93652
6523ed37006c 2008-04-04 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 87649
diff changeset
47 (require 'vc)
6523ed37006c 2008-04-04 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 87649
diff changeset
48 (require 'ediff-init)
6523ed37006c 2008-04-04 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 87649
diff changeset
49 ))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
50 ;; end pacifier
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
51
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
52 (defcustom ediff-keep-tmp-versions nil
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
53 "*If t, do not delete temporary previous versions for the files on which
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
54 comparison or merge operations are being performed."
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
55 :type 'boolean
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
56 :group 'ediff-vers
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
57 )
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
58
85890
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
59 (defalias 'ediff-vc-revision-other-window
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
60 (if (fboundp 'vc-revision-other-window)
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
61 'vc-revision-other-window
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
62 'vc-version-other-window))
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
63
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
64 (defalias 'ediff-vc-working-revision
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
65 (if (fboundp 'vc-working-revision)
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
66 'vc-working-revision
85901
990d0964a0cc 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85890
diff changeset
67 'vc-workfile-version))
85890
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
68
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
69 ;; VC.el support
49428
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
70
85890
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
71 (eval-when-compile
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
72 (require 'vc-hooks)) ;; for vc-call macro
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
73
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
74
49428
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
75 (defun ediff-vc-latest-version (file)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
76 "Return the version level of the latest version of FILE in repository."
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
77 (if (fboundp 'vc-latest-version)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
78 (vc-latest-version file)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
79 (or (vc-file-getprop file 'vc-latest-version)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
80 (cond ((vc-backend file)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
81 (vc-call state file)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
82 (vc-file-getprop file 'vc-latest-version))
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
83 (t (error "File %s is not under version control" file))))
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
84 ))
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
85
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
86
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
87 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks)
49428
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
88 ;; Run Ediff on versions of the current buffer.
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
89 ;; If REV1 is "", use the latest version of the current buffer's file.
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
90 ;; If REV2 is "" then compare current buffer with REV1.
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
91 ;; If the current buffer is named `F', the version is named `F.~REV~'.
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
92 ;; If `F.~REV~' already exists, it is used instead of being re-created.
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
93 (let (file1 file2 rev1buf rev2buf)
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
94 (if (string= rev1 "")
49428
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
95 (setq rev1 (ediff-vc-latest-version (buffer-file-name))))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
96 (save-window-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
97 (save-excursion
85890
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
98 (ediff-vc-revision-other-window rev1)
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
99 (setq rev1buf (current-buffer)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
100 file1 (buffer-file-name)))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
101 (save-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
102 (or (string= rev2 "") ; use current buffer
85890
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
103 (ediff-vc-revision-other-window rev2))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
104 (setq rev2buf (current-buffer)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
105 file2 (buffer-file-name)))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
106 (setq startup-hooks
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
107 (cons `(lambda ()
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
108 (ediff-delete-version-file ,file1)
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
109 (or ,(string= rev2 "") (ediff-delete-version-file ,file2)))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
110 startup-hooks)))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
111 (ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
112 rev1buf rev2buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
113 startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
114 'ediff-revision)))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
115
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
116 ;; RCS.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
117 (defun rcs-ediff-view-revision (&optional rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
118 ;; View previous RCS revision of current file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
119 ;; With prefix argument, prompts for a revision name.
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
120 (interactive (list (if current-prefix-arg
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
121 (read-string "Revision: "))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
122 (let* ((filename (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
123 (switches (append '("-p")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
124 (if rev (list (concat "-r" rev)) nil)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
125 (buff (concat (file-name-nondirectory filename) ".~" rev "~")))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
126 (message "Working ...")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
127 (setq filename (expand-file-name filename))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
128 (with-output-to-temp-buffer buff
33391
f8c8c2d3538e (rcs-ediff-view-revision): Put temp buffer into
Dave Love <fx@gnu.org>
parents: 33019
diff changeset
129 (ediff-with-current-buffer standard-output
f8c8c2d3538e (rcs-ediff-view-revision): Put temp buffer into
Dave Love <fx@gnu.org>
parents: 33019
diff changeset
130 (fundamental-mode))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
131 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
132 (delete-windows-on output-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
133 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
134 (set-buffer output-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
135 (apply 'call-process "co" nil t nil
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
136 ;; -q: quiet (no diagnostics)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
137 (append switches rcs-default-co-switches
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
138 (list "-q" filename)))))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
139 (message "")
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
140 buff)))
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
141
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
142 (defun ediff-rcs-get-output-buffer (file name)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
143 ;; Get a buffer for RCS output for FILE, make it writable and clean it up.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
144 ;; Optional NAME is name to use instead of `*RCS-output*'.
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26039
diff changeset
145 ;; This is a modified version from rcs.el v1.1. I use it here to make
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
146 ;; Ediff immune to changes in rcs.el
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
147 (let* ((default-major-mode 'fundamental-mode) ; no frills!
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
148 (buf (get-buffer-create name)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
149 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
150 (set-buffer buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
151 (setq buffer-read-only nil
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
152 default-directory (file-name-directory (expand-file-name file)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
153 (erase-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
154 buf))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
155
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
156 (defun ediff-rcs-internal (rev1 rev2 &optional startup-hooks)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
157 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
158 ;; If REV2 is "" then use current buffer.
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
159 (let (rev2buf rev1buf)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
160 (save-window-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
161 (setq rev2buf (if (string= rev2 "")
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
162 (current-buffer)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
163 (rcs-ediff-view-revision rev2))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
164 rev1buf (rcs-ediff-view-revision rev1)))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
165
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
166 ;; rcs.el doesn't create temp version files, so we don't have to delete
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
167 ;; anything in startup hooks to ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
168 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
169 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
170
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
171 ;;; Merge with Version Control
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
172
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
173 (defun ediff-vc-merge-internal (rev1 rev2 ancestor-rev
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
174 &optional startup-hooks merge-buffer-file)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
175 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
176 (let (buf1 buf2 ancestor-buf)
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
177 (save-window-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
178 (save-excursion
85890
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
179 (ediff-vc-revision-other-window rev1)
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
180 (setq buf1 (current-buffer)))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
181 (save-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
182 (or (string= rev2 "")
85890
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
183 (ediff-vc-revision-other-window rev2))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
184 (setq buf2 (current-buffer)))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
185 (if ancestor-rev
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
186 (save-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
187 (if (string= ancestor-rev "")
85890
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
188 (setq ancestor-rev (ediff-vc-working-revision buffer-file-name)))
d505125b0b46 2007-11-02 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 85825
diff changeset
189 (ediff-vc-revision-other-window ancestor-rev)
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
190 (setq ancestor-buf (current-buffer))))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
191 (setq startup-hooks
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
192 (cons
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
193 `(lambda ()
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
194 (ediff-delete-version-file ,(buffer-file-name buf1))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
195 (or ,(string= rev2 "")
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
196 (ediff-delete-version-file ,(buffer-file-name buf2)))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
197 (or ,(string= ancestor-rev "")
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
198 ,(not ancestor-rev)
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
199 (ediff-delete-version-file ,(buffer-file-name ancestor-buf)))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
200 )
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
201 startup-hooks)))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
202 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
203 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
204 buf1 buf2 ancestor-buf
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
205 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file)
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
206 (ediff-merge-buffers
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
207 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
208 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
209
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
210 (defun ediff-rcs-merge-internal (rev1 rev2 ancestor-rev
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
211 &optional
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
212 startup-hooks merge-buffer-file)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
213 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
214 (let (buf1 buf2 ancestor-buf)
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
215 (save-window-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
216 (setq buf1 (rcs-ediff-view-revision rev1)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
217 buf2 (if (string= rev2 "")
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
218 (current-buffer)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
219 (rcs-ediff-view-revision rev2))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
220 ancestor-buf (if ancestor-rev
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
221 (if (string= ancestor-rev "")
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
222 (current-buffer)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
223 (rcs-ediff-view-revision ancestor-rev)))))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
224 ;; rcs.el doesn't create temp version files, so we don't have to delete
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
225 ;; anything in startup hooks to ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
226 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
227 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
228 buf1 buf2 ancestor-buf
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
229 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file)
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
230 (ediff-merge-buffers
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
231 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file))))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
232
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
233
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
234 ;; delete version file on exit unless ediff-keep-tmp-versions is true
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
235 (defun ediff-delete-version-file (file)
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
236 (or ediff-keep-tmp-versions (delete-file file)))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
237
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64091
diff changeset
238
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64091
diff changeset
239 (provide 'ediff-vers)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64091
diff changeset
240
68997
6169b51037af 2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68651
diff changeset
241
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
242 ;;; Local Variables:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
243 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
19047
f90d40b0bff5 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18054
diff changeset
244 ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
f90d40b0bff5 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18054
diff changeset
245 ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
246 ;;; End:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
247
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93773
diff changeset
248 ;; arch-tag: bbb34f0c-2a90-426a-a77a-c75f479ebbbf
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
249 ;;; ediff-vers.el ends here