annotate lisp/ediff-mult.el @ 13230:ad1d4be6bb8d libc-951018 libc-951029 libc-951031 libc-951101 libc-951102 libc-951103 libc-951104 libc-951105 libc-951106 libc-951107 libc-951108 libc-951109 libc-951110 libc-951111 libc-951112 libc-951113 libc-951114 libc-951115 libc-951116 libc-951117 libc-951118 libc-951119 libc-951120 libc-951121 libc-951122 libc-951123 libc-951124 libc-951125 libc-951126 libc-951127 libc-951128 libc-951129 libc-951130

* config.guess: Recognize HP model 819 machines has having a PA 1.1 processor.
author Jeff Law <law@redhat.com>
date Mon, 16 Oct 1995 15:40:29 +0000
parents b9dc8cc658d5
children 71a4a349d998
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13130
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1 ;;; ediff-meta.el --- support for multi-file/multi-buffer processing in Ediff
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
2 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
4 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
5
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
6 ;; This file is part of GNU Emacs.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
7
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
8 ;; GNU Emacs is free software; you can redistribute it and/or modify
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
9 ;; 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
10 ;; the Free Software Foundation; either version 2, or (at your option)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
11 ;; any later version.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
12
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
13 ;; GNU Emacs is distributed in the hope that it will be useful,
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
16 ;; GNU General Public License for more details.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
17
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
18 ;; You should have received a copy of the GNU General Public License
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
19 ;; along with GNU Emacs; see the file COPYING. If not, write to
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
20 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
21
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
22 ;;; Notes:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
23 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
24 ;; Users are strongly encourage to add functionality to this file.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
25 ;; In particular, epatch needs to be enhanced to work with multi-file
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
26 ;; patches. The present file contains all the infrastructure needed for that.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
27 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
28 ;; Generally, to to implement a new multisession capability within Ediff,
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
29 ;; you need to tell it
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
30 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
31 ;; 1. How to display the session group buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
32 ;; This function must indicate which Ediff sessions are active (+) and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
33 ;; which are finished (-).
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
34 ;; See ediff-redraw-directory-group-buffer for an example.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
35 ;; In all likelihood, ediff-redraw-directory-group-buffer can be used
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
36 ;; directly or after a small modification.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
37 ;; 2. What action to take when the user clicks button 2 or types v,e, or
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
38 ;; RET. See ediff-dir-action.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
39 ;; 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
40 ;; depending on the particular Ediff operation you want to invoke)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
41 ;; in the following format:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
42 ;; ((obj1 obj2 [optional obj3]) (...) ...)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
43 ;; Actually, the format of this list is pretty much up to the
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
44 ;; developer. The only thing is that it must be a list of lists.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
45 ;; Also, keep in mind that the function ediff-prepare-meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
46 ;; (which see) prepends nil in fron of each list (i.e., the above list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
47 ;; will become ((nil obj1 obj2 ...) (nil ...) ...).
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
48 ;; Ediff expects that your function (in 2 above) will arrange to
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
49 ;; replace this prepended nil (via setcar) with the actual ediff
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
50 ;; control buffer associated with an appropriate Ediff session.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
51 ;; This is arranged through internal startup hooks that can be passed
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
52 ;; to any of Ediff major entries (such as ediff-files, epatch, etc.).
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
53 ;; See how this is done in ediff-dir-action.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
54 ;; 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
55 ;; passing all this info.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
56 ;; You may be able to use ediff-directories-internal as a template.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
57 ;; 5. If you intend to add several related pieces of functionality,
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
58 ;; 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
59 ;; and then write several top-level interactive functions that call it
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
60 ;; with different parameters.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
61 ;; See how ediff-directories, ediff-merge-directories, and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
62 ;; ediff-merge-directories-with-ancestor all use
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
63 ;; ediff-directories-internal.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
64 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
65 ;; In case of multifile patching, the easiest thing is to first apply the patch
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
66 ;; and then find out which files were patched (using the algorithm utilized by
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
67 ;; Unix patch and by parsing the patch file). The procedure ediff-patch-file
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
68 ;; works for single-file patches only. However, it can deal with remote and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
69 ;; compressed files. Check out ediff-patch-file for details.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
70 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
71 ;; Another useful addition here could be session groups selected by patterns
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
72 ;; (which are different in each directory). For instance, one may want to
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
73 ;; 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
74 ;; 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
75 ;; 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
76 ;;
13216
b9dc8cc658d5 Moved defsubsts up.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13130
diff changeset
77 ;; Implementing this requires writing an collating function, which should pair
b9dc8cc658d5 Moved defsubsts up.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13130
diff changeset
78 ;; 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
79 ;; that do the layout of the meta- and differences buffers and of
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
80 ;; ediff-dir-action.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
81
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
82 (require 'ediff-init)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
83
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
84 ;; meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
85 (ediff-defvar-local ediff-meta-buffer nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
86 (ediff-defvar-local ediff-parent-meta-buffer nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
87 ;; the registry buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
88 (defvar ediff-registry-buffer nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
89
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
90 (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
91
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
92 Useful commands:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
93 button2, `v', RET over a session line: start that Ediff session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
94 `M' in any session invoked from here: bring back this buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
95 `R':\tdisplay the registry of active Ediff sessions
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
96 `h':\tmark session for hiding; with prefix arg--unmark
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
97 `x':\thide marked sessions; with prefix arg--unhide hidden sessions
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
98 `m':\tmark session for non-hiding operation; with prefix arg--unmark
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
99 SPC:\tnext session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
100 DEL:\tprevious session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
101 `E':\tbrowse Ediff on-line manual
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
102 `q':\tquit this session group
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
103 ")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
104
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
105 (ediff-defvar-local ediff-meta-buffer-map nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
106 "The keymap for the meta buffer.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
107 (defvar ediff-dir-diffs-buffer-map (make-sparse-keymap)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
108 "The keymap to be installed in the buffer showing differences between
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
109 directories.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
110
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
111 ;; Variable specifying the action to take when the use invokes ediff in the
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
112 ;; meta buffer. This is usually ediff-registry-action or ediff-dir-action
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
113 (ediff-defvar-local ediff-meta-action-function nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
114 ;; Tells ediff-update-meta-buffer how to redraw it
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
115 (ediff-defvar-local ediff-meta-redraw-function nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
116 ;; Tells ediff-dir-action and similar procedures how to invoke Ediff for the
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
117 ;; sessions in a given session group
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
118 (ediff-defvar-local ediff-session-action-function nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
119
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
120 (ediff-defvar-local ediff-metajob-name nil "")
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 ;; buffer used to collect custom diffs from individual sessions in the group
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
123 (ediff-defvar-local ediff-meta-diff-buffer nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
124
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
125 ;; history var to use for filtering groups
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
126 (defvar ediff-filtering-regexp-history nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
127
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
128 ;; This has the form ((ctl-buf file1 file2) (stl-buf file1 file2) ...)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
129 ;; If ctl-buf is nil, the file-pare wasn't processed yet. If it is
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
130 ;; 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
131 ;; buffer, this means ediff is still working on the pair
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
132 (ediff-defvar-local ediff-meta-list nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
133
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
134
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
135 ;; the difference list between directories in a directory session group
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
136 (ediff-defvar-local ediff-dir-difference-list nil "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
137 (ediff-defvar-local ediff-dir-diffs-buffer 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 ;; The registry of Ediff sessions. A list of control buffers.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
140 (defvar ediff-session-registry nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
141
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
142 (defvar ediff-registry-setup-hook nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
143 "*Hooks run just after the registry control panel is set up.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
144 (defvar ediff-session-group-setup-hook nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
145 "*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
146 ediff-directories, is run.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
147 (defvar ediff-show-registry-hook nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
148 "*Hooks run just after the registry buffer is shown.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
149 (defvar ediff-show-session-group-hook nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
150 "*Hooks run just after a session group buffer is shown.")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
151
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
152 ;;; API
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
153
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
154 (defun ediff-get-group-buffer (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
155 (nth 0 (car meta-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
156 (defun ediff-get-group-regexp (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
157 (nth 1 (car meta-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
158 (defun ediff-get-group-objA (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
159 (nth 2 (car meta-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
160 (defun ediff-get-group-objB (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
161 (nth 3 (car meta-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
162 (defun ediff-get-group-objC (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
163 (nth 4 (car meta-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
164 (defun ediff-get-session-buffer (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
165 (nth 0 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
166 (defun ediff-get-session-status (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
167 (nth 1 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
168 (defun ediff-get-session-objA (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
169 (nth 2 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
170 (defun ediff-get-session-objB (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
171 (nth 3 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
172 (defun ediff-get-session-objC (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
173 (nth 4 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
174 (defun ediff-set-session-status (session-info new-status)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
175 (setcar (cdr session-info) new-status))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
176
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
177 ;; set up the keymap in the meta buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
178 (defun ediff-setup-meta-map()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
179 (setq ediff-meta-buffer-map (make-sparse-keymap))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
180 (suppress-keymap ediff-meta-buffer-map)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
181 (define-key ediff-meta-buffer-map "q" 'ediff-quit-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
182 (define-key ediff-meta-buffer-map "R" 'ediff-show-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
183 (define-key ediff-meta-buffer-map "E" 'ediff-documentation)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
184 (define-key ediff-meta-buffer-map "v" ediff-meta-action-function)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
185 (define-key ediff-meta-buffer-map "\C-m" ediff-meta-action-function)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
186 (define-key ediff-meta-buffer-map " " 'ediff-next-meta-item)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
187 (define-key ediff-meta-buffer-map "\C-?" 'ediff-previous-meta-item)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
188 (define-key ediff-meta-buffer-map [delete] 'ediff-previous-meta-item)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
189 (define-key ediff-meta-buffer-map [backspace] 'ediff-previous-meta-item)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
190 (if ediff-no-emacs-help-in-control-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
191 (define-key ediff-meta-buffer-map "\C-h" 'ediff-previous-meta-item))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
192 (if ediff-emacs-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
193 (define-key ediff-meta-buffer-map [mouse-2] ediff-meta-action-function)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
194 (define-key ediff-meta-buffer-map [button2] ediff-meta-action-function))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
195
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
196 (use-local-map ediff-meta-buffer-map))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
197
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
198 (defun ediff-meta-mode ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
199 "This mode controls all operations on Ediff session groups.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
200 It is entered through one of the following commands:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
201 `ediff-directories'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
202 `edirs'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
203 `ediff-directories3'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
204 `edirs3'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
205 `ediff-merge-directories'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
206 `edirs-merge'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
207 `ediff-merge-directories-with-ancestor'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
208 `edirs-merge-with-ancestor'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
209 `ediff-directory-revisions'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
210 `edir-revisions'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
211 `ediff-merge-directory-revisions'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
212 `edir-merge-revisions'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
213 `ediff-merge-directory-revisions-with-ancestor'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
214 `edir-merge-revisions-with-ancestor'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
215
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
216 Commands:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
217 \\{ediff-meta-buffer-map}"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
218 (kill-all-local-variables)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
219 (setq major-mode 'ediff-meta-mode)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
220 (setq mode-name "MetaEdiff"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
221
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
222
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
223 ;; the keymap for the buffer showing directory differences
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
224 (suppress-keymap ediff-dir-diffs-buffer-map)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
225 (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
226 (define-key ediff-dir-diffs-buffer-map " " 'next-line)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
227 (define-key ediff-dir-diffs-buffer-map "\C-?" 'previous-line)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
228 (define-key ediff-dir-diffs-buffer-map [delete] 'previous-line)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
229 (define-key ediff-dir-diffs-buffer-map [backspace] 'previous-line)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
230
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
231 (defun ediff-next-meta-item (count)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
232 "Move to the next item in Ediff registry or session group buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
233 Moves in circular fashion. With numeric prefix arg, skip this many items."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
234 (interactive "p")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
235 (or count (setq count 1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
236 (while (< 0 count)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
237 (setq count (1- count))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
238 (ediff-next-meta-item1)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
239
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
240 ;; Move to the next meta item
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
241 (defun ediff-next-meta-item1 ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
242 (let (pos)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
243 (setq pos (ediff-next-meta-overlay-start (point)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
244 ;;; ;; skip deleted
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
245 ;;; (while (memq (ediff-get-session-status
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
246 ;;; (ediff-get-meta-info (current-buffer) pos 'noerror))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
247 ;;; '(?H ?I))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
248 ;;; (setq pos (ediff-next-meta-overlay-start pos)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
249
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
250 (if pos (goto-char pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
251 (if (eq ediff-metajob-name 'ediff-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
252 (if (search-forward "*Ediff" nil t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
253 (skip-chars-backward "a-zA-Z*"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
254 (if (> (skip-chars-forward "-+?H* \t0-9") 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
255 (backward-char 1)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
256
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
257
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
258 (defun ediff-previous-meta-item (count)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
259 "Move to the previous item in Ediff registry or session group buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
260 Moves in circular fashion. With numeric prefix arg, skip this many items."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
261 (interactive "p")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
262 (or count (setq count 1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
263 (while (< 0 count)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
264 (setq count (1- count))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
265 (ediff-previous-meta-item1)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
266
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
267 (defun ediff-previous-meta-item1 ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
268 (let (pos)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
269 (setq pos (ediff-previous-meta-overlay-start (point)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
270 ;;; ;; skip deleted
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
271 ;;; (while (ediff-get-session-status
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
272 ;;; (ediff-get-meta-info (current-buffer) pos 'noerror))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
273 ;;; (setq pos (ediff-previous-meta-overlay-start pos)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
274
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
275 (if pos (goto-char pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
276 (if (eq ediff-metajob-name 'ediff-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
277 (if (search-forward "*Ediff" nil t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
278 (skip-chars-backward "a-zA-Z*"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
279 (if (> (skip-chars-forward "-+?H* \t0-9") 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
280 (backward-char 1)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
281
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
282
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
283
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
284 ;; DIR1, DIR2, DIR3 are directories.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
285 ;; REGEXP is a regexp used to filter
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
286 ;; files in the directories.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
287 ;; 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
288 ;; 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
289 ;; is included, since dir3 files are supposed to be ancestors for merging.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
290 ;; Returns a list of the form:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
291 ;; ((dir1 dir2 dir3) (f1 f2 f3) (f1 f2 f3) ...)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
292 ;; dir3, f3 can be nil if intersecting only 2 directories.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
293 ;; If COMPARISON-FUNC is given, use it. Otherwise, use string=
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
294 ;; DIFF-VAR is contains the name of the variable in which to return the
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
295 ;; difference list. The diff list is of the form:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
296 ;; ((dir1 dir2 dir3) (file . num) (file . num)...)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
297 ;; where num encodes the set of dirs where the file is found:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
298 ;; 2 - only dir1; 3 - only dir2; 5 - only dir3; 6 - dir1&2; 10 - dir1&3; etc.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
299 (defun ediff-intersect-directories (jobname diff-var regexp dir1 dir2
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
300 &optional dir3 comparison-func)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
301 (require 'cl)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
302 (setq comparison-func (or comparison-func 'string=))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
303 (let (lis1 lis2 lis3 common auxdir1 auxdir2 auxdir3 difflist)
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 (setq auxdir1 (file-name-as-directory dir1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
306 lis1 (directory-files auxdir1 nil regexp)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
307 auxdir2 (file-name-as-directory dir2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
308 lis2 (directory-files auxdir2 nil regexp))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
309
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
310 (if (stringp dir3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
311 (setq auxdir3 (file-name-as-directory dir3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
312 lis3 (directory-files auxdir3 nil regexp)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
313
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
314 (setq lis1 (delete "." lis1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
315 lis1 (delete ".." lis1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
316
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
317 (setq common (intersection lis1 lis2 :test comparison-func))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
318 ;; get rid of files that are directories in dir1 but not dir2
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
319 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
320 (if (Xor (file-directory-p (concat auxdir1 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
321 (file-directory-p (concat auxdir2 elt)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
322 (setq common (delq elt common)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
323 common)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
324 ;; intersect with the third dir
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
325 (if lis3 (setq common (intersection common lis3 :test comparison-func)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
326 (if (ediff-comparison-metajob3 jobname)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
327 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
328 (if (Xor (file-directory-p (concat auxdir1 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
329 (file-directory-p (concat auxdir3 elt)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
330 (setq common (delq elt common)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
331 common))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
332
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
333 ;; trying to avoid side effects of sorting
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
334 (setq common (sort (copy-list common) 'string-lessp))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
335
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
336 ;; compute difference list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
337 (setq difflist (set-difference
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
338 (union (union lis1 lis2 :test comparison-func)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
339 lis3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
340 :test comparison-func)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
341 common
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
342 :test comparison-func)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
343 difflist (delete "." difflist)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
344 ;; copy-list needed because sort sorts it by side effects
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
345 difflist (sort (copy-list (delete ".." difflist)) 'string-lessp))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
346
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
347 (setq difflist (mapcar (function (lambda (elt) (cons elt 1))) difflist))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
348
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
349 ;; check for files belonging to lis1/2/3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
350 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
351 (if (member (car elt) lis1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
352 (setcdr elt (* (cdr elt) 2)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
353 (if (member (car elt) lis2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
354 (setcdr elt (* (cdr elt) 3)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
355 (if (member (car elt) lis3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
356 (setcdr elt (* (cdr elt) 5)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
357 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
358 difflist)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
359 (setq difflist (cons (list regexp auxdir1 auxdir2 auxdir3) difflist))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
360
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
361 (set diff-var difflist)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
362
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
363 ;; return result
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
364 (cons (list regexp auxdir1 auxdir2 auxdir3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
365 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
366 (list (concat auxdir1 elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
367 (concat auxdir2 elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
368 (if lis3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
369 (concat auxdir3 elt)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
370 common))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
371 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
372
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
373 ;; find directory files that are under revision.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
374 ;; display subdirectories, too, since we may visit them recursively.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
375 (defun ediff-get-directory-files-under-revision (jobname regexp dir1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
376 (require 'cl)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
377 (let (lis1 elt common auxdir1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
378 (setq auxdir1 (file-name-as-directory dir1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
379 lis1 (directory-files auxdir1 nil regexp))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
380
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
381 (while lis1
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
382 (setq elt (car lis1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
383 lis1 (cdr lis1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
384 ;; take files under revision control
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
385 (cond ((file-directory-p (concat auxdir1 elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
386 (setq common (cons elt common)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
387 ((file-exists-p (concat auxdir1 elt ",v"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
388 (setq common (cons elt common))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
389 ) ; while
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
390
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
391 (setq common (delete "." common)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
392 common (delete ".." common))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
393
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
394 ;; trying to avoid side effects of sorting
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
395 (setq common (sort (copy-list common) 'string-lessp))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
396
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
397 ;; return result
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
398 (cons (list regexp auxdir1 nil nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
399 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
400 (list (concat auxdir1 elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
401 nil nil)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
402 common))
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
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
405
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
406 ;; If file groups selected by patterns will ever be implemented, this
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
407 ;; comparison function might become useful.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
408 ;;;; uses external variables PAT1 PAT2 to compare str1/2
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
409 ;;;; patterns must be of the form ???*???? where ??? are strings of chars
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
410 ;;;; containing no *.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
411 ;;(defun ediff-pattern= (str1 str2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
412 ;; (let (pos11 pos12 pos21 pos22 len1 len2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
413 ;; (setq pos11 0
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
414 ;; len (length epat1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
415 ;; pos12 len)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
416 ;; (while (and (< pos11 len) (not (= (aref epat1 pos11) ?*)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
417 ;; (setq pos11 (1+ pos11)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
418 ;; (while (and (> pos12 0) (not (= (aref epat1 (1- pos12)) ?*)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
419 ;; (setq pos12 (1- pos12)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
420 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
421 ;; (setq pos21 0
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
422 ;; len (length epat2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
423 ;; pos22 len)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
424 ;; (while (and (< pos21 len) (not (= (aref epat2 pos21) ?*)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
425 ;; (setq pos21 (1+ pos21)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
426 ;; (while (and (> pos22 0) (not (= (aref epat2 (1- pos22)) ?*)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
427 ;; (setq pos22 (1- pos22)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
428 ;;
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
429 ;; (if (and (> (length str1) pos12) (>= pos12 pos11) (> pos11 -1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
430 ;; (> (length str2) pos22) (>= pos22 pos21) (> pos21 -1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
431 ;; (string= (substring str1 pos11 pos12)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
432 ;; (substring str2 pos21 pos22)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
433 ;; ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
434
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
435
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
436 ;; Prepare meta-buffer in accordance with the argument-function and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
437 ;; redraw-function. Must return the created meta-buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
438 (defun ediff-prepare-meta-buffer (action-func meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
439 meta-buffer-name redraw-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
440 jobname &optional startup-hooks)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
441 (let* ((meta-buffer-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
442 (ediff-unique-buffer-name meta-buffer-name "*"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
443 (meta-buffer (get-buffer-create meta-buffer-name)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
444 (ediff-eval-in-buffer meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
445
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
446 ;; comes first
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
447 (ediff-meta-mode)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
448
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
449 (setq ediff-meta-action-function action-func
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
450 ediff-meta-redraw-function redraw-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
451 ediff-metajob-name jobname
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
452 ediff-meta-buffer meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
453
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
454 ;; comes after ediff-meta-action-function is set
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
455 (ediff-setup-meta-map)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
456
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
457 (if (eq ediff-metajob-name 'ediff-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
458 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
459 (setq ediff-registry-buffer meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
460 ediff-meta-list meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
461 ;; this func is used only from registry buffer, not from other
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
462 ;; meta-buffs.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
463 (define-key
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
464 ediff-meta-buffer-map "M" 'ediff-show-meta-buff-from-registry))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
465 ;; initialize the meta list -- don't do this for registry we prepend
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
466 ;; '(nil nil) nil to all elts of meta-list, except the first. The
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
467 ;; first nil will later be replaced by the session buffer. The second
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
468 ;; is reserved for session status.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
469 ;; (car ediff-meta-list) gets cons'ed with the session group buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
470 (setq ediff-meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
471 (cons (cons meta-buffer (car meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
472 (mapcar (function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
473 (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
474 (cons nil (cons nil elt))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
475 (cdr meta-list)))))
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 (or (eq meta-buffer ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
478 (setq ediff-session-registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
479 (cons meta-buffer ediff-session-registry)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
480
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
481 ;; redraw-function uses ediff-meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
482 (funcall redraw-function ediff-meta-list)
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 ;; set read-only/non-modified
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
485 (setq buffer-read-only t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
486 (set-buffer-modified-p nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
487
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
488 (run-hooks 'startup-hooks)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
489 ;; arrange for showing directory contents differences
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
490 ;; must be after run startup-hooks, since ediff-dir-difference-list is
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
491 ;; set inside these hooks
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
492 (if (eq action-func 'ediff-dir-action)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
493 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
494 ;; put meta buffer in (car ediff-dir-difference-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
495 (setq ediff-dir-difference-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
496 (cons (cons meta-buffer (car ediff-dir-difference-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
497 (cdr ediff-dir-difference-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
498
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
499 (or (ediff-dir1-metajob jobname)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
500 (ediff-draw-dir-diffs ediff-dir-difference-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
501 (define-key ediff-meta-buffer-map "h" 'ediff-mark-for-hiding)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
502 (define-key
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
503 ediff-meta-buffer-map "x" 'ediff-hide-marked-sessions)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
504 (define-key ediff-meta-buffer-map "m" 'ediff-mark-for-operation)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
505 (if (ediff-collect-diffs-metajob jobname)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
506 (define-key
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
507 ediff-meta-buffer-map "P" 'ediff-collect-custom-diffs))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
508 (define-key ediff-meta-buffer-map "u" 'ediff-up-meta-hierarchy)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
509 (define-key ediff-meta-buffer-map "D" 'ediff-show-dir-diffs)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
510
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
511 (if (eq ediff-metajob-name 'ediff-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
512 (run-hooks 'ediff-registry-setup-hook)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
513 (run-hooks 'ediff-session-group-setup-hook))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
514 ) ; eval in meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
515 meta-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
516
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
517
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
518 ;; this is a setup function for ediff-directories
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
519 ;; must return meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
520 (defun ediff-redraw-directory-group-buffer (meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
521 ;; extract directories
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
522 (let ((meta-buf (ediff-get-group-buffer meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
523 (empty t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
524 (sessionNum 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
525 regexp elt session-buf f1 f2 f3 pt
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
526 point tmp-list buffer-read-only)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
527 (ediff-eval-in-buffer meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
528 (setq point (point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
529 (erase-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
530 (insert (format ediff-meta-buffer-message
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
531 (ediff-abbrev-jobname ediff-metajob-name)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
532
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
533 (setq regexp (ediff-get-group-regexp meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
534
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
535 (if (ediff-collect-diffs-metajob)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
536 (insert
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
537 " `P':\tcollect custom diffs of all marked sessions\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
538 (insert
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
539 " `u':\tshow parent session group
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
540 `D':\tdisplay differences among the contents of directories\n\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
541
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
542 (if (and (stringp regexp) (> (length regexp) 0))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
543 (insert (format "Filter-through regular expression: %s\n" regexp)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
544
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
545 (insert "\n
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
546 Size Name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
547 -----------------------------------------------------------------------
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
548
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
549 ")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
550
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
551 ;; discard info on directories and regexp
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
552 (setq meta-list (cdr meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
553 tmp-list meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
554 (while (and tmp-list empty)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
555 (if (and (car tmp-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
556 (not (eq (ediff-get-session-status (car tmp-list)) ?I)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
557 (setq empty nil))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
558 (setq tmp-list (cdr tmp-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
559
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
560 (if empty
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
561 (insert
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
562 " ****** ****** This session group has no members\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
563
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
564 ;; now organize file names like this:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
565 ;; preferred format:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
566 ;; use-mark sizeA dateA sizeB dateB filename
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
567 ;; I don't have time to mess up with calculating last modtimes
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
568 ;; (XEmacs has no decode-time function), so
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
569 ;; the actual format is:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
570 ;; use-mark Size filename
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
571 ;; make sure directories are displayed with a trailing slash.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
572 ;; If one is a directory and another isn't, indicate this with a `?'
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
573 (while meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
574 (setq elt (car meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
575 meta-list (cdr meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
576 sessionNum (1+ sessionNum))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
577 (if (eq (ediff-get-session-status elt) ?I)
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 (setq session-buf (ediff-get-session-buffer elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
580 f1 (ediff-get-session-objA elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
581 f2 (ediff-get-session-objB elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
582 f3 (ediff-get-session-objC elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
583 (setq pt (point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
584 ;; insert markers
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
585 (insert (cond ((null session-buf) " ") ; virgin session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
586 ((ediff-buffer-live-p session-buf) "+") ;active session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
587 (t "-"))) ; finished session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
588 (insert (cond ((ediff-get-session-status elt)) ; session has status,
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
589 ;;; e.g., ?H, ?I
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
590 (t " "))) ; normal session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
591 (insert " Session " (int-to-string sessionNum) ":\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
592 (ediff-meta-insert-file-info f1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
593 (ediff-meta-insert-file-info f2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
594 (ediff-meta-insert-file-info f3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
595 (ediff-set-meta-overlay pt (point) elt)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
596 (set-buffer-modified-p nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
597 (goto-char point)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
598 meta-buf)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
599
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
600 ;; Check if this is a problematic session.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
601 ;; Return nil if not. Otherwise, return symbol representing the problem
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
602 ;; At present, problematic sessions occur only in -with-ancestor comparisons
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
603 ;; when the ancestor is a directory rather than a file.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
604 (defun ediff-problematic-session-p (session)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
605 (let ((f1 (ediff-get-session-objA session))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
606 (f2 (ediff-get-session-objB session))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
607 (f3 (ediff-get-session-objC session)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
608 (cond ((and (stringp f1) (not (file-directory-p f1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
609 (stringp f2) (not (file-directory-p f2))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
610 (stringp f3) (file-directory-p f3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
611 (ediff-ancestor-metajob))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
612 ;; more may be added later
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
613 'ancestor-is-dir)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
614 (t nil))))
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 (defun ediff-meta-insert-file-info (file)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
617 (if (stringp file)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
618 (insert
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
619 (format
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
620 " %10d %s\n"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
621 (nth 7 (file-attributes file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
622 ;; dir names in meta lists have no trailing `/' so insert it
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
623 (cond ((file-directory-p file)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
624 (file-name-as-directory (ediff-abbreviate-file-name file)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
625 (t (ediff-abbreviate-file-name file)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
626 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
627
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
628
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
629
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
630 (defun ediff-draw-dir-diffs (diff-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
631 (if (null diff-list) (error "Lost difference info on these directories"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
632 (let* ((buf-name (ediff-unique-buffer-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
633 "*Ediff File Group Differences" "*"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
634 (regexp (ediff-get-group-regexp diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
635 (dir1 (ediff-abbreviate-file-name (ediff-get-group-objA diff-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
636 (dir2 (ediff-abbreviate-file-name (ediff-get-group-objB diff-list)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
637 (dir3 (ediff-get-group-objC diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
638 (dir3 (if (stringp dir3) (ediff-abbreviate-file-name dir3)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
639 (meta-buf (ediff-get-group-buffer diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
640 (underline (make-string 26 ?-))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
641 file code
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
642 buffer-read-only)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
643 ;; skip the directory part
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
644 (setq diff-list (cdr diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
645 (setq ediff-dir-diffs-buffer (get-buffer-create buf-name))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
646 (ediff-eval-in-buffer ediff-dir-diffs-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
647 (use-local-map ediff-dir-diffs-buffer-map)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
648 (erase-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
649 (setq ediff-meta-buffer meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
650 (insert "\t\t*** Directory Differences ***\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
651 (insert "
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
652 Useful commands:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
653 `q': hide this buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
654 SPC: next line
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
655 DEL: previous line\n\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
656
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
657 (if (and (stringp regexp) (> (length regexp) 0))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
658 (insert (format "Filter-through regular expression: %s\n" regexp)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
659 (insert "\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
660 (insert (format "\n%-27s%-26s"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
661 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
662 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
663 (file-name-as-directory dir1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
664 25)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
665 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
666 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
667 (file-name-as-directory dir2))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
668 25)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
669 (if dir3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
670 (insert (format " %-25s\n"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
671 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
672 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
673 (file-name-as-directory dir3))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
674 25)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
675 (insert "\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
676 (insert (format "%s%s" underline underline))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
677 (if (stringp dir3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
678 (insert (format "%s\n\n" underline))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
679 (insert "\n\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
680
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
681 (if (null diff-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
682 (insert "\n\t*** No differences ***\n"))
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 (while diff-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
685 (setq file (car (car diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
686 code (cdr (car diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
687 diff-list (cdr diff-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
688 (if (= (mod code 2) 0) ; dir1
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
689 (insert (format "%-27s"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
690 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
691 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
692 (if (file-directory-p (concat dir1 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
693 (file-name-as-directory file)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
694 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
695 24)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
696 (insert (format "%-27s" "---")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
697 (if (= (mod code 3) 0) ; dir2
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
698 (insert (format "%-26s"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
699 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
700 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
701 (if (file-directory-p (concat dir2 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
702 (file-name-as-directory file)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
703 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
704 24)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
705 (insert (format "%-26s" "---")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
706 (if (stringp dir3)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
707 (if (= (mod code 5) 0) ; dir3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
708 (insert (format " %-25s"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
709 (ediff-truncate-string-left
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
710 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
711 (if (file-directory-p (concat dir3 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
712 (file-name-as-directory file)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
713 file))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
714 24)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
715 (insert (format " %-25s" "---"))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
716 (insert "\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
717 (setq buffer-read-only t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
718 (set-buffer-modified-p nil)) ; eval in diff buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
719 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
720
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
721 (defun ediff-bury-dir-diffs-buffer ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
722 "Bury the directory difference buffer. Display the meta buffer instead."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
723 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
724 (let ((buf ediff-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
725 wind)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
726 (bury-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
727 (if (setq wind (ediff-get-visible-buffer-window buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
728 (select-window wind)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
729 (set-window-buffer (selected-window) buf))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
730
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
731 ;; executes in dir session group buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
732 ;; show buffer differences
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
733 (defun ediff-show-dir-diffs ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
734 "Display differences among the directories involved in session group."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
735 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
736 (if (ediff-dir1-metajob)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
737 (error "This command is inapplicable in the present context"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
738 (or (ediff-buffer-live-p ediff-dir-diffs-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
739 (ediff-draw-dir-diffs ediff-dir-difference-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
740 (let ((buf ediff-dir-diffs-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
741 (other-window 1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
742 (set-window-buffer (selected-window) buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
743 (goto-char (point-min))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
744
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
745 (defun ediff-up-meta-hierarchy ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
746 "Go to the parent session group buffer."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
747 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
748 (if (ediff-buffer-live-p ediff-parent-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
749 (ediff-show-meta-buffer ediff-parent-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
750 (error "This session group has no parent")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
751
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
752
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
753 ;; argument is ignored
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
754 (defun ediff-redraw-registry-buffer (&optional ignore)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
755 (ediff-eval-in-buffer ediff-registry-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
756 (let ((point (point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
757 elt bufAname bufBname bufCname cur-diff total-diffs pt
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
758 job-name meta-list registry-list buffer-read-only)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
759 (erase-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
760 (insert "This is a registry of all active Ediff sessions.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
761
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
762 Useful commands:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
763 button2, `v', RET over a session record: switch to that session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
764 `M' over a session record: display the associated session group
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
765 `R' in any Ediff session: display session registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
766 SPC:\tnext session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
767 DEL:\tprevious session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
768 `E':\tbrowse Ediff on-line manual
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
769 `q':\tbury registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
770
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
771
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
772 \t\tActive Ediff Sessions:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
773 \t\t----------------------
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
774
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
775 ")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
776 ;; purge registry list from dead buffers
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
777 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
778 (if (not (ediff-buffer-live-p elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
779 (setq ediff-session-registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
780 (delq elt ediff-session-registry)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
781 ediff-session-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
782
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
783 (if (null ediff-session-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
784 (insert " ******* No active Ediff sessions *******\n"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
785
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
786 (setq registry-list ediff-session-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
787 (while registry-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
788 (setq elt (car registry-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
789 registry-list (cdr registry-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
790
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
791 (if (ediff-buffer-live-p elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
792 (if (ediff-eval-in-buffer elt
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
793 (setq job-name ediff-metajob-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
794 meta-list ediff-meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
795 (and ediff-metajob-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
796 (not (eq ediff-metajob-name 'ediff-registry))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
797 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
798 (setq pt (point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
799 (insert (format " *group*\t%s: %s\n"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
800 (buffer-name elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
801 (ediff-abbrev-jobname job-name)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
802 (insert (format "\t\t %s %s %s\n"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
803 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
804 (ediff-get-group-objA meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
805 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
806 (or (ediff-get-group-objB meta-list) ""))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
807 (ediff-abbreviate-file-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
808 (or (ediff-get-group-objC meta-list) ""))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
809 (ediff-set-meta-overlay pt (point) elt))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
810 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
811 (ediff-eval-in-buffer elt
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
812 (setq bufAname (if (ediff-buffer-live-p ediff-buffer-A)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
813 (buffer-name ediff-buffer-A)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
814 "!!!killed buffer!!!")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
815 bufBname (if (ediff-buffer-live-p ediff-buffer-B)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
816 (buffer-name ediff-buffer-B)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
817 "!!!killed buffer!!!")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
818 bufCname (cond ((not (ediff-3way-job))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
819 "")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
820 ((ediff-buffer-live-p ediff-buffer-C)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
821 (buffer-name ediff-buffer-C))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
822 (t "!!!killed buffer!!!")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
823 (setq total-diffs (format "%-4d" ediff-number-of-differences)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
824 cur-diff
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
825 (cond ((= ediff-current-difference -1) " _")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
826 ((= ediff-current-difference
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
827 ediff-number-of-differences)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
828 " $")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
829 (t (format
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
830 "%4d" (1+ ediff-current-difference))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
831 job-name ediff-job-name))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
832 ;; back in the meta buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
833 (setq pt (point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
834 (insert cur-diff "/" total-diffs "\t"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
835 (buffer-name elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
836 (format ": %s" (ediff-abbrev-jobname job-name)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
837 (insert
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
838 "\n\t\t " bufAname " " bufBname " " bufCname "\n")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
839 (ediff-set-meta-overlay pt (point) elt))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
840 ) ; while
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
841 (set-buffer-modified-p nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
842 (goto-char point)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
843 )))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
844
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
845 ;; sets overlay around a meta record with 'ediff-meta-info property PROP
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
846 (defun ediff-set-meta-overlay (b e prop)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
847 (let (overl)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
848 (setq overl (ediff-make-overlay b e))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
849 (if ediff-emacs-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
850 (ediff-overlay-put overl 'mouse-face 'highlight)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
851 (ediff-overlay-put overl 'highlight t))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
852 (ediff-overlay-put overl 'ediff-meta-info prop)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
853
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
854 (defun ediff-mark-for-hiding (unmark)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
855 "Mark session for hiding. With prefix arg, unmark."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
856 (interactive "P")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
857 (let* ((pos (ediff-event-point last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
858 (meta-buf (ediff-event-buffer last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
859 ;; 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
860 (info (ediff-get-meta-info meta-buf pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
861 (session-buf (ediff-get-session-buffer info)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
862
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
863 (if unmark
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
864 (ediff-set-session-status info nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
865 (if (ediff-buffer-live-p session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
866 (error "Can't hide active session, %s" (buffer-name session-buf)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
867 (ediff-set-session-status info ?H))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
868 (ediff-update-meta-buffer meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
869 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
870
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
871 (defun ediff-mark-for-operation (unmark)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
872 "Mark session for a group operation. With prefix arg, unmark."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
873 (interactive "P")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
874 (let* ((pos (ediff-event-point last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
875 (meta-buf (ediff-event-buffer last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
876 ;; 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
877 (info (ediff-get-meta-info meta-buf pos)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
878
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
879 (if unmark
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
880 (ediff-set-session-status info nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
881 (ediff-set-session-status info ?*))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
882 (ediff-update-meta-buffer meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
883 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
884
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
885 (defun ediff-hide-marked-sessions (unhide)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
886 "Hide marked sessions. With prefix arg, unhide."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
887 (interactive "P")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
888 (let ((grp-buf (ediff-get-group-buffer ediff-meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
889 (meta-list (cdr ediff-meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
890 (from (if unhide ?I ?H))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
891 (to (if unhide ?H ?I))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
892 (numMarked 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
893 elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
894 (while meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
895 (setq elt (car meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
896 meta-list (cdr meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
897 (if (eq (ediff-get-session-status elt) from)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
898 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
899 (setq numMarked (1+ numMarked))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
900 (ediff-set-session-status elt to))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
901 (if (> numMarked 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
902 (ediff-update-meta-buffer grp-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
903 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
904 (if unhide
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
905 (message "Nothing to reveal...")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
906 (message "Nothing to hide...")))
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
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
909 ;; Apply OPERATION to marked sessions. Operation expects one argument of type
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
910 ;; 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
911 ;; Returns number of marked sessions on which operation was performed
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
912 (defun ediff-operate-on-marked-sessions (operation)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
913 (let ((grp-buf (ediff-get-group-buffer ediff-meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
914 (meta-list (cdr ediff-meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
915 (marksym ?*)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
916 (numMarked 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
917 (sessionNum 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
918 elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
919 (while meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
920 (setq elt (car meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
921 meta-list (cdr meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
922 sessionNum (1+ sessionNum))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
923 (if (eq (ediff-get-session-status elt) marksym)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
924 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
925 (setq numMarked (1+ numMarked))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
926 (funcall operation elt sessionNum))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
927 (ediff-update-meta-buffer grp-buf) ; just in case
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
928 numMarked
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
929 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
930
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
931 (defun ediff-append-custom-diff (session sessionNum)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
932 (or (ediff-collect-diffs-metajob)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
933 (error "Sorry, I don't do this for everyone..."))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
934 (let ((session-buf (ediff-get-session-buffer session))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
935 (meta-diff-buff ediff-meta-diff-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
936 (metajob ediff-metajob-name)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
937 tmp-buf custom-diff-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
938 (if (ediff-buffer-live-p session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
939 (ediff-eval-in-buffer session-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
940 (if (eq ediff-control-buffer session-buf) ; individual session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
941 (setq custom-diff-buf ediff-custom-diff-buffer))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
942
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
943 (or (ediff-buffer-live-p meta-diff-buff)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
944 (error "Ediff: something wrong--no multiple diffs buffer"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
945
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
946 (cond ((ediff-buffer-live-p custom-diff-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
947 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
948 (set-buffer meta-diff-buff)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
949 (goto-char (point-max))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
950 (insert-buffer custom-diff-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
951 (insert "\n")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
952 ((eq metajob 'ediff-directories)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
953 ;; get diffs by calling shell command on ediff-custom-diff-program
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
954 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
955 (set-buffer (setq tmp-buf (get-buffer-create ediff-tmp-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
956 (erase-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
957 (shell-command
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
958 (format "%s %s %s %s"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
959 ediff-custom-diff-program ediff-custom-diff-options
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
960 (ediff-get-session-objA session)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
961 (ediff-get-session-objB session))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
962 t))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
963 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
964 (set-buffer meta-diff-buff)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
965 (goto-char (point-max))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
966 (insert-buffer tmp-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
967 (insert "\n")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
968 (t
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
969 (error
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
970 "Session %d is marked but inactive--can't make its diff"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
971 sessionNum)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
972 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
973
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
974 (defun ediff-collect-custom-diffs ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
975 "Collect custom diffs of marked sessions in buffer `*Ediff Multifile Diffs*'.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
976 This operation is defined only for `ediff-directories' and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
977 `ediff-directory-revisions', since its intent is to produce
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
978 multifile patches. For `ediff-directory-revisions', we insist that
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
979 all marked sessions must be active."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
980 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
981 (or (ediff-buffer-live-p ediff-meta-diff-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
982 (setq ediff-meta-diff-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
983 (get-buffer-create
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
984 (ediff-unique-buffer-name "*Ediff Multifile Diffs" "*"))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
985 (ediff-eval-in-buffer ediff-meta-diff-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
986 (erase-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
987 (if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
988 ;; did something
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
989 (display-buffer ediff-meta-diff-buffer 'not-this-window)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
990 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
991 (message "No marked sessions found")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
992
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
993
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
994 ;; This function executes in meta buffer. It knows where event happened.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
995 (defun ediff-dir-action ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
996 "Execute appropriate action for the selected session."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
997 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
998 (let* ((pos (ediff-event-point last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
999 (meta-buf (ediff-event-buffer last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1000 ;; 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
1001 (info (ediff-get-meta-info meta-buf pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1002 session-buf file1 file2 file3 regexp)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1003
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1004 (setq session-buf (ediff-get-session-buffer info)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1005 file1 (ediff-get-session-objA info)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1006 file2 (ediff-get-session-objB info)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1007 file3 (ediff-get-session-objC info))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1008
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1009 ;; make sure we don't start on hidden sessions
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1010 ;; ?H means marked for hiding. ?I means invalid (hidden).
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1011 (if (memq (ediff-get-session-status info) '(?H ?I))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1012 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1013 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1014 (if (y-or-n-p "This session is marked as hidden, unmark? ")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1015 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1016 (ediff-set-session-status info nil)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1017 (ediff-update-meta-buffer meta-buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1018 (error "Aborted"))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1019
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1020 (ediff-eval-in-buffer meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1021 (goto-char pos) ; if the user clicked on session--move point there
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1022 ;; First handle sessions involving directories (which are themselves
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1023 ;; session groups)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1024 ;; After that handle individual sessions
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1025 (cond ((and (file-directory-p file1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1026 (stringp file2) (file-directory-p file2)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1027 (if (stringp file3) (file-directory-p file1) t))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1028 ;; do ediff/ediff-merge on subdirectories
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1029 (if (ediff-buffer-live-p session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1030 (ediff-show-meta-buffer session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1031 (setq regexp (read-string "Filter through regular expression: "
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1032 nil 'ediff-filtering-regexp-history))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1033 (ediff-directories-internal
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1034 file1 file2 file3 regexp
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1035 ediff-session-action-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1036 ediff-metajob-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1037 ;; make it update car info after startup
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1038 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1039 ;; child session group should know its parent
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1040 (setq ediff-parent-meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1041 (quote (, ediff-meta-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1042 ;; and parent will know its child
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1043 (setcar (quote (, info)) ediff-meta-buffer)))))))
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 ;; Do ediff-revision on a subdirectory
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1046 ((and (ediff-dir1-metajob) (file-directory-p file1))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1047 (if (ediff-buffer-live-p session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1048 (ediff-show-meta-buffer session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1049 (setq regexp (read-string "Filter through regular expression: "
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1050 nil 'ediff-filtering-regexp-history))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1051 (ediff-directory-revisions-internal
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1052 file1 regexp
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1053 ediff-session-action-function ediff-metajob-name
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1054 ;; make it update car info after startup
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1055 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1056 ;; child session group should know its parent
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1057 (setq ediff-parent-meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1058 (quote (, ediff-meta-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1059 ;; and parent will know its child
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1060 (setcar (quote (, info)) ediff-meta-buffer)))))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1061
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1062 ;; From here on---only individual session handlers
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1063
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1064 ;; handle an individual session with live control buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1065 ((ediff-buffer-live-p session-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1066 (ediff-eval-in-buffer session-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1067 (setq ediff-mouse-pixel-position (mouse-pixel-position))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1068 (ediff-recenter 'no-rehighlight)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1069
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1070 ((ediff-problematic-session-p info)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1071 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1072 (if (y-or-n-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1073 "This session's ancestor is a directory, merge without the ancestor? ")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1074 (ediff-merge-files
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1075 file1 file2
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1076 ;; arrange startup hooks
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1077 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1078 (setq ediff-meta-buffer (, (current-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1079 ;; see below for the explanation of what this does
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1080 (setcar
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1081 (quote (, info)) ediff-control-buffer)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1082 (error "Aborted")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1083 ((ediff-dir1-metajob) ; needs 1 file arg
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1084 (funcall ediff-session-action-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1085 file1
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1086 ;; arrange startup hooks
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1087 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1088 (setq ediff-meta-buffer (, (current-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1089 ;; see below for explanation of what this does
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1090 (setcar
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1091 (quote (, info)) ediff-control-buffer))))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1092 ((not (ediff-metajob3)) ; need 2 file args
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1093 (funcall ediff-session-action-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1094 file1 file2
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1095 ;; arrange startup hooks
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1096 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1097 (setq ediff-meta-buffer (, (current-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1098 ;; this makes ediff-startup pass the value of
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1099 ;; ediff-control-buffer back to the meta
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1100 ;; level, to the record in the meta list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1101 ;; containing the information about the
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1102 ;; session associated with that
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1103 ;; ediff-control-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1104 (setcar
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1105 (quote (, info)) ediff-control-buffer))))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1106 ((ediff-metajob3) ; need 3 file args
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1107 (funcall ediff-session-action-function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1108 file1 file2 file3
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1109 ;; arrange startup hooks
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1110 (` (list (lambda ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1111 (setq ediff-meta-buffer (, (current-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1112 (setcar
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1113 (quote (, info)) ediff-control-buffer))))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1114 ) ; cond
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1115 ) ; eval in meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1116 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1117
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1118 (defun ediff-registry-action ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1119 "Switch to a selected session."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1120 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1121 (let* ((pos (ediff-event-point last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1122 (buf (ediff-event-buffer last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1123 (ctl-buf (ediff-get-meta-info buf pos)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1124
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1125 (if (ediff-buffer-live-p ctl-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1126 ;; check if this is ediff-control-buffer or ediff-meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1127 (if (ediff-eval-in-buffer ctl-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1128 (eq (key-binding "q") 'ediff-quit-meta-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1129 ;; it's a meta-buffer -- last action should just display it
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1130 (ediff-show-meta-buffer ctl-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1131 ;; it's a session buffer -- invoke go back to session
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1132 (ediff-eval-in-buffer ctl-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1133 (setq ediff-mouse-pixel-position (mouse-pixel-position))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1134 (ediff-recenter 'no-rehighlight)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1135 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1136 (message "You've selected a stale session --- try again")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1137 (ediff-update-registry))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1138 (ediff-eval-in-buffer buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1139 (goto-char pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1140 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1141
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-show-meta-buffer (&optional meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1144 "Show the session group buffer."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1145 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1146 (let (wind frame silent)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1147 (if meta-buf (setq silent t))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1148
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1149 (setq meta-buf (or meta-buf ediff-meta-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1150 (cond ((not (bufferp meta-buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1151 (error "This Ediff session is not part of a session group"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1152 ((not (ediff-buffer-live-p meta-buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1153 (error
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1154 "Can't find this session's group panel -- session itself is ok")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1155
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1156 (ediff-cleanup-meta-buffer meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1157 (ediff-eval-in-buffer meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1158 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1159 (cond ((setq wind (ediff-get-visible-buffer-window meta-buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1160 (or silent
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1161 (message
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1162 "Already showing the group panel for this session"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1163 (set-window-buffer wind meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1164 (select-window wind))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1165 ((window-live-p (setq wind ediff-window-C)) ;in merge--merge buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1166 (set-window-buffer ediff-window-C meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1167 (select-window wind))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1168 ((window-live-p (setq wind ediff-window-A))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1169 (set-window-buffer ediff-window-A meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1170 (select-window wind))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1171 ((window-live-p (setq wind ediff-window-B))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1172 (set-window-buffer ediff-window-B meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1173 (select-window wind))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1174 ((and
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1175 (setq wind
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1176 (ediff-get-visible-buffer-window ediff-registry-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1177 (ediff-window-display-p))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1178 (select-window wind)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1179 (other-window 1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1180 (set-window-buffer (selected-window) meta-buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1181 (t (ediff-skip-unsuitable-frames 'ok-unsplittable)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1182 (set-window-buffer (selected-window) meta-buf)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1183 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1184 (if (ediff-window-display-p)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1185 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1186 (setq frame
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1187 (window-frame (ediff-get-visible-buffer-window meta-buf)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1188 (raise-frame frame)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1189 (ediff-reset-mouse frame)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1190 (run-hooks 'ediff-show-session-group-hook)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1191 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1192
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1193 (defun ediff-show-meta-buff-from-registry ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1194 "Display the session group buffer for a selected session group."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1195 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1196 (let* ((pos (ediff-event-point last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1197 (meta-buf (ediff-event-buffer last-command-event))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1198 (info (ediff-get-meta-info meta-buf pos))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1199 (meta-or-session-buf info))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1200 (ediff-eval-in-buffer meta-or-session-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1201 (ediff-show-meta-buffer))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1202
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1203 ;;;###autoload
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1204 (defun ediff-show-registry ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1205 "Display Ediff's registry."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1206 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1207 (ediff-update-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1208 (if (not (ediff-buffer-live-p ediff-registry-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1209 (error "No active Ediff sessions or corrupted session registry"))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1210 (let (wind frame)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1211 ;; for some reason, point moves in ediff-registry-buffer, so we preserve it
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1212 ;; explicity
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1213 (ediff-eval-in-buffer ediff-registry-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1214 (save-excursion
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1215 (cond ((setq wind
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1216 (ediff-get-visible-buffer-window ediff-registry-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1217 (message "Already showing the registry")
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1218 (set-window-buffer wind ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1219 (select-window wind))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1220 ((window-live-p ediff-window-C)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1221 (set-window-buffer ediff-window-C ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1222 (select-window ediff-window-C))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1223 ((window-live-p ediff-window-A)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1224 (set-window-buffer ediff-window-A ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1225 (select-window ediff-window-A))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1226 ((window-live-p ediff-window-B)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1227 (set-window-buffer ediff-window-B ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1228 (select-window ediff-window-B))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1229 ((and (setq wind
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1230 (ediff-get-visible-buffer-window ediff-meta-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1231 (ediff-window-display-p))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1232 (select-window wind)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1233 (other-window 1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1234 (set-window-buffer (selected-window) ediff-registry-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1235 (t (ediff-skip-unsuitable-frames 'ok-unsplittable)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1236 (set-window-buffer (selected-window) ediff-registry-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1237 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1238 (if (ediff-window-display-p)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1239 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1240 (setq frame
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1241 (window-frame
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1242 (ediff-get-visible-buffer-window ediff-registry-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1243 (raise-frame frame)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1244 (ediff-reset-mouse frame)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1245 (run-hooks 'ediff-show-registry-hook)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1246 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1247
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1248 ;;;###autoload
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1249 (defalias 'eregistry 'ediff-show-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1250
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1251 ;; 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
1252 ;; parent meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1253 ;; Check if META-BUF exists before calling this function
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1254 (defun ediff-update-meta-buffer (meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1255 (ediff-eval-in-buffer (current-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1256 (if (ediff-buffer-live-p meta-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1257 (ediff-eval-in-buffer meta-buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1258 (funcall ediff-meta-redraw-function ediff-meta-list))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1259 )))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1260
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1261 (defun ediff-update-registry ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1262 (ediff-eval-in-buffer (current-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1263 (if (ediff-buffer-live-p ediff-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1264 (ediff-redraw-registry-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1265 (ediff-prepare-meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1266 'ediff-registry-action
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1267 ediff-session-registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1268 "*Ediff Registry"
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1269 'ediff-redraw-registry-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1270 'ediff-registry))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1271 ))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1272
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1273 ;; if meta-buf exists, it is redrawn along with parent. Otherwise, nothing
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1274 ;; happens
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1275 (defun ediff-cleanup-meta-buffer (meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1276 (if (ediff-buffer-live-p meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1277 (ediff-eval-in-buffer meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1278 (ediff-update-meta-buffer meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1279 (if (ediff-buffer-live-p ediff-parent-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1280 (ediff-update-meta-buffer ediff-parent-meta-buffer)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1281
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1282 ;; t if no session in progress
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1283 (defun ediff-safe-to-quit (meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1284 (if (ediff-buffer-live-p meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1285 (let ((lis ediff-meta-list)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1286 (cont t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1287 buffer-read-only)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1288 (ediff-update-meta-buffer meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1289 (ediff-eval-in-buffer meta-buffer
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1290 (setq lis (cdr lis)) ; discard the description part of meta-list
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1291 (while (and cont lis)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1292 (if (ediff-buffer-live-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1293 (ediff-get-group-buffer lis)) ; in progress
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1294 (setq cont nil))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1295 (setq lis (cdr lis)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1296 cont))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1297
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1298 (defun ediff-quit-meta-buffer ()
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1299 "If no unprocessed sessions in the group, delete the meta buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1300 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
1301 Otherwise, bury the meta buffer.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1302 If this is a session registry buffer then just bury it."
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1303 (interactive)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1304 (let* ((buf (current-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1305 (dir-diffs-buffer ediff-dir-diffs-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1306 (meta-diff-buffer ediff-meta-diff-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1307 (parent-buf ediff-parent-meta-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1308 (dont-show-registry (eq buf ediff-registry-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1309 (if dont-show-registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1310 (bury-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1311 (ediff-cleanup-meta-buffer buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1312 (cond ((and (ediff-safe-to-quit buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1313 (y-or-n-p "Quit this session group? "))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1314 (ediff-dispose-of-meta-buffer buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1315 ((ediff-safe-to-quit buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1316 (bury-buffer))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1317 (t
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1318 (bury-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1319 (beep)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1320 (message
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1321 "Group has active sessions, panel not deleted")))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1322 (ediff-cleanup-meta-buffer parent-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1323 (ediff-kill-buffer-carefully dir-diffs-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1324 (ediff-kill-buffer-carefully meta-diff-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1325 (if (ediff-buffer-live-p parent-buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1326 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1327 (setq dont-show-registry t)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1328 (ediff-show-meta-buffer parent-buf)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1329 )
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1330 (or dont-show-registry
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1331 (ediff-show-registry))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1332
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1333 (defun ediff-dispose-of-meta-buffer (buf)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1334 (setq ediff-session-registry (delq buf ediff-session-registry))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1335 (ediff-eval-in-buffer buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1336 (if (ediff-buffer-live-p ediff-dir-diffs-buffer)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1337 (kill-buffer ediff-dir-diffs-buffer)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1338 (kill-buffer buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1339
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1340
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1341 ;; obtain information on a meta record where the user clicked or typed
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1342 ;; BUF is the buffer where this happened and POINT is the position
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1343 ;; 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
1344 ;; meta info is found on line.
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1345 (defun ediff-get-meta-info (buf point &optional noerror)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1346 (let (result olist tmp)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1347 (if (and point (ediff-buffer-live-p buf))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1348 (ediff-eval-in-buffer buf
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1349 (if ediff-xemacs-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1350 (setq result
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1351 (if (setq tmp (extent-at point buf 'ediff-meta-info))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1352 (ediff-overlay-get tmp 'ediff-meta-info)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1353 (setq olist (overlays-at point))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1354 (setq olist
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1355 (mapcar (function (lambda (elt)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1356 (overlay-get elt 'ediff-meta-info)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1357 olist))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1358 (while (and olist (null (car olist))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1359 (overlay-get (car olist) 'invisible))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1360 (setq olist (cdr olist)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1361 (setq result (car olist)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1362 (if result
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1363 result
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1364 (if noerror
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1365 nil
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1366 (ediff-update-registry)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1367 (error "No session info in this line")))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1368
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1369 ;; return location of the next meta overlay after point
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1370 (defun ediff-next-meta-overlay-start (point)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1371 (let (overl)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1372 (if ediff-xemacs-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1373 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1374 (setq overl (extent-at point (current-buffer) 'ediff-meta-info))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1375 (if overl
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1376 (setq overl (next-extent overl))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1377 (setq overl (next-extent (current-buffer))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1378 (if overl
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1379 (extent-start-position overl)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1380 (point-max)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1381 (if (= point (point-max)) (setq point (point-min)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1382 (setq overl (car (overlays-at point)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1383 (if (and overl (overlay-get overl 'ediff-meta-info))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1384 (overlay-end overl)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1385 (next-overlay-change point)))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1386
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1387 (defun ediff-previous-meta-overlay-start (point)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1388 (let (overl)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1389 (if ediff-xemacs-p
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1390 (progn
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1391 (setq overl (extent-at point (current-buffer) 'ediff-meta-info))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1392 (if overl
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1393 (setq overl (previous-extent overl))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1394 (setq overl (previous-extent (current-buffer))))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1395 (if overl
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1396 (extent-start-position overl)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1397 (point-max)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1398 ;;(if (bobp) (setq point (point-max)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1399 (setq overl (car (overlays-at point)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1400 (setq point (if (and overl (overlay-get overl 'ediff-meta-info))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1401 (previous-overlay-change (overlay-start overl))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1402 (previous-overlay-change point)))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1403 (if (= point (point-min)) (point-max) point)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1404 )))
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1405
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1406
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1407 ;;; Local Variables:
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1408 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1409 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1410 ;;; End:
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 (provide 'ediff-meta)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1413 (require 'ediff-util)
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1414
c43bacb1bd0a Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1415 ;;; ediff-meta.el ends here