annotate lisp/ediff-mult.el @ 16439:0c61b1f40de2

(describe-function): If no fn specified, say so. (variable-at-point): Return 0 if no variable there. (describe-variable): If no variable specified, say so. Don't use nil as the variable.
author Richard M. Stallman <rms@gnu.org>
date Sun, 13 Oct 1996 13:59:51 +0000
parents b2fae8abc5b0
children beb94a5271e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13607
71a4a349d998 Renamed from ediff-meta.el. Changed provide.
Richard M. Stallman <rms@gnu.org>
parents: 13216
diff changeset
1 ;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
2
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
3 ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
4
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
6
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
8
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
12 ;; any later version.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
13
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
17 ;; GNU General Public License for more details.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
18
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
22 ;; Boston, MA 02111-1307, USA.
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
23
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
24 ;;; Commentary:
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
25
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
26 ;; Users are encouraged to add functionality to this file.
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
27 ;; The present file contains all the infrastructure needed for that.
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
28 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
29 ;; Generally, to to implement a new multisession capability within Ediff,
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
30 ;; you need to tell it
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
31 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
32 ;; 1. How to display the session group buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
33 ;; This function must indicate which Ediff sessions are active (+) and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
34 ;; which are finished (-).
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
35 ;; See ediff-redraw-directory-group-buffer for an example.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
36 ;; In all likelihood, ediff-redraw-directory-group-buffer can be used
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
37 ;; directly or after a small modification.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
38 ;; 2. What action to take when the user clicks button 2 or types v,e, or
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
39 ;; RET. See ediff-filegroup-action.
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
40 ;; 3. Provide a list of pairs or triples of file names (or buffers,
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
41 ;; depending on the particular Ediff operation you want to invoke)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
42 ;; in the following format:
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
43 ;; (descriptor (obj1 obj2 obj3) (...) ...)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
44 ;; Actually, the format of this list is pretty much up to the
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
45 ;; developer. The only thing is that it must be a list of lists,
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
46 ;; and the first list must describe the meta session, and subsequent
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
47 ;; elements must describe individual sessions.
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
48 ;; This descriptor must be a list of two, three, or four elements (nil
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
49 ;; or string). The function ediff-redraw-registry-buffer displays the
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
50 ;; second through last of these in the registry buffer.
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
51 ;; Also, keep in mind that the function ediff-prepare-meta-buffer
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
52 ;; (which see) prepends the session group buffer to the descriptor and
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
53 ;; nil in front of each subsequent list (i.e., the above list
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
54 ;; will become
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
55 ;; ((meta-buf descriptor) (nil obj1 obj2 obj3) (nil ...) ...)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
56 ;; Ediff expects that your function (in 2 above) will arrange to
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
57 ;; replace this prepended nil (via setcar) with the actual ediff
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
58 ;; control buffer associated with an appropriate Ediff session.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
59 ;; This is arranged through internal startup hooks that can be passed
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
60 ;; to any of Ediff major entries (such as ediff-files, epatch, etc.).
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
61 ;; See how this is done in ediff-filegroup-action.
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
62 ;;
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
63 ;; Session descriptions are of the form (obj1 obj2 obj3), which
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
64 ;; describe objects relevant to the session. Usually they are names of
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
65 ;; files, but sometimes they may be other things. For instance, obj3 is
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
66 ;; nil for jobs that involve only two files. For patch jobs, obj2 and
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
67 ;; obj3 are markers that specify the patch corresponding to the file
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
68 ;; (whose name is obj1).
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
69 ;; 4. Write a function that makes a call to ediff-prepare-meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
70 ;; passing all this info.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
71 ;; You may be able to use ediff-directories-internal as a template.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
72 ;; 5. If you intend to add several related pieces of functionality,
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
73 ;; you may want to keep the function in 4 as an internal version
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
74 ;; and then write several top-level interactive functions that call it
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
75 ;; with different parameters.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
76 ;; See how ediff-directories, ediff-merge-directories, and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
77 ;; ediff-merge-directories-with-ancestor all use
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
78 ;; ediff-directories-internal.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
79 ;;
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
80 ;; A useful addition here could be session groups selected by patterns
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
81 ;; (which are different in each directory). For instance, one may want to
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
82 ;; compare files of the form abc{something}.c to files old{something}.d
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
83 ;; which may be in the same or different directories. Or, one may want to
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
84 ;; compare all files of the form {something} to files of the form {something}~.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
85 ;;
13216
b9dc8cc658d5 Moved defsubsts up.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13130
diff changeset
86 ;; Implementing this requires writing an collating function, which should pair
b9dc8cc658d5 Moved defsubsts up.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13130
diff changeset
87 ;; up appropriate files. It will also require a generalization of the functions
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
88 ;; that do the layout of the meta- and differences buffers and of
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
89 ;; ediff-filegroup-action.
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
90
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
91 ;;; Code:
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
92
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
93 (require 'ediff-init)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
94
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
95 ;; meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
96 (ediff-defvar-local ediff-meta-buffer nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
97 (ediff-defvar-local ediff-parent-meta-buffer nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
98 ;; the registry buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
99 (defvar ediff-registry-buffer nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
100
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
101 (defconst ediff-meta-buffer-message "This is an Ediff Session Group Panel: %s
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
102
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
103 Useful commands:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
104 button2, `v', RET over a session line: start that Ediff session
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
105 `M':\tin any session invoked from here, brings back this group panel
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
106 `R':\tdisplay the registry of active Ediff sessions
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
107 `h':\tmark session for hiding (toggle)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
108 `x':\thide marked sessions; with prefix arg--unhide hidden sessions
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
109 `m':\tmark session for a non-hiding operation (toggle)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
110 SPC:\tnext session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
111 DEL:\tprevious session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
112 `E':\tbrowse Ediff on-line manual
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
113 `q':\tquit this session group
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
114 ")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
115
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
116 (ediff-defvar-local ediff-meta-buffer-map nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
117 "The keymap for the meta buffer.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
118 (defvar ediff-dir-diffs-buffer-map (make-sparse-keymap)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
119 "The keymap to be installed in the buffer showing differences between
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
120 directories.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
121
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
122 ;; Variable specifying the action to take when the use invokes ediff in the
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
123 ;; meta buffer. This is usually ediff-registry-action or ediff-filegroup-action
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
124 (ediff-defvar-local ediff-meta-action-function nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
125 ;; Tells ediff-update-meta-buffer how to redraw it
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
126 (ediff-defvar-local ediff-meta-redraw-function nil "")
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
127 ;; Tells ediff-filegroup-action and similar procedures how to invoke Ediff for
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
128 ;; the sessions in a given session group
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
129 (ediff-defvar-local ediff-session-action-function nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
131 (ediff-defvar-local ediff-metajob-name nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
132
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
133 ;; buffer used to collect custom diffs from individual sessions in the group
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
134 (ediff-defvar-local ediff-meta-diff-buffer nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
135
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
136 ;; history var to use for filtering groups
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
137 (defvar ediff-filtering-regexp-history nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
138
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
139 ;; This has the form ((ctl-buf file1 file2) (stl-buf file1 file2) ...)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
140 ;; If ctl-buf is nil, the file-pair wasn't processed yet. If it is
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
141 ;; killed-buffer object, the file pair has been processed. If it is a live
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
142 ;; buffer, this means ediff is still working on the pair
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
143 (ediff-defvar-local ediff-meta-list nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
144
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
145
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
146 ;; the difference list between directories in a directory session group
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
147 (ediff-defvar-local ediff-dir-difference-list nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
148 (ediff-defvar-local ediff-dir-diffs-buffer nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
149
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
150 ;; The registry of Ediff sessions. A list of control buffers.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
151 (defvar ediff-session-registry nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
152
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
153 (defvar ediff-registry-setup-hook nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
154 "*Hooks run just after the registry control panel is set up.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
155 (defvar ediff-session-group-setup-hook nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
156 "*Hooks run just after a meta-buffer controlling a session group, such as
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
157 ediff-directories, is run.")
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
158 (defvar ediff-quit-session-group-hook nil
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
159 "*Hooks run just before exiting a session group.")
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
160 (defvar ediff-show-registry-hook nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
161 "*Hooks run just after the registry buffer is shown.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
162 (defvar ediff-show-session-group-hook nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
163 "*Hooks run just after a session group buffer is shown.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
164
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
165 ;; buffer holding the multi-file patch. local to the meta buffer
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
166 (ediff-defvar-local ediff-meta-patchbufer nil "")
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
167
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
168 ;;; API for ediff-meta-list
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
169
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
170 ;; group buffer/regexp
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
171 (defun ediff-get-group-buffer (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
172 (nth 0 (car meta-list)))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
173
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
174 (defun ediff-get-group-regexp (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
175 (nth 1 (car meta-list)))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
176 ;; group objects
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
177 (defun ediff-get-group-objA (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
178 (nth 2 (car meta-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
179 (defun ediff-get-group-objB (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
180 (nth 3 (car meta-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
181 (defun ediff-get-group-objC (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
182 (nth 4 (car meta-list)))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
183 (defun ediff-get-group-merge-autostore-dir (meta-list)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
184 (nth 5 (car meta-list)))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
185
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
186 ;; session buffer
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
187 (defun ediff-get-session-buffer (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
188 (nth 0 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
189 (defun ediff-get-session-status (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
190 (nth 1 elt))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
191 (defun ediff-set-session-status (session-info new-status)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
192 (setcar (cdr session-info) new-status))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
193 ;; session objects
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
194 (defun ediff-get-session-objA (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
195 (nth 2 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
196 (defun ediff-get-session-objB (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
197 (nth 3 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
198 (defun ediff-get-session-objC (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
199 (nth 4 elt))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
200 (defun ediff-get-session-objA-name (elt)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
201 (car (nth 2 elt)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
202 (defun ediff-get-session-objB-name (elt)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
203 (car (nth 3 elt)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
204 (defun ediff-get-session-objC-name (elt)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
205 (car (nth 4 elt)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
206 ;; equality indicators
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
207 (defsubst ediff-get-file-eqstatus (elt)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
208 (nth 1 elt))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
209 (defsubst ediff-set-file-eqstatus (elt value)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
210 (setcar (cdr elt) value))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
211
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
212 ;; set up the keymap in the meta buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
213 (defun ediff-setup-meta-map()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
214 (setq ediff-meta-buffer-map (make-sparse-keymap))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
215 (suppress-keymap ediff-meta-buffer-map)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
216 (define-key ediff-meta-buffer-map "q" 'ediff-quit-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
217 (define-key ediff-meta-buffer-map "R" 'ediff-show-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
218 (define-key ediff-meta-buffer-map "E" 'ediff-documentation)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
219 (define-key ediff-meta-buffer-map "v" ediff-meta-action-function)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
220 (define-key ediff-meta-buffer-map "\C-m" ediff-meta-action-function)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
221 (define-key ediff-meta-buffer-map " " 'ediff-next-meta-item)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
222 (define-key ediff-meta-buffer-map "\C-?" 'ediff-previous-meta-item)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
223 (define-key ediff-meta-buffer-map [delete] 'ediff-previous-meta-item)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
224 (define-key ediff-meta-buffer-map [backspace] 'ediff-previous-meta-item)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
225 (or (ediff-one-filegroup-metajob)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
226 (define-key ediff-meta-buffer-map "=" 'ediff-meta-mark-equal-files))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
227 (if ediff-no-emacs-help-in-control-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
228 (define-key ediff-meta-buffer-map "\C-h" 'ediff-previous-meta-item))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
229 (if ediff-emacs-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
230 (define-key ediff-meta-buffer-map [mouse-2] ediff-meta-action-function)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
231 (define-key ediff-meta-buffer-map [button2] ediff-meta-action-function))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
232
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
233 (use-local-map ediff-meta-buffer-map))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
234
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
235 (defun ediff-meta-mode ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
236 "This mode controls all operations on Ediff session groups.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
237 It is entered through one of the following commands:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
238 `ediff-directories'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
239 `edirs'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
240 `ediff-directories3'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
241 `edirs3'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
242 `ediff-merge-directories'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
243 `edirs-merge'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
244 `ediff-merge-directories-with-ancestor'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
245 `edirs-merge-with-ancestor'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
246 `ediff-directory-revisions'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
247 `edir-revisions'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
248 `ediff-merge-directory-revisions'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
249 `edir-merge-revisions'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
250 `ediff-merge-directory-revisions-with-ancestor'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
251 `edir-merge-revisions-with-ancestor'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
252
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
253 Commands:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
254 \\{ediff-meta-buffer-map}"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
255 (kill-all-local-variables)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
256 (setq major-mode 'ediff-meta-mode)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
257 (setq mode-name "MetaEdiff"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
258
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
259
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
260 ;; the keymap for the buffer showing directory differences
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
261 (suppress-keymap ediff-dir-diffs-buffer-map)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
262 (define-key ediff-dir-diffs-buffer-map "q" 'ediff-bury-dir-diffs-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
263 (define-key ediff-dir-diffs-buffer-map " " 'next-line)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
264 (define-key ediff-dir-diffs-buffer-map "\C-?" 'previous-line)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
265 (define-key ediff-dir-diffs-buffer-map [delete] 'previous-line)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
266 (define-key ediff-dir-diffs-buffer-map [backspace] 'previous-line)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
267
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
268 (defun ediff-next-meta-item (count)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
269 "Move to the next item in Ediff registry or session group buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
270 Moves in circular fashion. With numeric prefix arg, skip this many items."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
271 (interactive "p")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
272 (or count (setq count 1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
273 (while (< 0 count)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
274 (setq count (1- count))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
275 (ediff-next-meta-item1)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
276
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
277 ;; Move to the next meta item
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
278 (defun ediff-next-meta-item1 ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
279 (let (pos)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
280 (setq pos (ediff-next-meta-overlay-start (point)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
281 ;;; ;; skip deleted
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
282 ;;; (while (memq (ediff-get-session-status
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
283 ;;; (ediff-get-meta-info (current-buffer) pos 'noerror))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
284 ;;; '(?H ?I))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
285 ;;; (setq pos (ediff-next-meta-overlay-start pos)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
286
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
287 (if pos (goto-char pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
288 (if (eq ediff-metajob-name 'ediff-registry)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
289 (if (and (ediff-get-meta-info (current-buffer) pos 'noerror)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
290 (search-forward "*Ediff" nil t))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
291 (skip-chars-backward "a-zA-Z*"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
292 (if (> (skip-chars-forward "-+?H* \t0-9") 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
293 (backward-char 1)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
294
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
295
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
296 (defun ediff-previous-meta-item (count)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
297 "Move to the previous item in Ediff registry or session group buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
298 Moves in circular fashion. With numeric prefix arg, skip this many items."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
299 (interactive "p")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
300 (or count (setq count 1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
301 (while (< 0 count)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
302 (setq count (1- count))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
303 (ediff-previous-meta-item1)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
304
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
305 (defun ediff-previous-meta-item1 ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
306 (let (pos)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
307 (setq pos (ediff-previous-meta-overlay-start (point)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
308 ;;; ;; skip deleted
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
309 ;;; (while (ediff-get-session-status
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
310 ;;; (ediff-get-meta-info (current-buffer) pos 'noerror))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
311 ;;; (setq pos (ediff-previous-meta-overlay-start pos)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
312
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
313 (if pos (goto-char pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
314 (if (eq ediff-metajob-name 'ediff-registry)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
315 (if (and (ediff-get-meta-info (current-buffer) pos 'noerror)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
316 (search-forward "*Ediff" nil t))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
317 (skip-chars-backward "a-zA-Z*"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
318 (if (> (skip-chars-forward "-+?H* \t0-9") 0)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
319 (backward-char 1)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
320 ))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
321
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
322 (defsubst ediff-add-slash-if-directory (dir file)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
323 (if (file-directory-p (concat dir file))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
324 (file-name-as-directory file)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
325 file))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
326
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
327
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
328 ;; DIR1, DIR2, DIR3 are directories. DIR3 can be nil.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
329 ;; OUTPUT-DIR is a directory for auto-storing the results of merge jobs.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
330 ;; Can be nil.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
331 ;; REGEXP is a regexp used to filter out files in the directories.
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
332 ;; If a file is a directory in dir1 but not dir2 (or vice versa), it is not
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
333 ;; included in the intersection. However, a regular file that is a dir in dir3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
334 ;; is included, since dir3 files are supposed to be ancestors for merging.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
335 ;; Returns a list of the form:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
336 ;; ((dir1 dir2 dir3) (f1 f2 f3) (f1 f2 f3) ...)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
337 ;; dir3, f3 can be nil if intersecting only 2 directories.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
338 ;; If COMPARISON-FUNC is given, use it. Otherwise, use string=
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
339 ;; DIFF-VAR contains the name of the variable in which to return the
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
340 ;; difference list (which represents the differences among the contents of
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
341 ;; directories). The diff list is of the form:
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
342 ;; ((dir1 dir2 dir3) (file . num) (file . num)...)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
343 ;; where num encodes the set of dirs where the file is found:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
344 ;; 2 - only dir1; 3 - only dir2; 5 - only dir3; 6 - dir1&2; 10 - dir1&3; etc.
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
345 (defun ediff-intersect-directories (jobname
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
346 diff-var regexp dir1 dir2
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
347 &optional
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
348 dir3 merge-autostore-dir comparison-func)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
349 (setq comparison-func (or comparison-func 'string=))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
350 (let (lis1 lis2 lis3 common auxdir1 auxdir2 auxdir3 difflist)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
351
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
352 (setq auxdir1 (file-name-as-directory dir1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
353 lis1 (directory-files auxdir1 nil regexp)
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
354 lis1 (delete "." lis1)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
355 lis1 (delete ".." lis1)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
356 lis1 (mapcar
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
357 (function
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
358 (lambda (elt)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
359 (ediff-add-slash-if-directory auxdir1 elt)))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
360 lis1)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
361 auxdir2 (file-name-as-directory dir2)
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
362 lis2 (mapcar
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
363 (function
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
364 (lambda (elt)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
365 (ediff-add-slash-if-directory auxdir2 elt)))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
366 (directory-files auxdir2 nil regexp)))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
367
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
368 (if (stringp dir3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
369 (setq auxdir3 (file-name-as-directory dir3)
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
370 lis3 (mapcar
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
371 (function
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
372 (lambda (elt)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
373 (ediff-add-slash-if-directory auxdir3 elt)))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
374 (directory-files auxdir3 nil regexp))))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
375
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
376 (if (stringp merge-autostore-dir)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
377 (setq merge-autostore-dir
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
378 (file-name-as-directory merge-autostore-dir)))
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
379 (setq common (ediff-intersection lis1 lis2 comparison-func))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
380
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
381 ;; In merge with ancestor jobs, we don't intersect with lis3.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
382 ;; If there is no ancestor, we'll offer to merge without the ancestor.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
383 ;; So, we intersect with lis3 only when we are doing 3-way file comparison
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
384 (if (and lis3 (ediff-comparison-metajob3 jobname))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
385 (setq common (ediff-intersection common lis3 comparison-func)))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
386
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
387 ;; copying is needed because sort sorts via side effects
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
388 (setq common (sort (ediff-copy-list common) 'string-lessp))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
389
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
390 ;; compute difference list
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
391 (setq difflist (ediff-set-difference
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
392 (ediff-union (ediff-union lis1 lis2 comparison-func)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
393 lis3
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
394 comparison-func)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
395 common
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
396 comparison-func)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
397 difflist (delete "." difflist)
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
398 ;; copying is needed because sort sorts via side effects
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
399 difflist (sort (ediff-copy-list (delete ".." difflist))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
400 'string-lessp))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
401
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
402 (setq difflist (mapcar (function (lambda (elt) (cons elt 1))) difflist))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
403
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
404 ;; check for files belonging to lis1/2/3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
405 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
406 (if (member (car elt) lis1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
407 (setcdr elt (* (cdr elt) 2)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
408 (if (member (car elt) lis2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
409 (setcdr elt (* (cdr elt) 3)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
410 (if (member (car elt) lis3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
411 (setcdr elt (* (cdr elt) 5)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
412 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
413 difflist)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
414 (setq difflist (cons (list regexp auxdir1 auxdir2 auxdir3) difflist))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
415
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
416 ;; return the difference list back to the calling function
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
417 (set diff-var difflist)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
418
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
419 ;; return result
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
420 (cons (list regexp auxdir1 auxdir2 auxdir3 merge-autostore-dir)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
421 (mapcar
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
422 (function
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
423 (lambda (elt)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
424 (list (concat auxdir1 elt)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
425 (concat auxdir2 elt)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
426 (if lis3
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
427 (progn
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
428 ;; The following is done because:
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
429 ;; In merging with ancestor, we don't intersect
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
430 ;; with lis3. So, it is possible that elt is a
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
431 ;; file in auxdir1/2 but a directory in auxdir3
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
432 ;; Or elt may not exist in auxdir3 at all.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
433 ;; In the first case, we add a slash at the end.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
434 ;; In the second case, we insert nil.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
435 (setq elt (ediff-add-slash-if-directory auxdir3 elt))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
436 (if (file-exists-p (concat auxdir3 elt))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
437 (concat auxdir3 elt)))))))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
438 common))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
439 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
440
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
441 ;; find directory files that are under revision.
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
442 ;; Include subdirectories, since we may visit them recursively.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
443 ;; DIR1 is the directory to inspect.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
444 ;; OUTPUT-DIR is the directory where to auto-store the results of merges. Can
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
445 ;; be nil.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
446 (defun ediff-get-directory-files-under-revision (jobname
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
447 regexp dir1
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
448 &optional merge-autostore-dir)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
449 (let (lis1 elt common auxdir1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
450 (setq auxdir1 (file-name-as-directory dir1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
451 lis1 (directory-files auxdir1 nil regexp))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
452
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
453 (if (stringp merge-autostore-dir)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
454 (setq merge-autostore-dir
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
455 (file-name-as-directory merge-autostore-dir)))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
456
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
457 (while lis1
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
458 (setq elt (car lis1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
459 lis1 (cdr lis1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
460 ;; take files under revision control
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
461 (cond ((file-directory-p (concat auxdir1 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
462 (setq common (cons elt common)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
463 ((file-exists-p (concat auxdir1 elt ",v"))
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
464 (setq common (cons elt common)))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
465 ((file-exists-p (concat auxdir1 "RCS/" elt ",v"))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
466 (setq common (cons elt common)))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
467 ) ; cond
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
468 ) ; while
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
469
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
470 (setq common (delete "." common)
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
471 common (delete ".." common)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
472 common (delete "RCS" common))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
473
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
474 ;; copying is needed because sort sorts via side effects
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
475 (setq common (sort (ediff-copy-list common) 'string-lessp))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
476
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
477 ;; return result
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
478 (cons (list regexp auxdir1 nil nil merge-autostore-dir)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
479 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
480 (list (concat auxdir1 elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
481 nil nil)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
482 common))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
483 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
484
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
485
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
486 ;; If file groups selected by patterns will ever be implemented, this
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
487 ;; comparison function might become useful.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
488 ;;;; uses external variables PAT1 PAT2 to compare str1/2
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
489 ;;;; patterns must be of the form ???*???? where ??? are strings of chars
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
490 ;;;; containing no *.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
491 ;;(defun ediff-pattern= (str1 str2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
492 ;; (let (pos11 pos12 pos21 pos22 len1 len2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
493 ;; (setq pos11 0
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
494 ;; len (length epat1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
495 ;; pos12 len)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
496 ;; (while (and (< pos11 len) (not (= (aref epat1 pos11) ?*)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
497 ;; (setq pos11 (1+ pos11)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
498 ;; (while (and (> pos12 0) (not (= (aref epat1 (1- pos12)) ?*)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
499 ;; (setq pos12 (1- pos12)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
500 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
501 ;; (setq pos21 0
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
502 ;; len (length epat2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
503 ;; pos22 len)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
504 ;; (while (and (< pos21 len) (not (= (aref epat2 pos21) ?*)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
505 ;; (setq pos21 (1+ pos21)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
506 ;; (while (and (> pos22 0) (not (= (aref epat2 (1- pos22)) ?*)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
507 ;; (setq pos22 (1- pos22)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
508 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
509 ;; (if (and (> (length str1) pos12) (>= pos12 pos11) (> pos11 -1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
510 ;; (> (length str2) pos22) (>= pos22 pos21) (> pos21 -1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
511 ;; (string= (substring str1 pos11 pos12)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
512 ;; (substring str2 pos21 pos22)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
513 ;; ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
514
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
515
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
516 ;; Prepare meta-buffer in accordance with the argument-function and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
517 ;; redraw-function. Must return the created meta-buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
518 (defun ediff-prepare-meta-buffer (action-func meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
519 meta-buffer-name redraw-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
520 jobname &optional startup-hooks)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
521 (let* ((meta-buffer-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
522 (ediff-unique-buffer-name meta-buffer-name "*"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
523 (meta-buffer (get-buffer-create meta-buffer-name)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
524 (ediff-eval-in-buffer meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
525
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
526 ;; comes first
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
527 (ediff-meta-mode)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
528
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
529 (setq ediff-meta-action-function action-func
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
530 ediff-meta-redraw-function redraw-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
531 ediff-metajob-name jobname
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
532 ediff-meta-buffer meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
533
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
534 ;; comes after ediff-meta-action-function is set
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
535 (ediff-setup-meta-map)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
536
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
537 (if (eq ediff-metajob-name 'ediff-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
538 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
539 (setq ediff-registry-buffer meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
540 ediff-meta-list meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
541 ;; this func is used only from registry buffer, not from other
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
542 ;; meta-buffs.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
543 (define-key
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
544 ediff-meta-buffer-map "M" 'ediff-show-meta-buff-from-registry))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
545 ;; Initialize the meta list -- don't do this for registry.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
546 ;;
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
547 ;; We prepend '(nil nil) to all elts of meta-list, except the first.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
548 ;; The first nil will later be replaced by the session buffer. The
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
549 ;; second is reserved for session status.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
550 ;;
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
551 ;; (car ediff-meta-list) gets cons'ed with the session group buffer.
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
552 ;; Also, session objects A/B/C are turned into lists of the form
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
553 ;; (obj eq-indicator). Eq-indicator is either nil or =. Initialized to
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
554 ;; nil. If later it is discovered that this file is = to some other
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
555 ;; file in the same session, eq-indicator is changed to `='.
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
556 ;; For now, the eq-indicator is used only for 2 and 3-file jobs.
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
557 (setq ediff-meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
558 (cons (cons meta-buffer (car meta-list))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
559 (mapcar
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
560 (function
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
561 (lambda (elt)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
562 (cons nil
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
563 (cons nil
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
564 ;; convert each obj to (obj nil),
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
565 ;; where nil is the initial value
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
566 ;; for eq-indicator -- see above
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
567 (mapcar
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
568 (function (lambda (obj) (list obj nil)))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
569 elt)))))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
570 (cdr meta-list)))))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
571
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
572 (or (eq meta-buffer ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
573 (setq ediff-session-registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
574 (cons meta-buffer ediff-session-registry)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
575
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
576 ;; redraw-function uses ediff-meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
577 (funcall redraw-function ediff-meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
578
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
579 ;; set read-only/non-modified
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
580 (setq buffer-read-only t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
581 (set-buffer-modified-p nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
582
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
583 (run-hooks 'startup-hooks)
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
584
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
585 ;; Arrange to show directory contents differences
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
586 ;; Must be after run startup-hooks, since ediff-dir-difference-list is
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
587 ;; set inside these hooks
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
588 (if (eq action-func 'ediff-filegroup-action)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
589 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
590 ;; put meta buffer in (car ediff-dir-difference-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
591 (setq ediff-dir-difference-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
592 (cons (cons meta-buffer (car ediff-dir-difference-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
593 (cdr ediff-dir-difference-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
594
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
595 (or (ediff-one-filegroup-metajob jobname)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
596 (ediff-draw-dir-diffs ediff-dir-difference-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
597 (define-key ediff-meta-buffer-map "h" 'ediff-mark-for-hiding)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
598 (define-key
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
599 ediff-meta-buffer-map "x" 'ediff-hide-marked-sessions)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
600 (define-key ediff-meta-buffer-map "m" 'ediff-mark-for-operation)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
601 (cond ((ediff-collect-diffs-metajob jobname)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
602 (define-key
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
603 ediff-meta-buffer-map "P" 'ediff-collect-custom-diffs))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
604 ((ediff-patch-metajob jobname)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
605 (define-key
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
606 ediff-meta-buffer-map "P" 'ediff-meta-show-patch)))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
607 (define-key ediff-meta-buffer-map "u" 'ediff-up-meta-hierarchy)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
608 (define-key ediff-meta-buffer-map "D" 'ediff-show-dir-diffs)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
609
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
610 (if (eq ediff-metajob-name 'ediff-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
611 (run-hooks 'ediff-registry-setup-hook)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
612 (run-hooks 'ediff-session-group-setup-hook))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
613 ) ; eval in meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
614 meta-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
615
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
616
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
617 ;; this is a setup function for ediff-directories
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
618 ;; must return meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
619 (defun ediff-redraw-directory-group-buffer (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
620 ;; extract directories
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
621 (let ((meta-buf (ediff-get-group-buffer meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
622 (empty t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
623 (sessionNum 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
624 regexp elt session-buf f1 f2 f3 pt
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
625 merge-autostore-dir
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
626 point tmp-list buffer-read-only)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
627 (ediff-eval-in-buffer meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
628 (setq point (point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
629 (erase-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
630 (insert (format ediff-meta-buffer-message
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
631 (ediff-abbrev-jobname ediff-metajob-name)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
632
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
633 (setq regexp (ediff-get-group-regexp meta-list)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
634 merge-autostore-dir (ediff-get-group-merge-autostore-dir meta-list))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
635
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
636 (cond ((ediff-collect-diffs-metajob)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
637 (insert
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
638 " `P':\tcollect custom diffs of all marked sessions\n"))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
639 ((ediff-patch-metajob)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
640 (insert
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
641 " `P':\tshow patch appropriately for the context (session or group)\n")))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
642 (insert
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
643 " `u':\tshow parent session group\n")
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
644 (or (ediff-one-filegroup-metajob)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
645 (insert
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
646 " `D':\tshow differences among directories\n"
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
647 " `=':\tmark identical files in each session\n\n"))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
648
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
649 (if (and (stringp regexp) (> (length regexp) 0))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
650 (insert (format "Filter-through regular expression: %s\n" regexp)))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
651 (if (and ediff-autostore-merges (ediff-merge-metajob)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
652 (stringp merge-autostore-dir))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
653 (insert (format
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
654 "\nMerges are automatically stored in directory: %s\n"
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
655 merge-autostore-dir)))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
656 (insert "\n
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
657 Size Last modified Name
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
658 -----------------------------------------------------------------------
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
659
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
660 ")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
661
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
662 ;; discard info on directories and regexp
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
663 (setq meta-list (cdr meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
664 tmp-list meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
665 (while (and tmp-list empty)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
666 (if (and (car tmp-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
667 (not (eq (ediff-get-session-status (car tmp-list)) ?I)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
668 (setq empty nil))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
669 (setq tmp-list (cdr tmp-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
670
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
671 (if empty
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
672 (insert
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
673 " ****** ****** This session group has no members\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
674
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
675 ;; now organize file names like this:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
676 ;; use-mark sizeA dateA sizeB dateB filename
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
677 ;; make sure directories are displayed with a trailing slash.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
678 (while meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
679 (setq elt (car meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
680 meta-list (cdr meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
681 sessionNum (1+ sessionNum))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
682 (if (eq (ediff-get-session-status elt) ?I)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
683 ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
684 (setq session-buf (ediff-get-session-buffer elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
685 f1 (ediff-get-session-objA elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
686 f2 (ediff-get-session-objB elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
687 f3 (ediff-get-session-objC elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
688 (setq pt (point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
689 ;; insert markers
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
690 (insert (cond ((null session-buf) " ") ; virgin session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
691 ((ediff-buffer-live-p session-buf) "+") ;active session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
692 (t "-"))) ; finished session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
693 (insert (cond ((ediff-get-session-status elt)) ; session has status,
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
694 ;;; e.g., ?H, ?I
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
695 (t " "))) ; normal session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
696 (insert " Session " (int-to-string sessionNum) ":\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
697 (ediff-meta-insert-file-info f1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
698 (ediff-meta-insert-file-info f2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
699 (ediff-meta-insert-file-info f3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
700 (ediff-set-meta-overlay pt (point) elt)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
701 (set-buffer-modified-p nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
702 (goto-char point)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
703 meta-buf)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
704
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
705 ;; Check if this is a problematic session.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
706 ;; Return nil if not. Otherwise, return symbol representing the problem
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
707 ;; At present, problematic sessions occur only in -with-ancestor comparisons
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
708 ;; when the ancestor is a directory rather than a file, or when there is no
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
709 ;; suitable ancestor file in the ancestor directory
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
710 (defun ediff-problematic-session-p (session)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
711 (let ((f1 (ediff-get-session-objA-name session))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
712 (f2 (ediff-get-session-objB-name session))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
713 (f3 (ediff-get-session-objC-name session)))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
714 (cond ((and (stringp f1) (not (file-directory-p f1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
715 (stringp f2) (not (file-directory-p f2))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
716 ;; either invalid file name or a directory
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
717 (or (not (stringp f3)) (file-directory-p f3))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
718 (ediff-ancestor-metajob))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
719 ;; more may be added later
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
720 'ancestor-is-dir)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
721 (t nil))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
722
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
723 (defun ediff-meta-insert-file-info (fileinfo)
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
724 (let ((fname (car fileinfo))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
725 (feq (ediff-get-file-eqstatus fileinfo))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
726 file-modtime file-size)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
727
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
728 (cond ((not (stringp fname)) (setq file-size -2)) ; file doesn't exits
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
729 ((not (ediff-file-remote-p fname))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
730 (if (file-exists-p fname)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
731 ;; set real size and modtime
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
732 (setq file-size (ediff-file-size fname)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
733 file-modtime (ediff-file-modtime fname))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
734 (setq file-size -2))) ; file doesn't exist
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
735 ( t (setq file-size -1))) ; remote file
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
736 (if (stringp fname)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
737 (insert
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
738 (format
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
739 "%s %s %-20s %s\n"
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
740 (if feq "=" " ") ; equality indicator
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
741 (format "%10s" (cond ((= file-size -1) "--")
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
742 ((< file-size -1) "--")
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
743 (t file-size)))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
744 (cond ((= file-size -1) "*remote file*")
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
745 ((< file-size -1) "*file doesn't exist*")
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
746 (t (ediff-format-date (decode-time file-modtime))))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
747
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
748 ;; dir names in meta lists have training slashes, so we just
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
749 ;; abbreviate the file name, if file exists
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
750 (if (and (not (stringp fname)) (< file-size -1))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
751 "-------" ; file doesn't exist
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
752 (ediff-abbreviate-file-name fname)))))))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
753
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
754 (defconst ediff-months '((1 . "Jan") (2 . "Feb") (3 . "Mar") (4 . "Apr")
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
755 (5 . "May") (6 . "Jun") (7 . "Jul") (8 . "Aug")
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
756 (9 . "Sep") (10 . "Oct") (11 . "Nov") (12 . "Dec"))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
757 "Months' associative array.")
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
758
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
759 ;; returns 2char string
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
760 (defsubst ediff-fill-leading-zero (num)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
761 (if (< num 10)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
762 (format "0%d" num)
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
763 (number-to-string num)))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
764
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
765 ;; TIME is like the output of decode-time
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
766 (defun ediff-format-date (time)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
767 (format "%s %2d %4d %s:%s:%s"
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
768 (cdr (assoc (nth 4 time) ediff-months)) ; month
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
769 (nth 3 time) ; day
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
770 (nth 5 time) ; year
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
771 (ediff-fill-leading-zero (nth 2 time)) ; hour
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
772 (ediff-fill-leading-zero (nth 1 time)) ; min
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
773 (ediff-fill-leading-zero (nth 0 time)) ; sec
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
774 ))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
775
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
776 (defun ediff-draw-dir-diffs (diff-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
777 (if (null diff-list) (error "Lost difference info on these directories"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
778 (let* ((buf-name (ediff-unique-buffer-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
779 "*Ediff File Group Differences" "*"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
780 (regexp (ediff-get-group-regexp diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
781 (dir1 (ediff-abbreviate-file-name (ediff-get-group-objA diff-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
782 (dir2 (ediff-abbreviate-file-name (ediff-get-group-objB diff-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
783 (dir3 (ediff-get-group-objC diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
784 (dir3 (if (stringp dir3) (ediff-abbreviate-file-name dir3)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
785 (meta-buf (ediff-get-group-buffer diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
786 (underline (make-string 26 ?-))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
787 file code
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
788 buffer-read-only)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
789 ;; skip the directory part
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
790 (setq diff-list (cdr diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
791 (setq ediff-dir-diffs-buffer (get-buffer-create buf-name))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
792 (ediff-eval-in-buffer ediff-dir-diffs-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
793 (use-local-map ediff-dir-diffs-buffer-map)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
794 (erase-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
795 (setq ediff-meta-buffer meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
796 (insert "\t\t*** Directory Differences ***\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
797 (insert "
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
798 Useful commands:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
799 `q': hide this buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
800 SPC: next line
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
801 DEL: previous line\n\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
802
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
803 (if (and (stringp regexp) (> (length regexp) 0))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
804 (insert (format "Filter-through regular expression: %s\n" regexp)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
805 (insert "\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
806 (insert (format "\n%-27s%-26s"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
807 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
808 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
809 (file-name-as-directory dir1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
810 25)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
811 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
812 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
813 (file-name-as-directory dir2))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
814 25)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
815 (if dir3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
816 (insert (format " %-25s\n"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
817 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
818 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
819 (file-name-as-directory dir3))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
820 25)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
821 (insert "\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
822 (insert (format "%s%s" underline underline))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
823 (if (stringp dir3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
824 (insert (format "%s\n\n" underline))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
825 (insert "\n\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
826
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
827 (if (null diff-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
828 (insert "\n\t*** No differences ***\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
829
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
830 (while diff-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
831 (setq file (car (car diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
832 code (cdr (car diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
833 diff-list (cdr diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
834 (if (= (mod code 2) 0) ; dir1
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
835 (insert (format "%-27s"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
836 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
837 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
838 (if (file-directory-p (concat dir1 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
839 (file-name-as-directory file)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
840 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
841 24)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
842 (insert (format "%-27s" "---")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
843 (if (= (mod code 3) 0) ; dir2
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
844 (insert (format "%-26s"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
845 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
846 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
847 (if (file-directory-p (concat dir2 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
848 (file-name-as-directory file)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
849 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
850 24)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
851 (insert (format "%-26s" "---")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
852 (if (stringp dir3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
853 (if (= (mod code 5) 0) ; dir3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
854 (insert (format " %-25s"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
855 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
856 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
857 (if (file-directory-p (concat dir3 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
858 (file-name-as-directory file)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
859 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
860 24)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
861 (insert (format " %-25s" "---"))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
862 (insert "\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
863 (setq buffer-read-only t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
864 (set-buffer-modified-p nil)) ; eval in diff buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
865 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
866
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
867 (defun ediff-bury-dir-diffs-buffer ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
868 "Bury the directory difference buffer. Display the meta buffer instead."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
869 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
870 (let ((buf ediff-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
871 wind)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
872 (bury-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
873 (if (setq wind (ediff-get-visible-buffer-window buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
874 (select-window wind)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
875 (set-window-buffer (selected-window) buf))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
876
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
877 ;; executes in dir session group buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
878 ;; show buffer differences
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
879 (defun ediff-show-dir-diffs ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
880 "Display differences among the directories involved in session group."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
881 (interactive)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
882 (if (ediff-one-filegroup-metajob)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
883 (error "This command is inapplicable in the present context"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
884 (or (ediff-buffer-live-p ediff-dir-diffs-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
885 (ediff-draw-dir-diffs ediff-dir-difference-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
886 (let ((buf ediff-dir-diffs-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
887 (other-window 1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
888 (set-window-buffer (selected-window) buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
889 (goto-char (point-min))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
890
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
891 (defun ediff-up-meta-hierarchy ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
892 "Go to the parent session group buffer."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
893 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
894 (if (ediff-buffer-live-p ediff-parent-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
895 (ediff-show-meta-buffer ediff-parent-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
896 (error "This session group has no parent")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
897
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
898
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
899 ;; argument is ignored
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
900 (defun ediff-redraw-registry-buffer (&optional ignore)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
901 (ediff-eval-in-buffer ediff-registry-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
902 (let ((point (point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
903 elt bufAname bufBname bufCname cur-diff total-diffs pt
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
904 job-name meta-list registry-list buffer-read-only)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
905 (erase-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
906 (insert "This is a registry of all active Ediff sessions.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
907
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
908 Useful commands:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
909 button2, `v', RET over a session record: switch to that session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
910 `M' over a session record: display the associated session group
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
911 `R' in any Ediff session: display session registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
912 SPC:\tnext session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
913 DEL:\tprevious session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
914 `E':\tbrowse Ediff on-line manual
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
915 `q':\tbury registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
916
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
917
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
918 \t\tActive Ediff Sessions:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
919 \t\t----------------------
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
920
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
921 ")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
922 ;; purge registry list from dead buffers
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
923 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
924 (if (not (ediff-buffer-live-p elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
925 (setq ediff-session-registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
926 (delq elt ediff-session-registry)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
927 ediff-session-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
928
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
929 (if (null ediff-session-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
930 (insert " ******* No active Ediff sessions *******\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
931
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
932 (setq registry-list ediff-session-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
933 (while registry-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
934 (setq elt (car registry-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
935 registry-list (cdr registry-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
936
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
937 (if (ediff-buffer-live-p elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
938 (if (ediff-eval-in-buffer elt
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
939 (setq job-name ediff-metajob-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
940 meta-list ediff-meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
941 (and ediff-metajob-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
942 (not (eq ediff-metajob-name 'ediff-registry))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
943 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
944 (setq pt (point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
945 (insert (format " *group*\t%s: %s\n"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
946 (buffer-name elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
947 (ediff-abbrev-jobname job-name)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
948 (insert (format "\t\t %s %s %s\n"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
949 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
950 (ediff-get-group-objA meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
951 (ediff-abbreviate-file-name
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
952 (if (stringp
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
953 (ediff-get-group-objB meta-list))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
954 (ediff-get-group-objB meta-list)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
955 ""))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
956 (ediff-abbreviate-file-name
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
957 (if (stringp
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
958 (ediff-get-group-objC meta-list))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
959 (ediff-get-group-objC meta-list)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
960 ""))))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
961 (ediff-set-meta-overlay pt (point) elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
962 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
963 (ediff-eval-in-buffer elt
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
964 (setq bufAname (if (ediff-buffer-live-p ediff-buffer-A)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
965 (buffer-name ediff-buffer-A)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
966 "!!!killed buffer!!!")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
967 bufBname (if (ediff-buffer-live-p ediff-buffer-B)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
968 (buffer-name ediff-buffer-B)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
969 "!!!killed buffer!!!")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
970 bufCname (cond ((not (ediff-3way-job))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
971 "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
972 ((ediff-buffer-live-p ediff-buffer-C)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
973 (buffer-name ediff-buffer-C))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
974 (t "!!!killed buffer!!!")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
975 (setq total-diffs (format "%-4d" ediff-number-of-differences)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
976 cur-diff
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
977 (cond ((= ediff-current-difference -1) " _")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
978 ((= ediff-current-difference
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
979 ediff-number-of-differences)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
980 " $")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
981 (t (format
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
982 "%4d" (1+ ediff-current-difference))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
983 job-name ediff-job-name))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
984 ;; back in the meta buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
985 (setq pt (point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
986 (insert cur-diff "/" total-diffs "\t"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
987 (buffer-name elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
988 (format ": %s" (ediff-abbrev-jobname job-name)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
989 (insert
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
990 "\n\t\t " bufAname " " bufBname " " bufCname "\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
991 (ediff-set-meta-overlay pt (point) elt))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
992 ) ; while
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
993 (set-buffer-modified-p nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
994 (goto-char point)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
995 )))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
996
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
997 ;; sets overlay around a meta record with 'ediff-meta-info property PROP
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
998 (defun ediff-set-meta-overlay (b e prop)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
999 (let (overl)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1000 (setq overl (ediff-make-overlay b e))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1001 (if ediff-emacs-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1002 (ediff-overlay-put overl 'mouse-face 'highlight)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1003 (ediff-overlay-put overl 'highlight t))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1004 (ediff-overlay-put overl 'ediff-meta-info prop)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1005
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1006 (defun ediff-mark-for-hiding (unmark)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1007 "Mark session for hiding. With prefix arg, unmark."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1008 (interactive "P")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1009 (let* ((pos (ediff-event-point last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1010 (meta-buf (ediff-event-buffer last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1011 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1012 (info (ediff-get-meta-info meta-buf pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1013 (session-buf (ediff-get-session-buffer info)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1014
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1015 (if (eq (ediff-get-session-status info) ?H)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1016 (setq unmark t))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1017 (if unmark
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1018 (ediff-set-session-status info nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1019 (if (ediff-buffer-live-p session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1020 (error "Can't hide active session, %s" (buffer-name session-buf)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1021 (ediff-set-session-status info ?H))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1022 (or unmark
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1023 (ediff-next-meta-item 1))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1024 (ediff-update-meta-buffer meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1025 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1026
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1027 (defun ediff-mark-for-operation (unmark)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1028 "Mark session for a group operation. With prefix arg, unmark."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1029 (interactive "P")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1030 (let* ((pos (ediff-event-point last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1031 (meta-buf (ediff-event-buffer last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1032 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1033 (info (ediff-get-meta-info meta-buf pos)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1034
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1035 (if (eq (ediff-get-session-status info) ?*)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1036 (setq unmark t))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1037 (if unmark
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1038 (ediff-set-session-status info nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1039 (ediff-set-session-status info ?*))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1040 (or unmark
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1041 (ediff-next-meta-item 1))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1042 (ediff-update-meta-buffer meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1043 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1044
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1045 (defun ediff-hide-marked-sessions (unhide)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1046 "Hide marked sessions. With prefix arg, unhide."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1047 (interactive "P")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1048 (let ((grp-buf (ediff-get-group-buffer ediff-meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1049 (meta-list (cdr ediff-meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1050 (from (if unhide ?I ?H))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1051 (to (if unhide ?H ?I))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1052 (numMarked 0)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1053 active-sessions-exist session-buf elt)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1054 (while meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1055 (setq elt (car meta-list)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1056 meta-list (cdr meta-list)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1057 session-buf (ediff-get-session-buffer elt))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1058
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1059 (if (eq (ediff-get-session-status elt) from)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1060 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1061 (setq numMarked (1+ numMarked))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1062 (if (and (eq to ?I) (buffer-live-p session-buf))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1063 ;; shouldn't hide active sessions
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1064 (setq active-sessions-exist t)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1065 (ediff-set-session-status elt to)))))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1066 (if (> numMarked 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1067 (ediff-update-meta-buffer grp-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1068 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1069 (if unhide
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1070 (message "Nothing to reveal...")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1071 (message "Nothing to hide...")))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1072 (if active-sessions-exist
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1073 (message "Note: didn't hide active sessions!"))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1074 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1075
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1076 ;; Apply OPERATION to marked sessions. Operation expects one argument of type
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1077 ;; meta-list member (not the first one), i.e., a regular session description.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1078 ;; Returns number of marked sessions on which operation was performed
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1079 (defun ediff-operate-on-marked-sessions (operation)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1080 (let ((grp-buf (ediff-get-group-buffer ediff-meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1081 (meta-list (cdr ediff-meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1082 (marksym ?*)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1083 (numMarked 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1084 (sessionNum 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1085 elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1086 (while meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1087 (setq elt (car meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1088 meta-list (cdr meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1089 sessionNum (1+ sessionNum))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1090 (if (eq (ediff-get-session-status elt) marksym)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1091 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1092 (setq numMarked (1+ numMarked))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1093 (funcall operation elt sessionNum))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1094 (ediff-update-meta-buffer grp-buf) ; just in case
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1095 numMarked
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1096 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1097
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1098 (defun ediff-append-custom-diff (session sessionNum)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1099 (or (ediff-collect-diffs-metajob)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1100 (error "Sorry, I don't do this for everyone..."))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1101 (let ((session-buf (ediff-get-session-buffer session))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1102 (meta-diff-buff ediff-meta-diff-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1103 (metajob ediff-metajob-name)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1104 tmp-buf custom-diff-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1105 (if (ediff-buffer-live-p session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1106 (ediff-eval-in-buffer session-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1107 (if (eq ediff-control-buffer session-buf) ; individual session
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1108 (progn
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1109 (ediff-compute-custom-diffs-maybe)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1110 (setq custom-diff-buf ediff-custom-diff-buffer)))))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1111
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1112 (or (ediff-buffer-live-p meta-diff-buff)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1113 (error "Ediff: something wrong--no multiple diffs buffer"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1114
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1115 (cond ((ediff-buffer-live-p custom-diff-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1116 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1117 (set-buffer meta-diff-buff)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1118 (goto-char (point-max))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1119 (insert-buffer custom-diff-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1120 (insert "\n")))
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1121 ((memq metajob '(ediff-directories
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1122 ediff-merge-directories
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1123 ediff-merge-directories-with-ancestor))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1124 ;; get diffs by calling shell command on ediff-custom-diff-program
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1125 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1126 (set-buffer (setq tmp-buf (get-buffer-create ediff-tmp-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1127 (erase-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1128 (shell-command
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1129 (format "%s %s %s %s"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1130 ediff-custom-diff-program ediff-custom-diff-options
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1131 (ediff-get-session-objA-name session)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1132 (ediff-get-session-objB-name session))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1133 t))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1134 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1135 (set-buffer meta-diff-buff)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1136 (goto-char (point-max))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1137 (insert-buffer tmp-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1138 (insert "\n")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1139 (t
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1140 (error "Can't make context diff for Session %d" sessionNum )))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1141 ))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1142
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1143 (defun ediff-collect-custom-diffs ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1144 "Collect custom diffs of marked sessions in buffer `*Ediff Multifile Diffs*'.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1145 This operation is defined only for `ediff-directories' and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1146 `ediff-directory-revisions', since its intent is to produce
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1147 multifile patches. For `ediff-directory-revisions', we insist that
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1148 all marked sessions must be active."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1149 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1150 (or (ediff-buffer-live-p ediff-meta-diff-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1151 (setq ediff-meta-diff-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1152 (get-buffer-create
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1153 (ediff-unique-buffer-name "*Ediff Multifile Diffs" "*"))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1154 (ediff-eval-in-buffer ediff-meta-diff-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1155 (erase-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1156 (if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1157 ;; did something
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1158 (display-buffer ediff-meta-diff-buffer 'not-this-window)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1159 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1160 (message "No marked sessions found")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1161
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1162 (defun ediff-meta-show-patch ()
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1163 "Show the multi-file patch associated with this group session."
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1164 (interactive)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1165 (let* ((pos (ediff-event-point last-command-event))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1166 (meta-buf (ediff-event-buffer last-command-event))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1167 (info (ediff-get-meta-info meta-buf pos 'noerror))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1168 (patchbuffer ediff-meta-patchbufer))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1169 (if (ediff-buffer-live-p patchbuffer)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1170 (ediff-eval-in-buffer patchbuffer
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1171 (save-restriction
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1172 (if (not info)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1173 (widen)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1174 (narrow-to-region
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1175 (ediff-get-session-objB-name info)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1176 (ediff-get-session-objC-name info)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1177 (set-buffer (get-buffer-create ediff-tmp-buffer))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1178 (erase-buffer)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1179 (insert-buffer patchbuffer)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1180 (display-buffer ediff-tmp-buffer 'not-this-window)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1181 ))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1182 (error "The patch buffer wasn't found"))))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1183
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1184
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1185 ;; This function executes in meta buffer. It knows where event happened.
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1186 (defun ediff-filegroup-action ()
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1187 "Execute appropriate action for the selected session."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1188 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1189 (let* ((pos (ediff-event-point last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1190 (meta-buf (ediff-event-buffer last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1191 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1192 (info (ediff-get-meta-info meta-buf pos))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1193 merge-autostore-dir
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1194 session-buf file1 file2 file3 regexp)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1195
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1196 (setq session-buf (ediff-get-session-buffer info)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1197 file1 (ediff-get-session-objA-name info)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1198 file2 (ediff-get-session-objB-name info)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1199 file3 (ediff-get-session-objC-name info))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1200
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1201 ;; make sure we don't start on hidden sessions
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1202 ;; ?H means marked for hiding. ?I means invalid (hidden).
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1203 (if (memq (ediff-get-session-status info) '(?I))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1204 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1205 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1206 (if (y-or-n-p "This session is marked as hidden, unmark? ")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1207 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1208 (ediff-set-session-status info nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1209 (ediff-update-meta-buffer meta-buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1210 (error "Aborted"))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1211
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1212 (ediff-eval-in-buffer meta-buf
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1213 (setq merge-autostore-dir
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1214 (ediff-get-group-merge-autostore-dir ediff-meta-list))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1215 (goto-char pos) ; if the user clicked on session--move point there
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1216 ;; First handle sessions involving directories (which are themselves
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1217 ;; session groups)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1218 ;; After that handle individual sessions
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1219 (cond ((and (file-directory-p file1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1220 (stringp file2) (file-directory-p file2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1221 (if (stringp file3) (file-directory-p file1) t))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1222 ;; do ediff/ediff-merge on subdirectories
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1223 (if (ediff-buffer-live-p session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1224 (ediff-show-meta-buffer session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1225 (setq regexp (read-string "Filter through regular expression: "
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1226 nil 'ediff-filtering-regexp-history))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1227 (ediff-directories-internal
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1228 file1 file2 file3 regexp
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1229 ediff-session-action-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1230 ediff-metajob-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1231 ;; make it update car info after startup
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1232 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1233 ;; child session group should know its parent
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1234 (setq ediff-parent-meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1235 (quote (, ediff-meta-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1236 ;; and parent will know its child
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1237 (setcar (quote (, info)) ediff-meta-buffer)))))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1238
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1239 ;; Do ediff-revision on a subdirectory
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1240 ((and (ediff-one-filegroup-metajob)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1241 (ediff-revision-metajob)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1242 (file-directory-p file1))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1243 (if (ediff-buffer-live-p session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1244 (ediff-show-meta-buffer session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1245 (setq regexp (read-string "Filter through regular expression: "
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1246 nil 'ediff-filtering-regexp-history))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1247 (ediff-directory-revisions-internal
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1248 file1 regexp
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1249 ediff-session-action-function ediff-metajob-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1250 ;; make it update car info after startup
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1251 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1252 ;; child session group should know its parent
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1253 (setq ediff-parent-meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1254 (quote (, ediff-meta-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1255 ;; and parent will know its child
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1256 (setcar (quote (, info)) ediff-meta-buffer)))))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1257
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1258 ;; From here on---only individual session handlers
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1259
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1260 ;; handle an individual session with a live control buffer
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1261 ((ediff-buffer-live-p session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1262 (ediff-eval-in-buffer session-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1263 (setq ediff-mouse-pixel-position (mouse-pixel-position))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1264 (ediff-recenter 'no-rehighlight)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1265
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1266 ((ediff-problematic-session-p info)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1267 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1268 (if (y-or-n-p
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1269 "This session has no ancestor. Merge without the ancestor? ")
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1270 (ediff-merge-files
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1271 file1 file2
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1272 ;; provide startup hooks
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1273 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1274 (setq ediff-meta-buffer (, (current-buffer)))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1275 (setq ediff-merge-store-file
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1276 (, (concat
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1277 merge-autostore-dir
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1278 (file-name-nondirectory file1))))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1279 ;; make ediff-startup pass
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1280 ;; ediff-control-buffer back to the meta
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1281 ;; level; see below
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1282 (setcar
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1283 (quote (, info)) ediff-control-buffer)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1284 (error "Aborted")))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1285 ((ediff-one-filegroup-metajob) ; needs 1 file arg
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1286 (funcall ediff-session-action-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1287 file1
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1288 ;; provide startup hooks
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1289 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1290 (setq ediff-meta-buffer (, (current-buffer)))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1291 (setq ediff-merge-store-file
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1292 (, (concat
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1293 merge-autostore-dir
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1294 (file-name-nondirectory file1))))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1295 ;; make ediff-startup pass
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1296 ;; ediff-control-buffer back to the meta
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1297 ;; level; see below
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1298 (setcar
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1299 (quote (, info)) ediff-control-buffer))))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1300 ((not (ediff-metajob3)) ; need 2 file args
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1301 (funcall ediff-session-action-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1302 file1 file2
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1303 ;; provide startup hooks
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1304 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1305 (setq ediff-meta-buffer (, (current-buffer)))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1306 (setq ediff-merge-store-file
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1307 (, (concat
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1308 merge-autostore-dir
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1309 (file-name-nondirectory file1))))
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1310 ;; make ediff-startup pass
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1311 ;; ediff-control-buffer back to the meta
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1312 ;; level; see below
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1313 (setcar
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1314 (quote (, info)) ediff-control-buffer))))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1315 ((ediff-metajob3) ; need 3 file args
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1316 (funcall ediff-session-action-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1317 file1 file2 file3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1318 ;; arrange startup hooks
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1319 (` (list (lambda ()
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1320 (setq ediff-merge-store-file
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1321 (, (concat
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1322 merge-autostore-dir
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1323 (file-name-nondirectory file1))))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1324 (setq ediff-meta-buffer (, (current-buffer)))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1325 ;; this arranges that ediff-startup will pass
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1326 ;; the value of ediff-control-buffer back to
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1327 ;; the meta level, to the record in the meta
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1328 ;; list containing the information about the
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1329 ;; session associated with that
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1330 ;; ediff-control-buffer
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1331 (setcar
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1332 (quote (, info)) ediff-control-buffer))))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1333 ) ; cond
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1334 ) ; eval in meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1335 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1336
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1337 (defun ediff-registry-action ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1338 "Switch to a selected session."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1339 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1340 (let* ((pos (ediff-event-point last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1341 (buf (ediff-event-buffer last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1342 (ctl-buf (ediff-get-meta-info buf pos)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1343
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1344 (if (ediff-buffer-live-p ctl-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1345 ;; check if this is ediff-control-buffer or ediff-meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1346 (if (ediff-eval-in-buffer ctl-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1347 (eq (key-binding "q") 'ediff-quit-meta-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1348 ;; it's a meta-buffer -- last action should just display it
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1349 (ediff-show-meta-buffer ctl-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1350 ;; it's a session buffer -- invoke go back to session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1351 (ediff-eval-in-buffer ctl-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1352 (setq ediff-mouse-pixel-position (mouse-pixel-position))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1353 (ediff-recenter 'no-rehighlight)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1354 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1355 (message "You've selected a stale session --- try again")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1356 (ediff-update-registry))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1357 (ediff-eval-in-buffer buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1358 (goto-char pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1359 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1360
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1361
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1362 (defun ediff-show-meta-buffer (&optional meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1363 "Show the session group buffer."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1364 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1365 (let (wind frame silent)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1366 (if meta-buf (setq silent t))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1367
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1368 (setq meta-buf (or meta-buf ediff-meta-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1369 (cond ((not (bufferp meta-buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1370 (error "This Ediff session is not part of a session group"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1371 ((not (ediff-buffer-live-p meta-buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1372 (error
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1373 "Can't find this session's group panel -- session itself is ok")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1374
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1375 (ediff-cleanup-meta-buffer meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1376 (ediff-eval-in-buffer meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1377 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1378 (cond ((setq wind (ediff-get-visible-buffer-window meta-buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1379 (or silent
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1380 (message
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1381 "Already showing the group panel for this session"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1382 (set-window-buffer wind meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1383 (select-window wind))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1384 ((window-live-p (setq wind ediff-window-C)) ;in merge--merge buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1385 (set-window-buffer ediff-window-C meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1386 (select-window wind))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1387 ((window-live-p (setq wind ediff-window-A))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1388 (set-window-buffer ediff-window-A meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1389 (select-window wind))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1390 ((window-live-p (setq wind ediff-window-B))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1391 (set-window-buffer ediff-window-B meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1392 (select-window wind))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1393 ((and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1394 (setq wind
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1395 (ediff-get-visible-buffer-window ediff-registry-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1396 (ediff-window-display-p))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1397 (select-window wind)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1398 (other-window 1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1399 (set-window-buffer (selected-window) meta-buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1400 (t (ediff-skip-unsuitable-frames 'ok-unsplittable)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1401 (set-window-buffer (selected-window) meta-buf)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1402 ))
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1403 (if (and (ediff-window-display-p)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1404 (window-live-p
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1405 (setq wind (ediff-get-visible-buffer-window meta-buf))))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1406 (progn
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1407 (setq frame (window-frame wind))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1408 (raise-frame frame)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1409 (ediff-reset-mouse frame)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1410 (run-hooks 'ediff-show-session-group-hook)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1411 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1412
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1413 (defun ediff-show-meta-buff-from-registry ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1414 "Display the session group buffer for a selected session group."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1415 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1416 (let* ((pos (ediff-event-point last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1417 (meta-buf (ediff-event-buffer last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1418 (info (ediff-get-meta-info meta-buf pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1419 (meta-or-session-buf info))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1420 (ediff-eval-in-buffer meta-or-session-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1421 (ediff-show-meta-buffer))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1422
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1423 ;;;###autoload
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1424 (defun ediff-show-registry ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1425 "Display Ediff's registry."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1426 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1427 (ediff-update-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1428 (if (not (ediff-buffer-live-p ediff-registry-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1429 (error "No active Ediff sessions or corrupted session registry"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1430 (let (wind frame)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1431 ;; for some reason, point moves in ediff-registry-buffer, so we preserve it
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1432 ;; explicitly
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1433 (ediff-eval-in-buffer ediff-registry-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1434 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1435 (cond ((setq wind
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1436 (ediff-get-visible-buffer-window ediff-registry-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1437 (message "Already showing the registry")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1438 (set-window-buffer wind ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1439 (select-window wind))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1440 ((window-live-p ediff-window-C)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1441 (set-window-buffer ediff-window-C ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1442 (select-window ediff-window-C))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1443 ((window-live-p ediff-window-A)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1444 (set-window-buffer ediff-window-A ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1445 (select-window ediff-window-A))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1446 ((window-live-p ediff-window-B)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1447 (set-window-buffer ediff-window-B ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1448 (select-window ediff-window-B))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1449 ((and (setq wind
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1450 (ediff-get-visible-buffer-window ediff-meta-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1451 (ediff-window-display-p))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1452 (select-window wind)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1453 (other-window 1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1454 (set-window-buffer (selected-window) ediff-registry-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1455 (t (ediff-skip-unsuitable-frames 'ok-unsplittable)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1456 (set-window-buffer (selected-window) ediff-registry-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1457 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1458 (if (ediff-window-display-p)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1459 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1460 (setq frame
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1461 (window-frame
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1462 (ediff-get-visible-buffer-window ediff-registry-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1463 (raise-frame frame)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1464 (ediff-reset-mouse frame)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1465 (run-hooks 'ediff-show-registry-hook)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1466 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1467
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1468 ;;;###autoload
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1469 (defalias 'eregistry 'ediff-show-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1470
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1471 ;; If meta-buf doesn't exist, it is created. In that case, id doesn't have a
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1472 ;; parent meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1473 ;; Check if META-BUF exists before calling this function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1474 (defun ediff-update-meta-buffer (meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1475 (ediff-eval-in-buffer (current-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1476 (if (ediff-buffer-live-p meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1477 (ediff-eval-in-buffer meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1478 (funcall ediff-meta-redraw-function ediff-meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1479 )))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1480
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1481 (defun ediff-update-registry ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1482 (ediff-eval-in-buffer (current-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1483 (if (ediff-buffer-live-p ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1484 (ediff-redraw-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1485 (ediff-prepare-meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1486 'ediff-registry-action
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1487 ediff-session-registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1488 "*Ediff Registry"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1489 'ediff-redraw-registry-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1490 'ediff-registry))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1491 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1492
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1493 ;; If meta-buf exists, it is redrawn along with parent.
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1494 ;; Otherwise, nothing happens.
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1495 (defun ediff-cleanup-meta-buffer (meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1496 (if (ediff-buffer-live-p meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1497 (ediff-eval-in-buffer meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1498 (ediff-update-meta-buffer meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1499 (if (ediff-buffer-live-p ediff-parent-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1500 (ediff-update-meta-buffer ediff-parent-meta-buffer)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1501
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1502 ;; t if no session in progress
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1503 (defun ediff-safe-to-quit (meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1504 (if (ediff-buffer-live-p meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1505 (let ((lis ediff-meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1506 (cont t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1507 buffer-read-only)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1508 (ediff-update-meta-buffer meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1509 (ediff-eval-in-buffer meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1510 (setq lis (cdr lis)) ; discard the description part of meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1511 (while (and cont lis)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1512 (if (ediff-buffer-live-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1513 (ediff-get-group-buffer lis)) ; in progress
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1514 (setq cont nil))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1515 (setq lis (cdr lis)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1516 cont))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1517
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1518 (defun ediff-quit-meta-buffer ()
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1519 "If the group has no active session, delete the meta buffer.
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1520 If no session is in progress, ask to confirm before deleting meta buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1521 Otherwise, bury the meta buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1522 If this is a session registry buffer then just bury it."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1523 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1524 (let* ((buf (current-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1525 (dir-diffs-buffer ediff-dir-diffs-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1526 (meta-diff-buffer ediff-meta-diff-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1527 (parent-buf ediff-parent-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1528 (dont-show-registry (eq buf ediff-registry-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1529 (if dont-show-registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1530 (bury-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1531 (ediff-cleanup-meta-buffer buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1532 (cond ((and (ediff-safe-to-quit buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1533 (y-or-n-p "Quit this session group? "))
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1534 (run-hooks 'ediff-quit-session-group-hook)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1535 (message "")
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1536 (ediff-dispose-of-meta-buffer buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1537 ((ediff-safe-to-quit buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1538 (bury-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1539 (t
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1540 (error
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1541 "This session group has active sessions---cannot exit")))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1542 (ediff-cleanup-meta-buffer parent-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1543 (ediff-kill-buffer-carefully dir-diffs-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1544 (ediff-kill-buffer-carefully meta-diff-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1545 (if (ediff-buffer-live-p parent-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1546 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1547 (setq dont-show-registry t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1548 (ediff-show-meta-buffer parent-buf)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1549 )
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1550 (or dont-show-registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1551 (ediff-show-registry))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1552
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1553 (defun ediff-dispose-of-meta-buffer (buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1554 (setq ediff-session-registry (delq buf ediff-session-registry))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1555 (ediff-eval-in-buffer buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1556 (if (ediff-buffer-live-p ediff-dir-diffs-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1557 (kill-buffer ediff-dir-diffs-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1558 (kill-buffer buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1559
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1560
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1561 ;; Obtain information on a meta record where the user clicked or typed
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1562 ;; BUF is the buffer where this happened and POINT is the position
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1563 ;; If optional NOERROR arg is given, don't report error and return nil if no
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1564 ;; meta info is found on line.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1565 (defun ediff-get-meta-info (buf point &optional noerror)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1566 (let (result olist tmp)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1567 (if (and point (ediff-buffer-live-p buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1568 (ediff-eval-in-buffer buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1569 (if ediff-xemacs-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1570 (setq result
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1571 (if (setq tmp (extent-at point buf 'ediff-meta-info))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1572 (ediff-overlay-get tmp 'ediff-meta-info)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1573 (setq olist (overlays-at point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1574 (setq olist
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1575 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1576 (overlay-get elt 'ediff-meta-info)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1577 olist))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1578 (while (and olist (null (car olist))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1579 (overlay-get (car olist) 'invisible))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1580 (setq olist (cdr olist)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1581 (setq result (car olist)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1582 (if result
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1583 result
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1584 (if noerror
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1585 nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1586 (ediff-update-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1587 (error "No session info in this line")))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1588
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1589 ;; return location of the next meta overlay after point
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1590 (defun ediff-next-meta-overlay-start (point)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1591 (if (eobp)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1592 (goto-char (point-min))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1593 (let (overl)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1594 (if ediff-xemacs-p
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1595 (progn
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1596 (setq overl (extent-at point (current-buffer) 'ediff-meta-info))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1597 (if overl
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1598 (setq overl (next-extent overl))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1599 (setq overl (next-extent (current-buffer))))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1600 (if overl
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1601 (extent-start-position overl)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1602 (point-max)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1603 (setq overl (car (overlays-at point)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1604 (if (and overl (overlay-get overl 'ediff-meta-info))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1605 ;; note: end of current overlay is the beginning of the next one
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1606 (overlay-end overl)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1607 (next-overlay-change point))))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1608 ))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1609
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1610 (defun ediff-previous-meta-overlay-start (point)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1611 (if (bobp)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1612 (goto-char (point-max))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1613 (let (overl)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1614 (if ediff-xemacs-p
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1615 (progn
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1616 (setq overl (extent-at point (current-buffer) 'ediff-meta-info))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1617 (if overl
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1618 (setq overl (previous-extent overl))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1619 (setq overl (previous-extent (current-buffer))))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1620 (if overl
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1621 (extent-start-position overl)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1622 (point-min)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1623 (setq overl (car (overlays-at point)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1624 (if (and overl (overlay-get overl 'ediff-meta-info))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1625 (setq point (overlay-start overl)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1626 ;; to get to the beginning of prev overlay
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1627 (if (not (bobp))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1628 ;; trickery to overcome an emacs bug--doesn't always find previous
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1629 ;; overlay change correctly
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1630 (setq point (1- point)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1631 (setq point (previous-overlay-change point))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1632 ;; If we are not over an overlay after subtracting 1, it means we are
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1633 ;; in the description area preceding session records. In this case,
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1634 ;; goto the top of the registry buffer.
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1635 (or (car (overlays-at point))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1636 (setq point (point-min)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1637 point
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1638 ))))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1639
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1640 ;; this is the action invoked when the user selects a patch from the meta
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1641 ;; buffer.
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1642 (defun ediff-patch-file-form-meta (file &optional startup-hooks)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1643 (let* ((pos (ediff-event-point last-command-event))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1644 (meta-buf (ediff-event-buffer last-command-event))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1645 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1646 (info (ediff-get-meta-info meta-buf pos))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1647 (meta-patchbuf ediff-meta-patchbufer)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1648 session-buf beg-marker end-marker)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1649
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1650 (if (or (file-directory-p file) (string-match "/dev/null" file))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1651 (error "`%s' is not an ordinary file" (file-name-as-directory file)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1652 (setq session-buf (ediff-get-session-buffer info)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1653 beg-marker (ediff-get-session-objB-name info)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1654 end-marker (ediff-get-session-objC-name info))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1655
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1656 (or (ediff-buffer-live-p session-buf) ; either an active patch session
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1657 (null session-buf) ; or it is a virgin session
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1658 (error
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1659 "Patch has been already applied to this file--cannot be repeated!"))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1660
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1661 (ediff-eval-in-buffer meta-patchbuf
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1662 (save-restriction
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1663 (widen)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1664 (narrow-to-region beg-marker end-marker)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1665 (ediff-patch-file-internal meta-patchbuf file startup-hooks)))))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1666
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1667
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1668 (defun ediff-meta-mark-equal-files ()
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1669 "Run though the session list and mark identical files.
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1670 This is used only for sessions that involve 2 or 3 files at the same time."
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1671 (interactive)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1672 (let ((list (cdr ediff-meta-list))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1673 fileinfo1 fileinfo2 fileinfo3 elt)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1674 (while (setq elt (car list))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1675 (setq fileinfo1 (ediff-get-session-objA elt)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1676 fileinfo2 (ediff-get-session-objB elt)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1677 fileinfo3 (ediff-get-session-objC elt))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1678 (ediff-set-file-eqstatus fileinfo1 nil)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1679 (ediff-set-file-eqstatus fileinfo2 nil)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1680 (ediff-set-file-eqstatus fileinfo3 nil)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1681
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1682 (ediff-mark-if-equal fileinfo1 fileinfo2)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1683 (if (ediff-metajob3)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1684 (progn
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1685 (ediff-mark-if-equal fileinfo1 fileinfo3)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1686 (ediff-mark-if-equal fileinfo2 fileinfo3)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1687 (setq list (cdr list))))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1688 (ediff-update-meta-buffer (current-buffer)))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1689
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1690 ;; mark files 1 and 2 as equal, if they are.
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1691 (defun ediff-mark-if-equal (fileinfo1 fileinfo2)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1692 (get-buffer-create ediff-tmp-buffer)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1693 (or (file-directory-p (car fileinfo1))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1694 (file-directory-p (car fileinfo2))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1695 (if (= (ediff-make-diff2-buffer
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1696 ediff-tmp-buffer (car fileinfo1) (car fileinfo2))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1697 0)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1698 (progn
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1699 (ediff-set-file-eqstatus fileinfo1 t)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1700 (ediff-set-file-eqstatus fileinfo2 t)))))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14582
diff changeset
1701
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1702
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1703
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1704 ;;; Local Variables:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1705 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1706 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
1707 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1708 ;;; End:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1709
13607
71a4a349d998 Renamed from ediff-meta.el. Changed provide.
Richard M. Stallman <rms@gnu.org>
parents: 13216
diff changeset
1710 (provide 'ediff-mult)
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1711 (require 'ediff-util)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1712
13607
71a4a349d998 Renamed from ediff-meta.el. Changed provide.
Richard M. Stallman <rms@gnu.org>
parents: 13216
diff changeset
1713 ;;; ediff-mult.el ends here