aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2007-07-24 01:23:55 +0000
committerMiles Bader2007-07-24 01:23:55 +0000
commitd918f936d5bfc7e126cc3b1bbf6ce80836c8d6f1 (patch)
treec2dad763df03a5380928485043f9999c7a3533a6
parenta1ef75fc233b19951f65bd2a177751751f9676a3 (diff)
parent1e8995158740b15936887264a3d7183beb5c51d9 (diff)
downloademacs-d918f936d5bfc7e126cc3b1bbf6ce80836c8d6f1.tar.gz
emacs-d918f936d5bfc7e126cc3b1bbf6ce80836c8d6f1.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 816-823) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 59-69) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 237-238) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-235
-rw-r--r--etc/NEWS12
-rw-r--r--leim/ChangeLog2
-rw-r--r--lisp/ChangeLog394
-rw-r--r--lisp/add-log.el305
-rw-r--r--lisp/bindings.el17
-rw-r--r--lisp/calc/calc-math.el66
-rw-r--r--lisp/diff-mode.el116
-rw-r--r--lisp/emacs-lisp/copyright.el2
-rw-r--r--lisp/files.el23
-rw-r--r--lisp/follow.el34
-rw-r--r--lisp/gnus/ChangeLog9
-rw-r--r--lisp/gnus/gnus-srvr.el10
-rw-r--r--lisp/gnus/mm-uu.el5
-rw-r--r--lisp/image-dired.el23
-rw-r--r--lisp/isearch.el37
-rw-r--r--lisp/kmacro.el10
-rw-r--r--lisp/makefile.w32-in5
-rw-r--r--lisp/net/tramp.el16
-rw-r--r--lisp/net/trampver.el4
-rw-r--r--lisp/pcvs.el4
-rw-r--r--lisp/progmodes/compile.el15
-rw-r--r--lisp/progmodes/flymake.el25
-rw-r--r--lisp/progmodes/grep.el75
-rw-r--r--lisp/progmodes/octave-inf.el2
-rw-r--r--lisp/progmodes/vera-mode.el82
-rw-r--r--lisp/ps-print.el6
-rw-r--r--lisp/replace.el62
-rw-r--r--lisp/ses.el11
-rw-r--r--lisp/simple.el215
-rw-r--r--lisp/startup.el2
-rw-r--r--lisp/tar-mode.el2
-rw-r--r--lisp/term/x-win.el3
-rw-r--r--lisp/textmodes/reftex.el8
-rw-r--r--lisp/textmodes/tex-mode.el6
-rw-r--r--lisp/tutorial.el8
-rw-r--r--lisp/uniquify.el20
-rw-r--r--lisp/vc-arch.el82
-rw-r--r--lisp/vc-bzr.el28
-rw-r--r--lisp/vc-cvs.el121
-rw-r--r--lisp/vc-git.el439
-rw-r--r--lisp/vc-hg.el201
-rw-r--r--lisp/vc-hooks.el167
-rw-r--r--lisp/vc-mcvs.el83
-rw-r--r--lisp/vc-rcs.el222
-rw-r--r--lisp/vc-sccs.el83
-rw-r--r--lisp/vc-svn.el75
-rw-r--r--lisp/vc.el261
-rw-r--r--lispref/ChangeLog4
-rw-r--r--lispref/display.texi4
-rw-r--r--man/ChangeLog32
-rw-r--r--man/files.texi118
-rw-r--r--man/screen.texi5
-rw-r--r--man/tramp.texi167
-rw-r--r--man/trampver.texi4
-rw-r--r--man/vc2-xtra.texi8
-rw-r--r--src/ChangeLog39
-rw-r--r--src/buffer.c2
-rw-r--r--src/coding.c2
-rw-r--r--src/data.c6
-rw-r--r--src/eval.c6
-rw-r--r--src/w32proc.c82
-rw-r--r--src/window.c2
-rw-r--r--src/xdisp.c10
-rw-r--r--src/xfns.c1
-rw-r--r--src/xterm.c50
-rw-r--r--src/xterm.h1
66 files changed, 2872 insertions, 1069 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 84abb56e56a..ce5a34756f6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -46,6 +46,8 @@ highlighting, and help echoing in the minibuffer.
46recenter the visited source file. Its value can be a number (for example, 46recenter the visited source file. Its value can be a number (for example,
470 for top line, -1 for bottom line), or nil for no recentering. 470 for top line, -1 for bottom line), or nil for no recentering.
48 48
49** The mode-line display a `@' if the default-directory for the current buffer
50is on a remote machine, or a hyphen otherwise.
49 51
50* Startup Changes in Emacs 23.1 52* Startup Changes in Emacs 23.1
51 53
@@ -57,6 +59,16 @@ recenter the visited source file. Its value can be a number (for example,
57 59
58** New command kill-matching-buffers kills buffers whose name matches a regexp. 60** New command kill-matching-buffers kills buffers whose name matches a regexp.
59 61
62** Minibuffer changes:
63
64*** isearch started in the minibuffer searches in the minibuffer history.
65Reverse isearch commands (C-r, C-M-r) search in previous minibuffer
66history elements, and forward isearch commands (C-s, C-M-s) search in
67next history elements. When the reverse search reaches the first history
68element, it wraps to the last history element, and the forward search
69wraps to the first history element. When the search is terminated, the
70history element containing the search string becomes the current.
71
60 72
61* New Modes and Packages in Emacs 23.1 73* New Modes and Packages in Emacs 23.1
62 74
diff --git a/leim/ChangeLog b/leim/ChangeLog
index 330321725f2..083ab946fcb 100644
--- a/leim/ChangeLog
+++ b/leim/ChangeLog
@@ -13,7 +13,7 @@
13 13
14 * MISC-DIC/pinyin.map, MISC-DIC/ziranma.cin: Add copyright and 14 * MISC-DIC/pinyin.map, MISC-DIC/ziranma.cin: Add copyright and
15 license notices. 15 license notices.
16 16
172007-01-24 Kenichi Handa <handa@m17n.org> 172007-01-24 Kenichi Handa <handa@m17n.org>
18 18
19 * MISC-DIC/README: New file. 19 * MISC-DIC/README: New file.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index be77e72e924..0a8e7421056 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,378 @@
12007-07-23 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * ses.el (ses-cleanup): Prevent Emacs from spuriously checking if the
4 underlying file is uptodate.
5
62007-07-23 Christopher J. Madsen <cjm@cjmweb.net>
7
8 * replace.el (perform-replace): Use isearch-no-upper-case-p.
9
102007-07-23 Stefan Monnier <monnier@iro.umontreal.ca>
11
12 * vc-hooks.el (vc-mode-line-map): New const.
13 (vc-mode-line): Use it.
14
152007-07-23 Alexandre Julliard <julliard@winehq.org>
16
17 * vc-git.el (vc-git-delete-file, vc-git-rename-file)
18 (vc-git-unregister): New functions.
19 (vc-git-find-version): Use the result of ls-files as a parameter
20 for cat-file
21
222007-07-23 Michael Albinus <michael.albinus@gmx.de>
23
24 * net/tramp.el (tramp-perl-file-attributes)
25 (tramp-perl-directory-files-and-attributes)
26 (tramp-handle-file-attributes-with-stat)
27 (tramp-handle-directory-files-and-attributes-with-stat)
28 (tramp-convert-file-attributes): Handle huge file sizes.
29
302007-07-23 Juri Linkov <juri@jurta.org>
31
32 * isearch.el (isearch-message-function): New variable.
33 (isearch-update, isearch-search): Use it.
34
35 * simple.el (goto-history-element): New function created from
36 next-history-element.
37 (next-history-element): Most code moved to goto-history-element.
38 Call goto-history-element with (- minibuffer-history-position n).
39 (previous-history-element): Call goto-history-element with (+
40 minibuffer-history-position n).
41 (minibuffer-setup-hook): Add minibuffer-history-isearch-setup.
42 (minibuffer-history-isearch-message-overlay): New buffer-local variable.
43 (minibuffer-history-isearch-setup, minibuffer-history-isearch-end)
44 (minibuffer-history-isearch-search, minibuffer-history-isearch-message)
45 (minibuffer-history-isearch-wrap, minibuffer-history-isearch-push-state)
46 (minibuffer-history-isearch-pop-state): New functions.
47
482007-07-23 Thien-Thi Nguyen <ttn@gnuvola.org>
49
50 * vc-hooks.el (vc-stay-local-p): Fix bug: Avoid remove-if-not.
51 Also, if FILE is a list, return non-nil if any of its elements
52 should stay local. Update docstring.
53
542007-07-23 Stefan Monnier <monnier@iro.umontreal.ca>
55
56 * emacs-lisp/copyright.el (copyright-update-year): Fix 2007-05-25
57 change by reverting a small part.
58
592007-07-23 Richard Stallman <rms@gnu.org>
60
61 * progmodes/octave-inf.el (inferior-octave-prompt): Accept .exe.
62
632007-07-23 Dan Nicolaescu <dann@ics.uci.edu>
64
65 * vc-git.el (vc-git-checkin): Delete unused parameter and the code
66 handling it. Use vc-git-command.
67 (vc-git-find-version, vc-git-diff-tree): New functions.
68 (vc-git-revert): Use vc-git-command.
69 (vc-git--run-command): Delete.
70
712007-07-23 Alexandre Julliard <julliard@winehq.org>
72
73 * vc-git.el (vc-git-workfile-unchanged-p): Update comment.
74
752007-07-20 Kenichi Handa <handa@m17n.org>
76
77 * international/utf-8.el (utf-8-post-read-conversion):
78 Temporarily bind utf-8-compose-scripts to nil while running
79 *-compose-region functions.
80
812007-07-23 Dan Nicolaescu <dann@ics.uci.edu>
82
83 * vc-git.el: Update status.
84 (vc-directory-exclusion-list): Use eval-after-load.
85
862007-07-22 Nick Roberts <nickrob@snap.net.nz>
87
88 * bindings.el (mode-line-remote): New variable.
89 (help-echo): Add to default values of mode-line-format.
90
91 * files.el: Mark mode-line-remote as risky.
92
932007-07-22 Juri Linkov <juri@jurta.org>
94
95 * isearch.el (isearch-edit-string): Save old point and
96 isearch-other-end to old-point and old-other-end before reading
97 the search string from minibuffer. After exiting minibuffer set
98 point to old-other-end if point and the search direction is the
99 same as before reading the search string.
100 (isearch-del-char): Don't set isearch-yank-flag to t. Put point
101 to isearch-other-end. Instead of isearch-search-and-update call
102 three functions isearch-search, isearch-push-state and isearch-update.
103
1042007-07-22 Dan Nicolaescu <dann@ics.uci.edu>
105
106 * vc-git.el (vc-git-register, vc-git-checkin): Use vc-git-command,
107 deal with multiple file arguments.
108 (vc-git-print-log): Deal with multiple file arguments.
109
1102007-07-22 Stefan Monnier <monnier@iro.umontreal.ca>
111
112 * diff-mode.el (diff-refine-ignore-spaces-hunk): Rename from
113 diff-refine-hunk. Adjust users.
114 (diff-unified-hunk-p, diff-splittable-p): New functions.
115 (diff-mode-menu): Use it to disable Split when it doesn't work.
116
1172007-07-22 Dan Nicolaescu <dann@ics.uci.edu>
118
119 * diff-mode.el (diff-mode-menu): New entries.
120
1212007-07-22 Stefan Monnier <monnier@iro.umontreal.ca>
122
123 * diff-mode.el (diff-unified->context): Use the new `apply' undo entry
124 if applicable, so as to save undo-log space.
125
126 * diff-mode.el (diff-find-file-name): Add arg `batch'.
127
128 * diff-mode.el (diff-beginning-of-file-and-junk): New function.
129 (diff-file-kill): Use it.
130 (diff-beginning-of-hunk): Add arg `try-harder' using it.
131 (diff-restrict-view, diff-find-source-location, diff-refine-hunk):
132 Use it so they find the hunk even when we're in the file header.
133
1342007-07-22 Dan Nicolaescu <dann@ics.uci.edu>
135
136 * vc-git.el (vc-git-revision-granularity, vc-git-root)
137 (vc-git-command, vc-git-dir-state, vc-git-dired-state-info)
138 (vc-git-create-repo): New functions.
139 (vc-git-registered): New autoloaded function definition.
140 (vc-git-registered): Use vc-git-root.
141 (vc-git-responsible-p): New defalias.
142 (vc-git-annotate-extract-revision-at-line): Uncomment.
143 (vc-git-print-log): Add the file name to the log.
144 (vc-git-log-view-mode): New derived mode.
145 (vc-git-diff, vc-git-annotate-command): Use vc-git-command.
146
1472007-07-22 Michael Albinus <michael.albinus@gmx.de>
148
149 * progmodes/grep.el (grep-compute-defaults): Keep default values.
150
1512007-07-22 Ralf Angeli <angeli@caeruleus.net>
152
153 * textmodes/reftex.el (reftex-access-parse-file): Create parse
154 file in a way that does not interfere with recentf mode.
155 (reftex-access-parse-file): Do not risk destroying an existing
156 buffer.
157
1582007-07-22 Alexandre Julliard <julliard@winehq.org>
159
160 * vc-git.el: New file.
161
1622007-07-22 Stefan Monnier <monnier@iro.umontreal.ca>
163
164 * textmodes/tex-mode.el (tex-font-script-display): Change default.
165
1662007-07-22 Dan Nicolaescu <dann@ics.uci.edu>
167
168 * vc-cvs.el (vc-cvs-mode-line-string): Add support for tooltips
169 for branches and new files.
170
171 * vc-hooks.el (vc-default-mode-line-string): Move mouse-face and
172 local-map handling ...
173 (vc-mode-line): ... here. Improve handling of help-echo.
174
175 * vc.el (mode-line-string): Document help-echo usage.
176
1772007-07-22 Michael Albinus <michael.albinus@gmx.de>
178
179 Sync with Tramp 2.1.10.
180
181 * tramp.el (tramp-get-ls-command): Fyx typo.
182
183 * trampver.el: Update release number.
184
1852007-07-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
186
187 * startup.el (command-line-x-option-alist): Use x-handle-no-bitmap-icon.
188
189 * term/x-win.el (x-handle-no-bitmap-icon): New function.
190
1912007-07-22 Martin Rudalics <rudalics@gmx.at>
192
193 * add-log.el (change-log-fill-parenthesized-list): New function.
194 (change-log-indent): Call change-log-fill-parenthesized-list.
195 (change-log-fill-paragraph): Bind fill-indent-according-to-mode to
196 t. Have lines with leading asterisk start a paragraph.
197
1982007-07-21 Jay Belanger <jay.p.belanger@gmail.com>
199
200 * calc/calc-math.el (math-emacs-precision)
201 (math-largest-emacs-expt, math-smallest-emacs-expt):
202 New variables.
203 (math-use-emacs-fn): New function.
204 (math-exp-raw): Evaluate with `math-use-emacs-fn', when
205 appropriate.
206
2072007-07-21 Thien-Thi Nguyen <ttn@gnuvola.org>
208
209 * image-dired.el (image-dired-sane-db-file): New func.
210 (image-dired-write-tags, image-dired-remove-tag)
211 (image-dired-list-tags, image-dired-write-comments)
212 (image-dired-get-comment, image-dired-mark-tagged-files)
213 (image-dired-create-gallery-lists): Call new func.
214 Reported by Dieter Wilhelm <dieter@duenenhof-wilhelm.de>.
215
2162007-07-21 Dan Nicolaescu <dann@ics.uci.edu>
217
218 * vc-hg.el (vc-hg-dir-state): Fix loop.
219 (vc-hg-print-log): Fix expected return value for vc-hg-command.
220 (vc-hg-next-version, vc-hg-delete-file, vc-hg-rename-file)
221 (vc-hg-register, vc-hg-create-repo, vc-hg-checkin)
222 (vc-hg-revert): Likewise.
223 (vc-hg-revision-table, vc-hg-revision-completion-table): New
224 functions.
225
2262007-07-20 Stefan Monnier <monnier@iro.umontreal.ca>
227
228 * add-log.el (change-log-resolve-conflict): Don't lose data if the
229 merge fails.
230
2312007-07-20 Dan Nicolaescu <dann@ics.uci.edu>
232
233 * progmodes/compile.el (compilation-auto-jump-to-first-error):
234 Add group and version.
235
2362007-07-20 Stefan Monnier <monnier@iro.umontreal.ca>
237
238 * add-log.el (add-log-file-name): Use file-relative-name.
239 (add-change-log-entry): Delay reading
240 add-log-(full-name|mailing-address) to after we've switched to the
241 ChangeLog buffer so we get the right value.
242 (add-change-log-entry, add-log-current-defun, change-log-merge):
243 Use derived-mode-p rather than checking major-mode directly.
244
245 * pcvs.el (cvs-mode-add-change-log-entry-other-window): Use a directory
246 name for buffer-file-name if it refers to a directory.
247
248 * vc-arch.el (vc-arch-diff): Fix last change.
249
250 * progmodes/compile.el (compilation-start): Remember the original
251 directory in a buffer-local compilation-directory.
252 (compile): Set the global value of compilation-directory.
253 (recompile): Use compilation-directory even in the compilation buffer.
254
2552007-07-20 Dan Nicolaescu <dann@ics.uci.edu>
256
257 * vc-hg.el (vc-hg-diff): Use vc-hg-command.
258
2592007-07-20 Vinicius Jose Latorre <viniciusjl@ig.com.br>
260
261 * ps-print.el: Problem with foreground and background color when
262 printing a buffer with and without faces. Reported by Christian
263 Schlauer <cs-muelleimer-rubbish.bin@arcor.de>.
264 (ps-print-version): New version 6.7.5.
265 (ps-default-fg): Change default value to nil, so black color is used
266 when a face does not specify a foreground color.
267 (ps-default-bg): Change default value to nil, so white color is used
268 for background color.
269 (ps-begin-job): Fix code.
270
2712007-07-20 Eli Zaretskii <eliz@gnu.org>
272
273 * makefile.w32-in (install-lisp-SH): Don't create subdirectories
274 in $(INSTALL_DIR)/lisp/ if they already exist.
275
2762007-07-20 Dhruva Krishnamurthy <dhruvakm@gmail.com> (tiny change)
277
278 * makefile.w32-in (install-lisp-CMD): Don't create subdirectories
279 in $(INSTALL_DIR)/lisp/ if they already exist.
280
2812007-07-20 Stefan Monnier <monnier@iro.umontreal.ca>
282
283 * progmodes/vera-mode.el (vera-re-search-forward)
284 (vera-re-search-backward): Remove use of store-match-data.
285 (vera-mode-map): Move initialization into declaration.
286
287 * progmodes/flymake.el (flymake-buildfile-dirs): Remove.
288 (flymake-find-buildfile): Use locate-dominating-file.
289
290 * vc.el (vc-delistify): Use mapconcat.
291 (vc-do-command): Minor simplification.
292 (vc-expand-dirs): Use push.
293
294 * vc-mcvs.el (vc-mcvs-create-repo):
295 * vc-cvs.el (vc-cvs-create-repo): Remove.
296
297 * vc-hooks.el (vc-find-root): Fix case where `file' is the current
298 directory and the root as well.
299
3002007-07-20 Dan Nicolaescu <dann@ics.uci.edu>
301
302 * vc-hooks.el (vc-default-workfile-unchanged-p): Pass a list
303 instead of a file.
304
305 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
306 (vc-hg-registered): Replace if with when.
307 (vc-hg-state): Deal with nonexistent files and handle removed files.
308 (vc-hg-dir-state, vc-hg-dired-state-info): New functions.
309 (vc-hg-checkout): Re-enable.
310 (vc-hg-create-repo): Fix typos.
311 (vc-hg-print-log): Fix for multiple files.
312 (vc-hg-workfile-unchanged-p): New function.
313
314 * vc.el: Fix typo.
315 (vc-print-log): Fix call to print-log.
316 (vc-default-comment-history): Likewise.
317 (vc-directory-exclusion-list): Add .hg and .bzr.
318 (vc-diff-internal): Pass a list instead of a file.
319
320 * vc-mcvs.el (vc-mcvs-create-repo): Fix typos.
321
322 * vc-bzr.el (vc-bzr-create-repo): New function.
323
3242007-07-19 Stefan Monnier <monnier@iro.umontreal.ca>
325
326 * vc-hooks.el (vc-find-root): Walk up the tree to find an existing
327 `file' from which to start the search.
328
3292007-07-19 Eric S. Raymond <esr@snark.thyrsus.com>
330
331 * vc-cvs.el: vc-cvs-checkin had some reference problems, now fixed.
332
3332007-07-19 Stefan Monnier <monnier@iro.umontreal.ca>
334
335 * files.el (locate-dominating-file): New function.
336
3372007-07-18 Michael Albinus <michael.albinus@gmx.de>
338
339 * progmodes/grep.el (grep-host-defaults-alist): New defvar.
340 (grep-compute-defaults): Use it.
341
3422007-07-18 Stefan Monnier <monnier@iro.umontreal.ca>
343
344 * uniquify.el: Docstring fixes.
345
3462007-07-18 Eric S. Raymond <esr@snark.thyrsus.com>
347
348 * vc-hooks.el: Generalize stay-local-p to operate on lists of
349 files. Change two keybindings to point to new function names.
350 * vc-arch.el, vc-bzr.el, vc-cvs.el, vc-hg.el, vc-mcvs.el, vc-rcs.el,
351 vc-sccs.el, vc-svn.el: These now implement the NewVC-fileset.
352 * vc.el: Adapted for NewVC-fileset, but no functional changes yet.
353
3542007-07-18 Juanma Barranquero <lekktu@gmail.com>
355
356 * follow.el (follow-mode-hook, follow-mode-off-hook, follow-mode)
357 (follow-delete-other-windows-and-split, follow-recenter)
358 (follow-windows-aligned-p, follow-point-visible-all-windows-p)
359 (follow-redisplay, follow-estimate-first-window-start)
360 (follow-xemacs-scrollbar-support, follow-intercept-process-output):
361 Fix typos in docstrings.
362
3632007-07-18 Martin Rudalics <rudalics@gmx.at>
364
365 * add-log.el (change-log-mode): Use fill-nobreak-predicate to
366 avoid that filling introduces lines with a single asterisk.
367
368 * kmacro.el (kmacro-end-macro): When ignoring empty macro
369 avoid incorrect kmacro-ring-empty-p messages.
370 Reported by Michael Schierl <schierlm@gmx.de>.
371
3722007-07-17 Dan Nicolaescu <dann@ics.uci.edu>
373
374 * vc.el: Add more info about the vc-registered function.
375
12007-07-17 Michael Albinus <michael.albinus@gmx.de> 3762007-07-17 Michael Albinus <michael.albinus@gmx.de>
2 377
3 * files.el (file-remote-p): Introduce optional parameter 378 * files.el (file-remote-p): Introduce optional parameter
@@ -9,7 +384,7 @@
9 * progmodes/grep.el (grep-probe): Use `process-file'. 384 * progmodes/grep.el (grep-probe): Use `process-file'.
10 (grep-compute-defaults): Handle variables host specific. 385 (grep-compute-defaults): Handle variables host specific.
11 386
12 * net/ange-ftp.el: (ange-ftp-file-remote-p): Handle optional 387 * net/ange-ftp.el (ange-ftp-file-remote-p): Handle optional
13 parameter IDENTIFICATION. 388 parameter IDENTIFICATION.
14 389
15 * net/tramp.el (tramp-handle-file-remote-p): Handle optional 390 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
@@ -23,8 +398,8 @@
23 (tramp-convert-file-attributes): Add error handling when inode is 398 (tramp-convert-file-attributes): Add error handling when inode is
24 extraordinary big. 399 extraordinary big.
25 (tramp-get-inode): Change parameter from FILE to VEC. 400 (tramp-get-inode): Change parameter from FILE to VEC.
26 (tramp-handle-start-file-process ): Use (current-buffer) if BUFFER 401 (tramp-handle-start-file-process): Use (current-buffer) if BUFFER
27 is NIL. This is according to the specification. Goto (point-max) 402 is nil. This is according to the specification. Goto (point-max)
28 when ready. 403 when ready.
29 (tramp-handle-shell-command): Rewrite completely, using 404 (tramp-handle-shell-command): Rewrite completely, using
30 `process-file' and `start-file-process'. 405 `process-file' and `start-file-process'.
@@ -103,6 +478,17 @@
103 * bookmark.el (bookmark-show-all-annotations): 478 * bookmark.el (bookmark-show-all-annotations):
104 Make sure each inserted annotation ends with newline. 479 Make sure each inserted annotation ends with newline.
105 480
4812007-07-15 Richard Stallman <rms@gnu.org>
482
483 * kmacro.el (kmacro-bind-to-key): Avoid comparisons on function keys.
484
485 * tutorial.el (tutorial--find-changed-keys):
486 Handle C-x specially like ESC.
487
4882007-07-15 Aaron Hawley <aaronh@garden.org>
489
490 * tar-mode.el (tar-get-descriptor): No error for zero-length file.
491
1062007-07-15 Juri Linkov <juri@jurta.org> 4922007-07-15 Juri Linkov <juri@jurta.org>
107 493
108 * delsel.el (delete-selection-pre-hook): 494 * delsel.el (delete-selection-pre-hook):
@@ -345,7 +731,7 @@
345 (org-columns-compile-format) 731 (org-columns-compile-format)
346 (org-fill-paragraph-experimental) 732 (org-fill-paragraph-experimental)
347 (org-string-to-number, org-property-action) 733 (org-string-to-number, org-property-action)
348 (org-columns-move-left, org-columns-new ) 734 (org-columns-move-left, org-columns-new)
349 (org-column-number-to-string) 735 (org-column-number-to-string)
350 (org-property-previous-allowed-value) 736 (org-property-previous-allowed-value)
351 (org-at-property-p, org-columns-delete) 737 (org-at-property-p, org-columns-delete)
diff --git a/lisp/add-log.el b/lisp/add-log.el
index 3ec00b81b35..458dfcff523 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -55,7 +55,7 @@
55;; Many modes set this variable, so avoid warnings. 55;; Many modes set this variable, so avoid warnings.
56;;;###autoload 56;;;###autoload
57(defcustom add-log-current-defun-function nil 57(defcustom add-log-current-defun-function nil
58 "*If non-nil, function to guess name of surrounding function. 58 "If non-nil, function to guess name of surrounding function.
59It is used by `add-log-current-defun' in preference to built-in rules. 59It is used by `add-log-current-defun' in preference to built-in rules.
60Returns function's name as a string, or nil if outside a function." 60Returns function's name as a string, or nil if outside a function."
61 :type '(choice (const nil) function) 61 :type '(choice (const nil) function)
@@ -63,7 +63,7 @@ Returns function's name as a string, or nil if outside a function."
63 63
64;;;###autoload 64;;;###autoload
65(defcustom add-log-full-name nil 65(defcustom add-log-full-name nil
66 "*Full name of user, for inclusion in ChangeLog daily headers. 66 "Full name of user, for inclusion in ChangeLog daily headers.
67This defaults to the value returned by the function `user-full-name'." 67This defaults to the value returned by the function `user-full-name'."
68 :type '(choice (const :tag "Default" nil) 68 :type '(choice (const :tag "Default" nil)
69 string) 69 string)
@@ -148,7 +148,7 @@ use the file's name relative to the directory of the change log file."
148 148
149 149
150(defcustom change-log-version-info-enabled nil 150(defcustom change-log-version-info-enabled nil
151 "*If non-nil, enable recording version numbers with the changes." 151 "If non-nil, enable recording version numbers with the changes."
152 :version "21.1" 152 :version "21.1"
153 :type 'boolean 153 :type 'boolean
154 :group 'change-log) 154 :group 'change-log)
@@ -160,7 +160,7 @@ use the file's name relative to the directory of the change log file."
160 (concat "^(def[^ \t\n]+[ \t]+[^ \t\n][ \t]\"" re) 160 (concat "^(def[^ \t\n]+[ \t]+[^ \t\n][ \t]\"" re)
161 ;; Revision: pcl-cvs.el,v 1.72 1999/09/05 20:21:54 monnier Exp 161 ;; Revision: pcl-cvs.el,v 1.72 1999/09/05 20:21:54 monnier Exp
162 (concat "^;+ *Revision: +[^ \t\n]+[ \t]+" re))) 162 (concat "^;+ *Revision: +[^ \t\n]+[ \t]+" re)))
163 "*List of regexps to search for version number. 163 "List of regexps to search for version number.
164The version number must be in group 1. 164The version number must be in group 1.
165Note: The search is conducted only within 10%, at the beginning of the file." 165Note: The search is conducted only within 10%, at the beginning of the file."
166 :version "21.1" 166 :version "21.1"
@@ -460,11 +460,7 @@ Optional arg BUFFER-FILE overrides `buffer-file-name'."
460 (if add-log-file-name-function 460 (if add-log-file-name-function
461 (funcall add-log-file-name-function buffer-file) 461 (funcall add-log-file-name-function buffer-file)
462 (setq buffer-file 462 (setq buffer-file
463 (if (string-match 463 (file-relative-name buffer-file (file-name-directory log-file)))
464 (concat "^" (regexp-quote (file-name-directory log-file)))
465 buffer-file)
466 (substring buffer-file (match-end 0))
467 (file-name-nondirectory buffer-file)))
468 ;; If we have a backup file, it's presumably because we're 464 ;; If we have a backup file, it's presumably because we're
469 ;; comparing old and new versions (e.g. for deleted 465 ;; comparing old and new versions (e.g. for deleted
470 ;; functions) and we'll want to use the original name. 466 ;; functions) and we'll want to use the original name.
@@ -508,112 +504,111 @@ non-nil, otherwise in local time."
508 (buffer-file (if buf-file-name (expand-file-name buf-file-name))) 504 (buffer-file (if buf-file-name (expand-file-name buf-file-name)))
509 (file-name (expand-file-name (find-change-log file-name buffer-file))) 505 (file-name (expand-file-name (find-change-log file-name buffer-file)))
510 ;; Set ITEM to the file name to use in the new item. 506 ;; Set ITEM to the file name to use in the new item.
511 (item (add-log-file-name buffer-file file-name)) 507 (item (add-log-file-name buffer-file file-name)))
512 bound
513 (full-name (or add-log-full-name (user-full-name)))
514 (mailing-address (or add-log-mailing-address user-mail-address)))
515
516 (if whoami
517 (progn
518 (setq full-name (read-string "Full name: " full-name))
519 ;; Note that some sites have room and phone number fields in
520 ;; full name which look silly when inserted. Rather than do
521 ;; anything about that here, let user give prefix argument so that
522 ;; s/he can edit the full name field in prompter if s/he wants.
523 (setq mailing-address
524 (read-string "Mailing address: " mailing-address))))
525 508
526 (unless (equal file-name buffer-file-name) 509 (unless (equal file-name buffer-file-name)
527 (if (or other-window (window-dedicated-p (selected-window))) 510 (if (or other-window (window-dedicated-p (selected-window)))
528 (find-file-other-window file-name) 511 (find-file-other-window file-name)
529 (find-file file-name))) 512 (find-file file-name)))
530 (or (eq major-mode 'change-log-mode) 513 (or (derived-mode-p 'change-log-mode)
531 (change-log-mode)) 514 (change-log-mode))
532 (undo-boundary) 515 (undo-boundary)
533 (goto-char (point-min)) 516 (goto-char (point-min))
534 517
535 ;; If file starts with a copyright and permission notice, skip them. 518 (let ((full-name (or add-log-full-name (user-full-name)))
536 ;; Assume they end at first blank line. 519 (mailing-address (or add-log-mailing-address user-mail-address)))
537 (when (looking-at "Copyright") 520
538 (search-forward "\n\n") 521 (when whoami
539 (skip-chars-forward "\n")) 522 (setq full-name (read-string "Full name: " full-name))
540 523 ;; Note that some sites have room and phone number fields in
541 ;; Advance into first entry if it is usable; else make new one. 524 ;; full name which look silly when inserted. Rather than do
542 (let ((new-entries 525 ;; anything about that here, let user give prefix argument so that
543 (mapcar (lambda (addr) 526 ;; s/he can edit the full name field in prompter if s/he wants.
544 (concat 527 (setq mailing-address
545 (if (stringp add-log-time-zone-rule) 528 (read-string "Mailing address: " mailing-address)))
546 (let ((tz (getenv "TZ"))) 529
547 (unwind-protect 530 ;; If file starts with a copyright and permission notice, skip them.
548 (progn 531 ;; Assume they end at first blank line.
549 (set-time-zone-rule add-log-time-zone-rule) 532 (when (looking-at "Copyright")
550 (funcall add-log-time-format)) 533 (search-forward "\n\n")
551 (set-time-zone-rule tz))) 534 (skip-chars-forward "\n"))
552 (funcall add-log-time-format)) 535
553 " " full-name 536 ;; Advance into first entry if it is usable; else make new one.
554 " <" addr ">")) 537 (let ((new-entries
555 (if (consp mailing-address) 538 (mapcar (lambda (addr)
556 mailing-address 539 (concat
557 (list mailing-address))))) 540 (if (stringp add-log-time-zone-rule)
558 (if (and (not add-log-always-start-new-record) 541 (let ((tz (getenv "TZ")))
559 (let ((hit nil)) 542 (unwind-protect
560 (dolist (entry new-entries hit) 543 (progn
561 (when (looking-at (regexp-quote entry)) 544 (set-time-zone-rule add-log-time-zone-rule)
562 (setq hit t))))) 545 (funcall add-log-time-format))
563 (forward-line 1) 546 (set-time-zone-rule tz)))
564 (insert (nth (random (length new-entries)) 547 (funcall add-log-time-format))
565 new-entries) 548 " " full-name
566 (if use-hard-newlines hard-newline "\n") 549 " <" addr ">"))
567 (if use-hard-newlines hard-newline "\n")) 550 (if (consp mailing-address)
568 (forward-line -1))) 551 mailing-address
552 (list mailing-address)))))
553 (if (and (not add-log-always-start-new-record)
554 (let ((hit nil))
555 (dolist (entry new-entries hit)
556 (when (looking-at (regexp-quote entry))
557 (setq hit t)))))
558 (forward-line 1)
559 (insert (nth (random (length new-entries))
560 new-entries)
561 (if use-hard-newlines hard-newline "\n")
562 (if use-hard-newlines hard-newline "\n"))
563 (forward-line -1))))
569 564
570 ;; Determine where we should stop searching for a usable 565 ;; Determine where we should stop searching for a usable
571 ;; item to add to, within this entry. 566 ;; item to add to, within this entry.
572 (setq bound 567 (let ((bound
573 (save-excursion 568 (save-excursion
574 (if (looking-at "\n*[^\n* \t]") 569 (if (looking-at "\n*[^\n* \t]")
575 (skip-chars-forward "\n") 570 (skip-chars-forward "\n")
576 (if add-log-keep-changes-together 571 (if add-log-keep-changes-together
577 (forward-page) ; page delimits entries for date 572 (forward-page) ; page delimits entries for date
578 (forward-paragraph))) ; paragraph delimits entries for file 573 (forward-paragraph))) ; paragraph delimits entries for file
579 (point))) 574 (point))))
580 575
581 ;; Now insert the new line for this item. 576 ;; Now insert the new line for this item.
582 (cond ((re-search-forward "^\\s *\\*\\s *$" bound t) 577 (cond ((re-search-forward "^\\s *\\*\\s *$" bound t)
583 ;; Put this file name into the existing empty item. 578 ;; Put this file name into the existing empty item.
584 (if item 579 (if item
585 (insert item))) 580 (insert item)))
586 ((and (not new-entry) 581 ((and (not new-entry)
587 (let (case-fold-search) 582 (let (case-fold-search)
588 (re-search-forward 583 (re-search-forward
589 (concat (regexp-quote (concat "* " item)) 584 (concat (regexp-quote (concat "* " item))
590 ;; Don't accept `foo.bar' when 585 ;; Don't accept `foo.bar' when
591 ;; looking for `foo': 586 ;; looking for `foo':
592 "\\(\\s \\|[(),:]\\)") 587 "\\(\\s \\|[(),:]\\)")
593 bound t))) 588 bound t)))
594 ;; Add to the existing item for the same file. 589 ;; Add to the existing item for the same file.
595 (re-search-forward "^\\s *$\\|^\\s \\*") 590 (re-search-forward "^\\s *$\\|^\\s \\*")
596 (goto-char (match-beginning 0)) 591 (goto-char (match-beginning 0))
597 ;; Delete excess empty lines; make just 2. 592 ;; Delete excess empty lines; make just 2.
598 (while (and (not (eobp)) (looking-at "^\\s *$")) 593 (while (and (not (eobp)) (looking-at "^\\s *$"))
599 (delete-region (point) (line-beginning-position 2))) 594 (delete-region (point) (line-beginning-position 2)))
600 (insert (if use-hard-newlines hard-newline "\n") 595 (insert (if use-hard-newlines hard-newline "\n")
601 (if use-hard-newlines hard-newline "\n")) 596 (if use-hard-newlines hard-newline "\n"))
602 (forward-line -2) 597 (forward-line -2)
603 (indent-relative-maybe)) 598 (indent-relative-maybe))
604 (t 599 (t
605 ;; Make a new item. 600 ;; Make a new item.
606 (while (looking-at "\\sW") 601 (while (looking-at "\\sW")
607 (forward-line 1)) 602 (forward-line 1))
608 (while (and (not (eobp)) (looking-at "^\\s *$")) 603 (while (and (not (eobp)) (looking-at "^\\s *$"))
609 (delete-region (point) (line-beginning-position 2))) 604 (delete-region (point) (line-beginning-position 2)))
610 (insert (if use-hard-newlines hard-newline "\n") 605 (insert (if use-hard-newlines hard-newline "\n")
611 (if use-hard-newlines hard-newline "\n") 606 (if use-hard-newlines hard-newline "\n")
612 (if use-hard-newlines hard-newline "\n")) 607 (if use-hard-newlines hard-newline "\n"))
613 (forward-line -2) 608 (forward-line -2)
614 (indent-to left-margin) 609 (indent-to left-margin)
615 (insert "* ") 610 (insert "* ")
616 (if item (insert item)))) 611 (if item (insert item)))))
617 ;; Now insert the function name, if we have one. 612 ;; Now insert the function name, if we have one.
618 ;; Point is at the item for this file, 613 ;; Point is at the item for this file,
619 ;; either at the end of the line or at the first blank line. 614 ;; either at the end of the line or at the first blank line.
@@ -662,9 +657,45 @@ the change log file in another window."
662 (add-change-log-entry whoami file-name t)) 657 (add-change-log-entry whoami file-name t))
663;;;###autoload (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window) 658;;;###autoload (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window)
664 659
660
665(defvar change-log-indent-text 0) 661(defvar change-log-indent-text 0)
666 662
663(defun change-log-fill-parenthesized-list ()
664 ;; Fill parenthesized lists of names according to GNU standards.
665 ;; * file-name.ext (very-long-foo, very-long-bar, very-long-foobar):
666 ;; should be filled as
667 ;; * file-name.ext (very-long-foo, very-long-bar)
668 ;; (very-long-foobar):
669 (save-excursion
670 (end-of-line 0)
671 (skip-chars-backward " \t")
672 (when (and (equal (char-before) ?\,)
673 (> (point) (1+ (point-min))))
674 (condition-case nil
675 (when (save-excursion
676 (and (prog2
677 (up-list -1)
678 (equal (char-after) ?\()
679 (skip-chars-backward " \t"))
680 (or (bolp)
681 ;; Skip everything but a whitespace or asterisk.
682 (and (not (zerop (skip-chars-backward "^ \t\n*")))
683 (skip-chars-backward " \t")
684 ;; We want one asterisk here.
685 (= (skip-chars-backward "*") -1)
686 (skip-chars-backward " \t")
687 (bolp)))))
688 ;; Delete the comma.
689 (delete-char -1)
690 ;; Close list on previous line.
691 (insert ")")
692 (skip-chars-forward " \t\n")
693 ;; Start list on new line.
694 (insert-before-markers "("))
695 (error nil)))))
696
667(defun change-log-indent () 697(defun change-log-indent ()
698 (change-log-fill-parenthesized-list)
668 (let* ((indent 699 (let* ((indent
669 (save-excursion 700 (save-excursion
670 (beginning-of-line) 701 (beginning-of-line)
@@ -699,6 +730,11 @@ Runs `change-log-mode-hook'.
699 show-trailing-whitespace t) 730 show-trailing-whitespace t)
700 (set (make-local-variable 'fill-paragraph-function) 731 (set (make-local-variable 'fill-paragraph-function)
701 'change-log-fill-paragraph) 732 'change-log-fill-paragraph)
733 ;; Avoid that filling leaves behind a single "*" on a line.
734 (add-hook 'fill-nobreak-predicate
735 '(lambda ()
736 (looking-back "^\\s *\\*\\s *" (line-beginning-position)))
737 nil t)
702 (set (make-local-variable 'indent-line-function) 'change-log-indent) 738 (set (make-local-variable 'indent-line-function) 'change-log-indent)
703 (set (make-local-variable 'tab-always-indent) nil) 739 (set (make-local-variable 'tab-always-indent) nil)
704 ;; We really do want "^" in paragraph-start below: it is only the 740 ;; We really do want "^" in paragraph-start below: it is only the
@@ -727,7 +763,11 @@ Prefix arg means justify as well."
727 (interactive "P") 763 (interactive "P")
728 (let ((end (progn (forward-paragraph) (point))) 764 (let ((end (progn (forward-paragraph) (point)))
729 (beg (progn (backward-paragraph) (point))) 765 (beg (progn (backward-paragraph) (point)))
730 (paragraph-start (concat paragraph-start "\\|\\s *\\s("))) 766 ;; Add lines starting with whitespace followed by a left paren or an
767 ;; asterisk.
768 (paragraph-start (concat paragraph-start "\\|\\s *\\(?:\\s(\\|\\*\\)"))
769 ;; Make sure we call `change-log-indent'.
770 (fill-indent-according-to-mode t))
731 (fill-region beg end justify) 771 (fill-region beg end justify)
732 t)) 772 t))
733 773
@@ -749,7 +789,7 @@ Prefix arg means justify as well."
749 789
750;;;###autoload 790;;;###autoload
751(defvar add-log-tex-like-modes 791(defvar add-log-tex-like-modes
752 '(TeX-mode plain-TeX-mode LaTeX-mode plain-tex-mode latex-mode) 792 '(TeX-mode plain-TeX-mode LaTeX-mode tex-mode)
753 "*Modes that look like TeX to `add-log-current-defun'.") 793 "*Modes that look like TeX to `add-log-current-defun'.")
754 794
755;;;###autoload 795;;;###autoload
@@ -771,7 +811,7 @@ Has a preference of looking backwards."
771 (let ((location (point))) 811 (let ((location (point)))
772 (cond (add-log-current-defun-function 812 (cond (add-log-current-defun-function
773 (funcall add-log-current-defun-function)) 813 (funcall add-log-current-defun-function))
774 ((memq major-mode add-log-lisp-like-modes) 814 ((apply 'derived-mode-p add-log-lisp-like-modes)
775 ;; If we are now precisely at the beginning of a defun, 815 ;; If we are now precisely at the beginning of a defun,
776 ;; make sure beginning-of-defun finds that one 816 ;; make sure beginning-of-defun finds that one
777 ;; rather than the previous one. 817 ;; rather than the previous one.
@@ -795,7 +835,7 @@ Has a preference of looking backwards."
795 (buffer-substring-no-properties (point) 835 (buffer-substring-no-properties (point)
796 (progn (forward-sexp 1) 836 (progn (forward-sexp 1)
797 (point))))) 837 (point)))))
798 ((and (memq major-mode add-log-c-like-modes) 838 ((and (apply 'derived-mode-p add-log-c-like-modes)
799 (save-excursion 839 (save-excursion
800 (beginning-of-line) 840 (beginning-of-line)
801 ;; Use eq instead of = here to avoid 841 ;; Use eq instead of = here to avoid
@@ -813,7 +853,7 @@ Has a preference of looking backwards."
813 (buffer-substring-no-properties (point) 853 (buffer-substring-no-properties (point)
814 (progn (forward-sexp 1) 854 (progn (forward-sexp 1)
815 (point)))) 855 (point))))
816 ((memq major-mode add-log-c-like-modes) 856 ((apply 'derived-mode-p add-log-c-like-modes)
817 ;; See whether the point is inside a defun. 857 ;; See whether the point is inside a defun.
818 (let (having-previous-defun 858 (let (having-previous-defun
819 having-next-defun 859 having-next-defun
@@ -955,7 +995,7 @@ Has a preference of looking backwards."
955 (setq end (point))) 995 (setq end (point)))
956 (buffer-substring-no-properties 996 (buffer-substring-no-properties
957 middle end))))))))) 997 middle end)))))))))
958 ((memq major-mode add-log-tex-like-modes) 998 ((apply 'derived-mode-p add-log-tex-like-modes)
959 (if (re-search-backward 999 (if (re-search-backward
960 "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)" 1000 "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)"
961 nil t) 1001 nil t)
@@ -964,17 +1004,17 @@ Has a preference of looking backwards."
964 (buffer-substring-no-properties 1004 (buffer-substring-no-properties
965 (1+ (point)) ; without initial backslash 1005 (1+ (point)) ; without initial backslash
966 (line-end-position))))) 1006 (line-end-position)))))
967 ((eq major-mode 'texinfo-mode) 1007 ((derived-mode-p 'texinfo-mode)
968 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t) 1008 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t)
969 (match-string-no-properties 1))) 1009 (match-string-no-properties 1)))
970 ((memq major-mode '(perl-mode cperl-mode)) 1010 ((derived-mode-p '(perl-mode cperl-mode))
971 (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t) 1011 (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t)
972 (match-string-no-properties 1))) 1012 (match-string-no-properties 1)))
973 ;; Emacs's autoconf-mode installs its own 1013 ;; Emacs's autoconf-mode installs its own
974 ;; `add-log-current-defun-function'. This applies to 1014 ;; `add-log-current-defun-function'. This applies to
975 ;; a different mode apparently for editing .m4 1015 ;; a different mode apparently for editing .m4
976 ;; autoconf source. 1016 ;; autoconf source.
977 ((eq major-mode 'autoconf-mode) 1017 ((derived-mode-p 'autoconf-mode)
978 (if (re-search-backward 1018 (if (re-search-backward
979 "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t) 1019 "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t)
980 (match-string-no-properties 3))) 1020 (match-string-no-properties 3)))
@@ -1041,17 +1081,32 @@ Point is assumed to be at the start of the entry."
1041 1081
1042(defun change-log-resolve-conflict () 1082(defun change-log-resolve-conflict ()
1043 "Function to be used in `smerge-resolve-function'." 1083 "Function to be used in `smerge-resolve-function'."
1044 (let ((buf (current-buffer))) 1084 (save-excursion
1045 (with-temp-buffer 1085 (save-restriction
1046 (insert-buffer-substring buf (match-beginning 1) (match-end 1)) 1086 (narrow-to-region (match-beginning 0) (match-end 0))
1047 (save-match-data (change-log-mode)) 1087 (let ((mb1 (match-beginning 1))
1048 (let ((other-buf (current-buffer))) 1088 (me1 (match-end 1))
1049 (with-current-buffer buf 1089 (mb3 (match-beginning 3))
1050 (save-excursion 1090 (me3 (match-end 3))
1051 (save-restriction 1091 (tmp1 (generate-new-buffer " *changelog-resolve-1*"))
1052 (narrow-to-region (match-beginning 0) (match-end 0)) 1092 (tmp2 (generate-new-buffer " *changelog-resolve-2*")))
1053 (replace-match (match-string 3) t t) 1093 (unwind-protect
1054 (change-log-merge other-buf)))))))) 1094 (let ((buf (current-buffer)))
1095 (with-current-buffer tmp1
1096 (change-log-mode)
1097 (insert-buffer-substring buf mb1 me1))
1098 (with-current-buffer tmp2
1099 (change-log-mode)
1100 (insert-buffer-substring buf mb3 me3)
1101 ;; Do the merge here instead of inside `buf' so as to be
1102 ;; more robust in case change-log-merge fails.
1103 (change-log-merge tmp1))
1104 (goto-char (point-max))
1105 (delete-region (point-min)
1106 (prog1 (point)
1107 (insert-buffer-substring tmp2))))
1108 (kill-buffer tmp1)
1109 (kill-buffer tmp2))))))
1055 1110
1056;;;###autoload 1111;;;###autoload
1057(defun change-log-merge (other-log) 1112(defun change-log-merge (other-log)
@@ -1063,7 +1118,7 @@ or a buffer.
1063Entries are inserted in chronological order. Both the current and 1118Entries are inserted in chronological order. Both the current and
1064old-style time formats for entries are supported." 1119old-style time formats for entries are supported."
1065 (interactive "*fLog file name to merge: ") 1120 (interactive "*fLog file name to merge: ")
1066 (if (not (eq major-mode 'change-log-mode)) 1121 (if (not (derived-mode-p 'change-log-mode))
1067 (error "Not in Change Log mode")) 1122 (error "Not in Change Log mode"))
1068 (let ((other-buf (if (bufferp other-log) other-log 1123 (let ((other-buf (if (bufferp other-log) other-log
1069 (find-file-noselect other-log))) 1124 (find-file-noselect other-log)))
@@ -1073,7 +1128,7 @@ old-style time formats for entries are supported."
1073 (goto-char (point-min)) 1128 (goto-char (point-min))
1074 (set-buffer other-buf) 1129 (set-buffer other-buf)
1075 (goto-char (point-min)) 1130 (goto-char (point-min))
1076 (if (not (eq major-mode 'change-log-mode)) 1131 (if (not (derived-mode-p 'change-log-mode))
1077 (error "%s not found in Change Log mode" other-log)) 1132 (error "%s not found in Change Log mode" other-log))
1078 ;; Loop through all the entries in OTHER-LOG. 1133 ;; Loop through all the entries in OTHER-LOG.
1079 (while (not (eobp)) 1134 (while (not (eobp))
diff --git a/lisp/bindings.el b/lisp/bindings.el
index e9abbc965e4..072eedd2fe9 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -248,6 +248,22 @@ Normally nil in most modes, since there is no process to display.")
248 248
249(make-variable-buffer-local 'mode-line-modified) 249(make-variable-buffer-local 'mode-line-modified)
250 250
251(defvar mode-line-remote
252 (list (propertize
253 "%1R"
254 'help-echo (purecopy (lambda (window object point)
255 (format "%s"
256 (save-selected-window
257 (select-window window)
258 (concat
259 (if (file-remote-p default-directory)
260 "Remote: "
261 "Local: ")
262 default-directory)))))))
263 "Mode-line flag to show if default-directory for current buffer is remote.")
264
265(make-variable-buffer-local 'mode-line-remote)
266
251;; Actual initialization is below. 267;; Actual initialization is below.
252(defvar mode-line-position nil 268(defvar mode-line-position nil
253 "Mode-line control for displaying the position in the buffer. 269 "Mode-line control for displaying the position in the buffer.
@@ -287,6 +303,7 @@ Keymap to display on minor modes.")
287 (propertize "-" 'help-echo help-echo) 303 (propertize "-" 'help-echo help-echo)
288 'mode-line-mule-info 304 'mode-line-mule-info
289 'mode-line-modified 305 'mode-line-modified
306 'mode-line-remote
290 'mode-line-frame-identification 307 'mode-line-frame-identification
291 'mode-line-buffer-identification 308 'mode-line-buffer-identification
292 (propertize " " 'help-echo help-echo) 309 (propertize " " 'help-echo help-echo)
diff --git a/lisp/calc/calc-math.el b/lisp/calc/calc-math.el
index d8de812421f..dbafd138e45 100644
--- a/lisp/calc/calc-math.el
+++ b/lisp/calc/calc-math.el
@@ -32,6 +32,71 @@
32(require 'calc-ext) 32(require 'calc-ext)
33(require 'calc-macs) 33(require 'calc-macs)
34 34
35
36;;; Find out how many 9s in 9.9999... will give distinct Emacs floats,
37;;; then back off by one.
38
39(defvar math-emacs-precision
40 (let* ((n 1)
41 (x 9)
42 (xx (+ x (* 9 (expt 10 (- n))))))
43 (while (/= x xx)
44 (progn
45 (setq n (1+ n))
46 (setq x xx)
47 (setq xx (+ x (* 9 (expt 10 (- n)))))))
48 (1- n))
49 "The number of digits in an Emacs float.")
50
51;;; Find the largest power of 10 which is an Emacs float,
52;;; then back off by one so that any float d.dddd...eN
53;;; is an Emacs float, for acceptable d.dddd....
54
55(defvar math-largest-emacs-expt
56 (let ((x 1))
57 (while (condition-case nil
58 (expt 10.0 x)
59 (error nil))
60 (setq x (* 2 x)))
61 (setq x (/ x 2))
62 (while (condition-case nil
63 (expt 10.0 x)
64 (error nil))
65 (setq x (1+ x)))
66 (- x 2))
67 "The largest exponent which Calc will convert to an Emacs float.")
68
69(defvar math-smallest-emacs-expt
70 (let ((x -1))
71 (while (condition-case nil
72 (expt 10.0 x)
73 (error nil))
74 (setq x (* 2 x)))
75 (setq x (/ x 2))
76 (while (condition-case nil
77 (expt 10.0 x)
78 (error nil))
79 (setq x (1- x)))
80 (+ x 2))
81 "The smallest exponent which Calc will convert to an Emacs float.")
82
83(defun math-use-emacs-fn (fn x)
84 "Use the native Emacs function FN to evaluate the Calc number X.
85If this can't be done, return NIL."
86 (and
87 (<= calc-internal-prec math-emacs-precision)
88 (math-realp x)
89 (let* ((fx (math-float x))
90 (xpon (+ (nth 2 x) (1- (math-numdigs (nth 1 x))))))
91 (and (<= math-smallest-emacs-expt xpon)
92 (<= xpon math-largest-emacs-expt)
93 (condition-case nil
94 (math-read-number
95 (number-to-string
96 (funcall fn
97 (string-to-number (math-format-number (math-float x))))))
98 (error nil))))))
99
35(defun calc-sqrt (arg) 100(defun calc-sqrt (arg)
36 (interactive "P") 101 (interactive "P")
37 (calc-slow-wrapper 102 (calc-slow-wrapper
@@ -1403,6 +1468,7 @@
1403 (list 'polar 1468 (list 'polar
1404 (math-exp-raw (nth 1 xc)) 1469 (math-exp-raw (nth 1 xc))
1405 (math-from-radians (nth 2 xc))))) 1470 (math-from-radians (nth 2 xc)))))
1471 ((math-use-emacs-fn 'exp x))
1406 ((or (math-lessp-float '(float 5 -1) x) 1472 ((or (math-lessp-float '(float 5 -1) x)
1407 (math-lessp-float x '(float -5 -1))) 1473 (math-lessp-float x '(float -5 -1)))
1408 (if (math-lessp-float '(float 921035 1) x) 1474 (if (math-lessp-float '(float 921035 1) x)
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index 64199147c21..a1bd0afa126 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -155,7 +155,7 @@ when editing big diffs)."
155 ("\C-c\C-u" . diff-context->unified) 155 ("\C-c\C-u" . diff-context->unified)
156 ;; `d' because it duplicates the context :-( --Stef 156 ;; `d' because it duplicates the context :-( --Stef
157 ("\C-c\C-d" . diff-unified->context) 157 ("\C-c\C-d" . diff-unified->context)
158 ("\C-c\C-w" . diff-refine-hunk) 158 ("\C-c\C-w" . diff-refine-ignore-spaces-hunk)
159 ("\C-c\C-f" . next-error-follow-minor-mode)) 159 ("\C-c\C-f" . next-error-follow-minor-mode))
160 "Keymap for `diff-mode'. See also `diff-mode-shared-map'.") 160 "Keymap for `diff-mode'. See also `diff-mode-shared-map'.")
161 161
@@ -164,12 +164,23 @@ when editing big diffs)."
164 '("Diff" 164 '("Diff"
165 ["Jump to Source" diff-goto-source t] 165 ["Jump to Source" diff-goto-source t]
166 ["Apply hunk" diff-apply-hunk t] 166 ["Apply hunk" diff-apply-hunk t]
167 ["Test applying hunk" diff-test-hunk t]
167 ["Apply diff with Ediff" diff-ediff-patch t] 168 ["Apply diff with Ediff" diff-ediff-patch t]
168 ["-----" nil nil] 169 "-----"
169 ["Reverse direction" diff-reverse-direction t] 170 ["Reverse direction" diff-reverse-direction t]
170 ["Context -> Unified" diff-context->unified t] 171 ["Context -> Unified" diff-context->unified t]
171 ["Unified -> Context" diff-unified->context t] 172 ["Unified -> Context" diff-unified->context t]
172 ;;["Fixup Headers" diff-fixup-modifs (not buffer-read-only)] 173 ;;["Fixup Headers" diff-fixup-modifs (not buffer-read-only)]
174 "-----"
175 ["Split hunk" diff-split-hunk (diff-splittable-p)]
176 ["Refine hunk" diff-refine-ignore-spaces-hunk t]
177 ["Kill current hunk" diff-hunk-kill t]
178 ["Kill current file's hunks" diff-file-kill t]
179 "-----"
180 ["Previous Hunk" diff-hunk-prev t]
181 ["Next Hunk" diff-hunk-next t]
182 ["Previous File" diff-file-prev t]
183 ["Next File" diff-file-next t]
173 )) 184 ))
174 185
175(defcustom diff-minor-mode-prefix "\C-c=" 186(defcustom diff-minor-mode-prefix "\C-c="
@@ -390,13 +401,26 @@ when editing big diffs)."
390 ;; The return value is used by easy-mmode-define-navigation. 401 ;; The return value is used by easy-mmode-define-navigation.
391 (goto-char (or end (point-max))))) 402 (goto-char (or end (point-max)))))
392 403
393(defun diff-beginning-of-hunk () 404(defun diff-beginning-of-hunk (&optional try-harder)
405 "Move back to beginning of hunk.
406If TRY-HARDER is non-nil, try to cater to the case where we're not in a hunk
407but in the file header instead, in which case move forward to the first hunk."
394 (beginning-of-line) 408 (beginning-of-line)
395 (unless (looking-at diff-hunk-header-re) 409 (unless (looking-at diff-hunk-header-re)
396 (forward-line 1) 410 (forward-line 1)
397 (condition-case () 411 (condition-case ()
398 (re-search-backward diff-hunk-header-re) 412 (re-search-backward diff-hunk-header-re)
399 (error (error "Can't find the beginning of the hunk"))))) 413 (error
414 (if (not try-harder)
415 (error "Can't find the beginning of the hunk")
416 (diff-beginning-of-file-and-junk)
417 (diff-hunk-next))))))
418
419(defun diff-unified-hunk-p ()
420 (save-excursion
421 (ignore-errors
422 (diff-beginning-of-hunk)
423 (looking-at "^@@"))))
400 424
401(defun diff-beginning-of-file () 425(defun diff-beginning-of-file ()
402 (beginning-of-line) 426 (beginning-of-line)
@@ -425,7 +449,7 @@ when editing big diffs)."
425If the prefix ARG is given, restrict the view to the current file instead." 449If the prefix ARG is given, restrict the view to the current file instead."
426 (interactive "P") 450 (interactive "P")
427 (save-excursion 451 (save-excursion
428 (if arg (diff-beginning-of-file) (diff-beginning-of-hunk)) 452 (if arg (diff-beginning-of-file) (diff-beginning-of-hunk 'try-harder))
429 (narrow-to-region (point) 453 (narrow-to-region (point)
430 (progn (if arg (diff-end-of-file) (diff-end-of-hunk)) 454 (progn (if arg (diff-end-of-file) (diff-end-of-hunk))
431 (point))) 455 (point)))
@@ -453,18 +477,37 @@ If the prefix ARG is given, restrict the view to the current file instead."
453 (diff-end-of-hunk) 477 (diff-end-of-hunk)
454 (kill-region start (point))))) 478 (kill-region start (point)))))
455 479
480(defun diff-beginning-of-file-and-junk ()
481 "Go to the beginning of file-related diff-info.
482This is like `diff-beginning-of-file' except it tries to skip back over leading
483data such as \"Index: ...\" and such."
484 (let ((start (point))
485 (file (condition-case err (progn (diff-beginning-of-file) (point))
486 (error err)))
487 ;; prevhunk is one of the limits.
488 (prevhunk (save-excursion (ignore-errors (diff-hunk-prev) (point))))
489 err)
490 (when (consp file)
491 ;; Presumably, we started before the file header, in the leading junk.
492 (setq err file)
493 (diff-file-next)
494 (setq file (point)))
495 (let ((index (save-excursion
496 (re-search-backward "^Index: " prevhunk t))))
497 (when index (setq file index))
498 (if (<= file start)
499 (goto-char file)
500 ;; File starts *after* the starting point: we really weren't in
501 ;; a file diff but elsewhere.
502 (goto-char start)
503 (signal (car err) (cdr err))))))
504
456(defun diff-file-kill () 505(defun diff-file-kill ()
457 "Kill current file's hunks." 506 "Kill current file's hunks."
458 (interactive) 507 (interactive)
459 (diff-beginning-of-file) 508 (diff-beginning-of-file-and-junk)
460 (let* ((start (point)) 509 (let* ((start (point))
461 (prevhunk (save-excursion
462 (ignore-errors
463 (diff-hunk-prev) (point))))
464 (index (save-excursion
465 (re-search-backward "^Index: " prevhunk t)))
466 (inhibit-read-only t)) 510 (inhibit-read-only t))
467 (when index (setq start index))
468 (diff-end-of-file) 511 (diff-end-of-file)
469 (if (looking-at "^\n") (forward-char 1)) ;`tla' generates such diffs. 512 (if (looking-at "^\n") (forward-char 1)) ;`tla' generates such diffs.
470 (kill-region start (point)))) 513 (kill-region start (point))))
@@ -491,6 +534,13 @@ If the prefix ARG is given, restrict the view to the current file instead."
491 (while (re-search-forward re end t) (incf n)) 534 (while (re-search-forward re end t) (incf n))
492 n))) 535 n)))
493 536
537(defun diff-splittable-p ()
538 (save-excursion
539 (beginning-of-line)
540 (and (looking-at "^[-+ ]")
541 (progn (forward-line -1) (looking-at "^[-+ ]"))
542 (diff-unified-hunk-p))))
543
494(defun diff-split-hunk () 544(defun diff-split-hunk ()
495 "Split the current (unified diff) hunk at point into two hunks." 545 "Split the current (unified diff) hunk at point into two hunks."
496 (interactive) 546 (interactive)
@@ -585,9 +635,11 @@ If the OLD prefix arg is passed, tell the file NAME of the old file."
585 (list (if old (match-string 2) (match-string 4)) 635 (list (if old (match-string 2) (match-string 4))
586 (if old (match-string 4) (match-string 2))))))))) 636 (if old (match-string 4) (match-string 2)))))))))
587 637
588(defun diff-find-file-name (&optional old prefix) 638(defun diff-find-file-name (&optional old batch prefix)
589 "Return the file corresponding to the current patch. 639 "Return the file corresponding to the current patch.
590Non-nil OLD means that we want the old file. 640Non-nil OLD means that we want the old file.
641Non-nil BATCH means to prefer returning an incorrect answer than to prompt
642the user.
591PREFIX is only used internally: don't use it." 643PREFIX is only used internally: don't use it."
592 (save-excursion 644 (save-excursion
593 (unless (looking-at diff-file-header-re) 645 (unless (looking-at diff-file-header-re)
@@ -622,7 +674,10 @@ PREFIX is only used internally: don't use it."
622 (boundp 'cvs-pcl-cvs-dirchange-re) 674 (boundp 'cvs-pcl-cvs-dirchange-re)
623 (save-excursion 675 (save-excursion
624 (re-search-backward cvs-pcl-cvs-dirchange-re nil t)) 676 (re-search-backward cvs-pcl-cvs-dirchange-re nil t))
625 (diff-find-file-name old (match-string 1))) 677 (diff-find-file-name old batch (match-string 1)))
678 ;; Invent something, if necessary.
679 (when batch
680 (or (car fs) default-directory))
626 ;; if all else fails, ask the user 681 ;; if all else fails, ask the user
627 (let ((file (read-file-name (format "Use file %s: " (or (first fs) "")) 682 (let ((file (read-file-name (format "Use file %s: " (or (first fs) ""))
628 nil (first fs) t (first fs)))) 683 nil (first fs) t (first fs))))
@@ -670,7 +725,12 @@ else cover the whole bufer."
670 (let ((line1 (match-string 4)) 725 (let ((line1 (match-string 4))
671 (lines1 (match-string 5)) 726 (lines1 (match-string 5))
672 (line2 (match-string 6)) 727 (line2 (match-string 6))
673 (lines2 (match-string 7))) 728 (lines2 (match-string 7))
729 ;; Variables to use the special undo function.
730 (old-undo buffer-undo-list)
731 (old-end (marker-position end))
732 (start (match-beginning 0))
733 (reversible t))
674 (replace-match 734 (replace-match
675 (concat "***************\n*** " line1 "," 735 (concat "***************\n*** " line1 ","
676 (number-to-string (+ (string-to-number line1) 736 (number-to-string (+ (string-to-number line1)
@@ -712,6 +772,14 @@ else cover the whole bufer."
712 (if (not (save-excursion (re-search-forward "^+" nil t))) 772 (if (not (save-excursion (re-search-forward "^+" nil t)))
713 (delete-region (point) (point-max)) 773 (delete-region (point) (point-max))
714 (let ((modif nil) (delete nil)) 774 (let ((modif nil) (delete nil))
775 (if (save-excursion (re-search-forward "^\\+.*\n-" nil t))
776 ;; Normally, lines in a substitution come with
777 ;; first the removals and then the additions, and
778 ;; the context->unified function follows this
779 ;; convention, of course. Yet, other alternatives
780 ;; are valid as well, but they preclude the use of
781 ;; context->unified as an undo command.
782 (setq reversible nil))
715 (while (not (eobp)) 783 (while (not (eobp))
716 (case (char-after) 784 (case (char-after)
717 (?\s (insert " ") (setq modif nil) (backward-char 1)) 785 (?\s (insert " ") (setq modif nil) (backward-char 1))
@@ -730,7 +798,15 @@ else cover the whole bufer."
730 (forward-line 1) 798 (forward-line 1)
731 (when delete 799 (when delete
732 (delete-region last-pt (point)) 800 (delete-region last-pt (point))
733 (setq delete nil))))))))))))))) 801 (setq delete nil)))))))
802 (unless (or (not reversible) (eq buffer-undo-list t))
803 ;; Drop the many undo entries and replace them with
804 ;; a single entry that uses diff-context->unified to do
805 ;; the work.
806 (setq buffer-undo-list
807 (cons (list 'apply (- old-end end) start (point-max)
808 'diff-context->unified start (point-max))
809 old-undo)))))))))))
734 810
735(defun diff-context->unified (start end &optional to-context) 811(defun diff-context->unified (start end &optional to-context)
736 "Convert context diffs to unified diffs. 812 "Convert context diffs to unified diffs.
@@ -1289,7 +1365,8 @@ SRC and DST are the two variants of text as returned by `diff-hunk-text'.
1289SWITCHED is non-nil if the patch is already applied." 1365SWITCHED is non-nil if the patch is already applied."
1290 (save-excursion 1366 (save-excursion
1291 (let* ((other (diff-xor other-file diff-jump-to-old-file)) 1367 (let* ((other (diff-xor other-file diff-jump-to-old-file))
1292 (char-offset (- (point) (progn (diff-beginning-of-hunk) (point)))) 1368 (char-offset (- (point) (progn (diff-beginning-of-hunk 'try-harder)
1369 (point))))
1293 ;; Check that the hunk is well-formed. Otherwise diff-mode and 1370 ;; Check that the hunk is well-formed. Otherwise diff-mode and
1294 ;; the user may disagree on what constitutes the hunk 1371 ;; the user may disagree on what constitutes the hunk
1295 ;; (e.g. because an empty line truncates the hunk mid-course), 1372 ;; (e.g. because an empty line truncates the hunk mid-course),
@@ -1461,10 +1538,11 @@ For use in `add-log-current-defun-function'."
1461 (goto-char (+ (car pos) (cdr src))) 1538 (goto-char (+ (car pos) (cdr src)))
1462 (add-log-current-defun)))))) 1539 (add-log-current-defun))))))
1463 1540
1464(defun diff-refine-hunk () 1541(defun diff-refine-ignore-spaces-hunk ()
1465 "Refine the current hunk by ignoring space differences." 1542 "Refine the current hunk by ignoring space differences."
1466 (interactive) 1543 (interactive)
1467 (let* ((char-offset (- (point) (progn (diff-beginning-of-hunk) (point)))) 1544 (let* ((char-offset (- (point) (progn (diff-beginning-of-hunk 'try-harder)
1545 (point))))
1468 (opts (case (char-after) (?@ "-bu") (?* "-bc") (t "-b"))) 1546 (opts (case (char-after) (?@ "-bu") (?* "-bc") (t "-b")))
1469 (line-nb (and (or (looking-at "[^0-9]+\\([0-9]+\\)") 1547 (line-nb (and (or (looking-at "[^0-9]+\\([0-9]+\\)")
1470 (error "Can't find line number")) 1548 (error "Can't find line number"))
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index 41a3144f91a..f5e0391af28 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -109,7 +109,7 @@ When this is `function', only ask when called non-interactively."
109 (save-match-data 109 (save-match-data
110 (forward-line 1) 110 (forward-line 1)
111 (and (looking-at comment-start-skip) 111 (and (looking-at comment-start-skip)
112 (goto-char (match-end 1)))) 112 (goto-char (match-end 0))))
113 (save-match-data 113 (save-match-data
114 (looking-at copyright-years-regexp)))) 114 (looking-at copyright-years-regexp))))
115 (forward-line 1) 115 (forward-line 1)
diff --git a/lisp/files.el b/lisp/files.el
index ed76e16b183..f89ea85f2cc 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -711,6 +711,28 @@ PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)."
711 ((null action) (try-completion string names)) 711 ((null action) (try-completion string names))
712 (t (test-completion string names)))))) 712 (t (test-completion string names))))))
713 713
714(defun locate-dominating-file (file regexp)
715 "Look up the directory hierarchy from FILE for a file matching REGEXP."
716 (while (and file (not (file-directory-p file)))
717 (setq file (file-name-directory (directory-file-name file))))
718 (catch 'found
719 (let ((user (nth 2 (file-attributes file)))
720 ;; Abbreviate, so as to stop when we cross ~/.
721 (dir (abbreviate-file-name (file-name-as-directory file)))
722 files)
723 ;; As a heuristic, we stop looking up the hierarchy of directories as
724 ;; soon as we find a directory belonging to another user. This should
725 ;; save us from looking in things like /net and /afs. This assumes
726 ;; that all the files inside a project belong to the same user.
727 (while (and dir (equal user (nth 2 (file-attributes dir))))
728 (if (setq files (directory-files dir 'full regexp))
729 (throw 'found (car files))
730 (if (equal dir
731 (setq dir (file-name-directory
732 (directory-file-name dir))))
733 (setq dir nil))))
734 nil)))
735
714(defun executable-find (command) 736(defun executable-find (command)
715 "Search for COMMAND in `exec-path' and return the absolute file name. 737 "Search for COMMAND in `exec-path' and return the absolute file name.
716Return nil if COMMAND is not found anywhere in `exec-path'." 738Return nil if COMMAND is not found anywhere in `exec-path'."
@@ -2464,6 +2486,7 @@ asking you for confirmation."
2464 mode-line-mule-info 2486 mode-line-mule-info
2465 mode-line-position 2487 mode-line-position
2466 mode-line-process 2488 mode-line-process
2489 mode-line-remote
2467 mode-name 2490 mode-name
2468 outline-level 2491 outline-level
2469 overriding-local-map 2492 overriding-local-map
diff --git a/lisp/follow.el b/lisp/follow.el
index 15d263d300d..9d688332588 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -278,12 +278,12 @@
278 :group 'convenience) 278 :group 'convenience)
279 279
280(defcustom follow-mode-hook nil 280(defcustom follow-mode-hook nil
281 "Hooks to run when follow-mode is turned on." 281 "Hooks to run when Follow mode is turned on."
282 :type 'hook 282 :type 'hook
283 :group 'follow) 283 :group 'follow)
284 284
285(defcustom follow-mode-off-hook nil 285(defcustom follow-mode-off-hook nil
286 "Hooks to run when follow-mode is turned off." 286 "Hooks to run when Follow mode is turned off."
287 :type 'hook 287 :type 'hook
288 :group 'follow) 288 :group 'follow)
289 289
@@ -501,9 +501,9 @@ of two major techniques:
501 movement commands. 501 movement commands.
502 502
503Follow mode comes to its prime when used on a large screen and two 503Follow mode comes to its prime when used on a large screen and two
504side-by-side window are used. The user can, with the help of Follow 504side-by-side windows are used. The user can, with the help of Follow
505mode, use two full-height windows as though they would have been 505mode, use two full-height windows as though they would have been
506one. Imagine yourself editing a large function, or section of text, 506one. Imagine yourself editing a large function, or section of text,
507and being able to use 144 lines instead of the normal 72... (your 507and being able to use 144 lines instead of the normal 72... (your
508mileage may vary). 508mileage may vary).
509 509
@@ -511,7 +511,7 @@ To split one large window into two side-by-side windows, the commands
511`\\[split-window-horizontally]' or \ 511`\\[split-window-horizontally]' or \
512`M-x follow-delete-other-windows-and-split' can be used. 512`M-x follow-delete-other-windows-and-split' can be used.
513 513
514Only windows displayed in the same frame follow each-other. 514Only windows displayed in the same frame follow each other.
515 515
516If the variable `follow-intercept-processes' is non-nil, Follow mode 516If the variable `follow-intercept-processes' is non-nil, Follow mode
517will listen to the output of processes and redisplay accordingly. 517will listen to the output of processes and redisplay accordingly.
@@ -645,11 +645,11 @@ Works like `scroll-up' when not in Follow Mode."
645Execute this command to display as much as possible of the text 645Execute this command to display as much as possible of the text
646in the selected window. All other windows, in the current 646in the selected window. All other windows, in the current
647frame, are deleted and the selected window is split in two 647frame, are deleted and the selected window is split in two
648side-by-side windows. Follow Mode is activated, hence the 648side-by-side windows. Follow Mode is activated, hence the
649two windows always will display two successive pages. 649two windows always will display two successive pages.
650\(If one window is moved, the other one will follow.) 650\(If one window is moved, the other one will follow.)
651 651
652If ARG is positive, the leftmost window is selected. If it negative, 652If ARG is positive, the leftmost window is selected. If negative,
653the rightmost is selected. If ARG is nil, the leftmost window is 653the rightmost is selected. If ARG is nil, the leftmost window is
654selected if the original window is the first one in the frame. 654selected if the original window is the first one in the frame.
655 655
@@ -754,8 +754,8 @@ in your `~/.emacs' file:
754Rearrange all other windows around the middle window. 754Rearrange all other windows around the middle window.
755 755
756With a positive argument, place the current line ARG lines 756With a positive argument, place the current line ARG lines
757from the top. With a negative, place it -ARG lines from the 757from the top. With a negative argument, place it -ARG lines
758bottom." 758from the bottom."
759 (interactive "P") 759 (interactive "P")
760 (if arg 760 (if arg
761 (let ((p (point)) 761 (let ((p (point))
@@ -985,7 +985,7 @@ Note that this handles the case when the cache has been set to nil."
985;; should start at a full screen line. 985;; should start at a full screen line.
986 986
987(defsubst follow-windows-aligned-p (win-start-end) 987(defsubst follow-windows-aligned-p (win-start-end)
988 "Non-nil if the follower WINDOWS are aligned." 988 "Non-nil if the follower windows are aligned."
989 (let ((res t)) 989 (let ((res t))
990 (save-excursion 990 (save-excursion
991 (goto-char (window-start (car (car win-start-end)))) 991 (goto-char (window-start (car (car win-start-end))))
@@ -1005,7 +1005,7 @@ Note that this handles the case when the cache has been set to nil."
1005;; no one will be recentered.) 1005;; no one will be recentered.)
1006 1006
1007(defun follow-point-visible-all-windows-p (win-start-end) 1007(defun follow-point-visible-all-windows-p (win-start-end)
1008 "Non-nil when the window-point is visible in all windows." 1008 "Non-nil when the `window-point' is visible in all windows."
1009 (let ((res t)) 1009 (let ((res t))
1010 (while (and res win-start-end) 1010 (while (and res win-start-end)
1011 (setq res (follow-pos-visible (window-point (car (car win-start-end))) 1011 (setq res (follow-pos-visible (window-point (car (car win-start-end)))
@@ -1133,7 +1133,7 @@ Return the selected window."
1133(defun follow-redisplay (&optional windows win) 1133(defun follow-redisplay (&optional windows win)
1134 "Reposition the WINDOWS around WIN. 1134 "Reposition the WINDOWS around WIN.
1135Should the point be too close to the roof we redisplay everything 1135Should the point be too close to the roof we redisplay everything
1136from the top. WINDOWS should contain a list of windows to 1136from the top. WINDOWS should contain a list of windows to
1137redisplay, it is assumed that WIN is a member of the list. 1137redisplay, it is assumed that WIN is a member of the list.
1138Should WINDOWS be nil, the windows displaying the 1138Should WINDOWS be nil, the windows displaying the
1139same buffer as WIN, in the current frame, are used. 1139same buffer as WIN, in the current frame, are used.
@@ -1214,8 +1214,8 @@ START."
1214(defun follow-estimate-first-window-start (windows win start) 1214(defun follow-estimate-first-window-start (windows win start)
1215 "Estimate the position of the first window. 1215 "Estimate the position of the first window.
1216 1216
1217Returns (EXACT . POS). If EXACT is non-nil, POS is the starting 1217Returns (EXACT . POS). If EXACT is non-nil, POS is the starting
1218position of the first window. Otherwise it is a good guess." 1218position of the first window. Otherwise it is a good guess."
1219 (let ((pred (car (follow-split-followers windows win))) 1219 (let ((pred (car (follow-split-followers windows win)))
1220 (exact nil)) 1220 (exact nil))
1221 (save-excursion 1221 (save-excursion
@@ -1667,7 +1667,7 @@ non-first windows in Follow Mode."
1667 (defun follow-xemacs-scrollbar-support (window) 1667 (defun follow-xemacs-scrollbar-support (window)
1668 "Redraw windows showing the same buffer as shown in WINDOW. 1668 "Redraw windows showing the same buffer as shown in WINDOW.
1669WINDOW is either the dragged window, or a cons containing the 1669WINDOW is either the dragged window, or a cons containing the
1670window as its first element. This is called while the user drags 1670window as its first element. This is called while the user drags
1671the scrollbar. 1671the scrollbar.
1672 1672
1673WINDOW can be an object or a window." 1673WINDOW can be an object or a window."
@@ -1797,7 +1797,7 @@ magic stuff before the real process filter is called."
1797 "Intercept all active processes. 1797 "Intercept all active processes.
1798 1798
1799This is needed so that Follow Mode can track all display events in the 1799This is needed so that Follow Mode can track all display events in the
1800system. (See `follow-mode')" 1800system. (See `follow-mode'.)"
1801 (interactive) 1801 (interactive)
1802 (let ((list (process-list))) 1802 (let ((list (process-list)))
1803 (while list 1803 (while list
@@ -2075,7 +2075,7 @@ report this using the `report-emacs-bug' function."
2075;;{{{ Tail window handling 2075;;{{{ Tail window handling
2076 2076
2077;; In Emacs (not XEmacs) windows showing nothing are sometimes 2077;; In Emacs (not XEmacs) windows showing nothing are sometimes
2078;; recentered. When in Follow Mode, this is not desireable for 2078;; recentered. When in Follow Mode, this is not desirable for
2079;; non-first windows in the window chain. This section tries to 2079;; non-first windows in the window chain. This section tries to
2080;; make the windows stay where they should be. 2080;; make the windows stay where they should be.
2081;; 2081;;
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 6a66ebbf756..fa1f2527894 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,12 @@
12007-07-21 Reiner Steib <Reiner.Steib@gmx.de>
2
3 * mm-uu.el (mm-uu-type-alist): Refer to mm-uu-configure-list in doc
4 string.
5
62007-07-16 Katsumi Yamaoka <yamaoka@jpl.org>
7
8 * gnus-srvr.el (gnus-server-font-lock-keywords): Quote faces.
9
12007-07-14 David Kastrup <dak@gnu.org> 102007-07-14 David Kastrup <dak@gnu.org>
2 11
3 * gnus-art.el (gnus-mime-delete-part): Don't go through article-edit 12 * gnus-art.el (gnus-mime-delete-part): Don't go through article-edit
diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el
index 0d5443f576c..21c99749804 100644
--- a/lisp/gnus/gnus-srvr.el
+++ b/lisp/gnus/gnus-srvr.el
@@ -215,11 +215,11 @@ If nil, a faster, but more primitive, buffer is used instead."
215(put 'gnus-server-offline-face 'face-alias 'gnus-server-offline) 215(put 'gnus-server-offline-face 'face-alias 'gnus-server-offline)
216 216
217(defvar gnus-server-font-lock-keywords 217(defvar gnus-server-font-lock-keywords
218 '(("(\\(agent\\))" 1 gnus-server-agent) 218 '(("(\\(agent\\))" 1 'gnus-server-agent)
219 ("(\\(opened\\))" 1 gnus-server-opened) 219 ("(\\(opened\\))" 1 'gnus-server-opened)
220 ("(\\(closed\\))" 1 gnus-server-closed) 220 ("(\\(closed\\))" 1 'gnus-server-closed)
221 ("(\\(offline\\))" 1 gnus-server-offline) 221 ("(\\(offline\\))" 1 'gnus-server-offline)
222 ("(\\(denied\\))" 1 gnus-server-denied))) 222 ("(\\(denied\\))" 1 'gnus-server-denied)))
223 223
224(defun gnus-server-mode () 224(defun gnus-server-mode ()
225 "Major mode for listing and editing servers. 225 "Major mode for listing and editing servers.
diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
index 26eae64777f..acd39c8dfa1 100644
--- a/lisp/gnus/mm-uu.el
+++ b/lisp/gnus/mm-uu.el
@@ -162,7 +162,10 @@ This can be either \"inline\" or \"attachment\".")
162Each element consist of the following entries: label, 162Each element consist of the following entries: label,
163start-regexp, end-regexp, extract-function, test-function. 163start-regexp, end-regexp, extract-function, test-function.
164 164
165After modifying this list you must run \\[mm-uu-configure].") 165After modifying this list you must run \\[mm-uu-configure].
166
167You can disable elements from this list by customizing
168`mm-uu-configure-list'.")
166 169
167(defcustom mm-uu-configure-list '((shar . disabled)) 170(defcustom mm-uu-configure-list '((shar . disabled))
168 "A list of mm-uu configuration. 171 "A list of mm-uu configuration.
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index d520d99ea11..93c11813864 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -869,11 +869,28 @@ displayed."
869;;;###autoload 869;;;###autoload
870(defalias 'tumme 'image-dired-show-all-from-dir) 870(defalias 'tumme 'image-dired-show-all-from-dir)
871 871
872(defun image-dired-sane-db-file ()
873 "Check if `image-dired-db-file' exists.
874If not, try to create it (including any parent directories).
875Signal error if there are problems creating it."
876 (or (file-exists-p image-dired-db-file)
877 (let (dir buf)
878 (unless (file-directory-p (setq dir (file-name-directory
879 image-dired-db-file)))
880 (make-directory dir t))
881 (with-current-buffer (setq buf (create-file-buffer
882 image-dired-db-file))
883 (write-file image-dired-db-file))
884 (kill-buffer buf)
885 (file-exists-p image-dired-db-file))
886 (error "Could not create %s" image-dired-db-file)))
887
872(defun image-dired-write-tags (file-tags) 888(defun image-dired-write-tags (file-tags)
873 "Write file tags to database. 889 "Write file tags to database.
874Write each file and tag in FILE-TAGS to the database. FILE-TAGS 890Write each file and tag in FILE-TAGS to the database. FILE-TAGS
875is an alist in the following form: 891is an alist in the following form:
876 ((FILE . TAG) ... )" 892 ((FILE . TAG) ... )"
893 (image-dired-sane-db-file)
877 (let (end file tag) 894 (let (end file tag)
878 (with-temp-file image-dired-db-file 895 (with-temp-file image-dired-db-file
879 (insert-file-contents image-dired-db-file) 896 (insert-file-contents image-dired-db-file)
@@ -893,6 +910,7 @@ is an alist in the following form:
893 910
894(defun image-dired-remove-tag (files tag) 911(defun image-dired-remove-tag (files tag)
895 "For all FILES, remove TAG from the image database." 912 "For all FILES, remove TAG from the image database."
913 (image-dired-sane-db-file)
896 (save-excursion 914 (save-excursion
897 (let (end buf start) 915 (let (end buf start)
898 (setq buf (find-file image-dired-db-file)) 916 (setq buf (find-file image-dired-db-file))
@@ -927,6 +945,7 @@ is an alist in the following form:
927 945
928(defun image-dired-list-tags (file) 946(defun image-dired-list-tags (file)
929 "Read all tags for image FILE from the image database." 947 "Read all tags for image FILE from the image database."
948 (image-dired-sane-db-file)
930 (save-excursion 949 (save-excursion
931 (let (end buf (tags "")) 950 (let (end buf (tags ""))
932 (setq buf (find-file image-dired-db-file)) 951 (setq buf (find-file image-dired-db-file))
@@ -2038,6 +2057,7 @@ function. The result is a couple of new files in
2038Write file comments to one or more files. FILE-COMMENTS is an alist on 2057Write file comments to one or more files. FILE-COMMENTS is an alist on
2039the following form: 2058the following form:
2040 ((FILE . COMMENT) ... )" 2059 ((FILE . COMMENT) ... )"
2060 (image-dired-sane-db-file)
2041 (let (end comment-beg-pos comment-end-pos file comment) 2061 (let (end comment-beg-pos comment-end-pos file comment)
2042 (with-temp-file image-dired-db-file 2062 (with-temp-file image-dired-db-file
2043 (insert-file-contents image-dired-db-file) 2063 (insert-file-contents image-dired-db-file)
@@ -2108,6 +2128,7 @@ as initial value."
2108 2128
2109(defun image-dired-get-comment (file) 2129(defun image-dired-get-comment (file)
2110 "Get comment for file FILE." 2130 "Get comment for file FILE."
2131 (image-dired-sane-db-file)
2111 (save-excursion 2132 (save-excursion
2112 (let (end buf comment-beg-pos comment-end-pos comment) 2133 (let (end buf comment-beg-pos comment-end-pos comment)
2113 (setq buf (find-file image-dired-db-file)) 2134 (setq buf (find-file image-dired-db-file))
@@ -2136,6 +2157,7 @@ lets you input a regexp and this will be matched against all tags
2136on all image files in the database file. The files that have a 2157on all image files in the database file. The files that have a
2137matching tags will be marked in the dired buffer." 2158matching tags will be marked in the dired buffer."
2138 (interactive) 2159 (interactive)
2160 (image-dired-sane-db-file)
2139 (let ((tag (read-string "Mark tagged files (regexp): ")) 2161 (let ((tag (read-string "Mark tagged files (regexp): "))
2140 (hits 0) 2162 (hits 0)
2141 files buf) 2163 files buf)
@@ -2300,6 +2322,7 @@ image-dired-file-comment-list:
2300 2322
2301(defun image-dired-create-gallery-lists () 2323(defun image-dired-create-gallery-lists ()
2302 "Create temporary lists used by `image-dired-gallery-generate'." 2324 "Create temporary lists used by `image-dired-gallery-generate'."
2325 (image-dired-sane-db-file)
2303 (let ((buf (find-file image-dired-db-file)) 2326 (let ((buf (find-file image-dired-db-file))
2304 end beg file row-tags) 2327 end beg file row-tags)
2305 (setq image-dired-tag-file-list nil) 2328 (setq image-dired-tag-file-list nil)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 57e995a8811..dc7f61c2eb6 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -164,6 +164,10 @@ is non-nil if the user quit the search.")
164(defvar isearch-mode-end-hook-quit nil 164(defvar isearch-mode-end-hook-quit nil
165 "Non-nil while running `isearch-mode-end-hook' if user quit the search.") 165 "Non-nil while running `isearch-mode-end-hook' if user quit the search.")
166 166
167(defvar isearch-message-function nil
168 "Function to call to display the search prompt.
169If nil, use `isearch-message'.")
170
167(defvar isearch-wrap-function nil 171(defvar isearch-wrap-function nil
168 "Function to call to wrap the search when search is failed. 172 "Function to call to wrap the search when search is failed.
169If nil, move point to the beginning of the buffer for a forward search, 173If nil, move point to the beginning of the buffer for a forward search,
@@ -711,7 +715,9 @@ is treated as a regexp. See \\[isearch-forward] for more info."
711 (null executing-kbd-macro)) 715 (null executing-kbd-macro))
712 (progn 716 (progn
713 (if (not (input-pending-p)) 717 (if (not (input-pending-p))
714 (isearch-message)) 718 (if isearch-message-function
719 (funcall isearch-message-function)
720 (isearch-message)))
715 (if (and isearch-slow-terminal-mode 721 (if (and isearch-slow-terminal-mode
716 (not (or isearch-small-window 722 (not (or isearch-small-window
717 (pos-visible-in-window-p)))) 723 (pos-visible-in-window-p))))
@@ -988,7 +994,7 @@ If first char entered is \\[isearch-yank-word-or-char], then do word search inst
988 isearch-original-minibuffer-message-timeout) 994 isearch-original-minibuffer-message-timeout)
989 (isearch-original-minibuffer-message-timeout 995 (isearch-original-minibuffer-message-timeout
990 isearch-original-minibuffer-message-timeout) 996 isearch-original-minibuffer-message-timeout)
991 ) 997 old-point old-other-end)
992 998
993 ;; Actually terminate isearching until editing is done. 999 ;; Actually terminate isearching until editing is done.
994 ;; This is so that the user can do anything without failure, 1000 ;; This is so that the user can do anything without failure,
@@ -997,6 +1003,10 @@ If first char entered is \\[isearch-yank-word-or-char], then do word search inst
997 (isearch-done t t) 1003 (isearch-done t t)
998 (exit nil)) ; was recursive editing 1004 (exit nil)) ; was recursive editing
999 1005
1006 ;; Save old point and isearch-other-end before reading from minibuffer
1007 ;; that can change their values.
1008 (setq old-point (point) old-other-end isearch-other-end)
1009
1000 (isearch-message) ;; for read-char 1010 (isearch-message) ;; for read-char
1001 (unwind-protect 1011 (unwind-protect
1002 (let* (;; Why does following read-char echo? 1012 (let* (;; Why does following read-char echo?
@@ -1032,6 +1042,14 @@ If first char entered is \\[isearch-yank-word-or-char], then do word search inst
1032 isearch-new-message 1042 isearch-new-message
1033 (mapconcat 'isearch-text-char-description 1043 (mapconcat 'isearch-text-char-description
1034 isearch-new-string ""))) 1044 isearch-new-string "")))
1045
1046 ;; Set point at the start (end) of old match if forward (backward),
1047 ;; so after exiting minibuffer isearch resumes at the start (end)
1048 ;; of this match and can find it again.
1049 (if (and old-other-end (eq old-point (point))
1050 (eq isearch-forward isearch-new-forward))
1051 (goto-char old-other-end))
1052
1035 ;; Always resume isearching by restarting it. 1053 ;; Always resume isearching by restarting it.
1036 (isearch-mode isearch-forward 1054 (isearch-mode isearch-forward
1037 isearch-regexp 1055 isearch-regexp
@@ -1256,10 +1274,13 @@ If search string is empty, just beep."
1256 (ding) 1274 (ding)
1257 (setq isearch-string (substring isearch-string 0 (- (or arg 1))) 1275 (setq isearch-string (substring isearch-string 0 (- (or arg 1)))
1258 isearch-message (mapconcat 'isearch-text-char-description 1276 isearch-message (mapconcat 'isearch-text-char-description
1259 isearch-string "") 1277 isearch-string "")))
1260 ;; Don't move cursor in reverse search. 1278 ;; Use the isearch-other-end as new starting point to be able
1261 isearch-yank-flag t)) 1279 ;; to find the remaining part of the search string again.
1262 (isearch-search-and-update)) 1280 (if isearch-other-end (goto-char isearch-other-end))
1281 (isearch-search)
1282 (isearch-push-state)
1283 (isearch-update))
1263 1284
1264(defun isearch-yank-string (string) 1285(defun isearch-yank-string (string)
1265 "Pull STRING into search string." 1286 "Pull STRING into search string."
@@ -2016,7 +2037,9 @@ Can be changed via `isearch-search-fun-function' for special needs."
2016 2037
2017(defun isearch-search () 2038(defun isearch-search ()
2018 ;; Do the search with the current search string. 2039 ;; Do the search with the current search string.
2019 (isearch-message nil t) 2040 (if isearch-message-function
2041 (funcall isearch-message-function nil t)
2042 (isearch-message nil t))
2020 (if (and (eq isearch-case-fold-search t) search-upper-case) 2043 (if (and (eq isearch-case-fold-search t) search-upper-case)
2021 (setq isearch-case-fold-search 2044 (setq isearch-case-fold-search
2022 (isearch-no-upper-case-p isearch-string isearch-regexp))) 2045 (isearch-no-upper-case-p isearch-string isearch-regexp)))
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index bfc0edba2c1..094b3b02b6f 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -606,8 +606,11 @@ An argument of zero means repeat until error."
606 (unless executing-kbd-macro 606 (unless executing-kbd-macro
607 (end-kbd-macro arg #'kmacro-loop-setup-function) 607 (end-kbd-macro arg #'kmacro-loop-setup-function)
608 (when (and last-kbd-macro (= (length last-kbd-macro) 0)) 608 (when (and last-kbd-macro (= (length last-kbd-macro) 0))
609 (setq last-kbd-macro nil)
609 (message "Ignore empty macro") 610 (message "Ignore empty macro")
610 (kmacro-pop-ring)))) 611 ;; Don't call `kmacro-ring-empty-p' to avoid its messages.
612 (while (and (null last-kbd-macro) kmacro-ring)
613 (kmacro-pop-ring1)))))
611 614
612 615
613;;;###autoload 616;;;###autoload
@@ -795,8 +798,9 @@ may be shaded by a local key binding."
795 ok cmd) 798 ok cmd)
796 (when (= (length key-seq) 1) 799 (when (= (length key-seq) 1)
797 (let ((ch (aref key-seq 0))) 800 (let ((ch (aref key-seq 0)))
798 (if (or (and (>= ch ?0) (<= ch ?9)) 801 (if (and (integerp ch)
799 (and (>= ch ?A) (<= ch ?Z))) 802 (or (and (>= ch ?0) (<= ch ?9))
803 (and (>= ch ?A) (<= ch ?Z))))
800 (setq key-seq (concat "\C-x\C-k" key-seq) 804 (setq key-seq (concat "\C-x\C-k" key-seq)
801 ok t)))) 805 ok t))))
802 (when (and (not (equal key-seq "")) 806 (when (and (not (equal key-seq ""))
diff --git a/lisp/makefile.w32-in b/lisp/makefile.w32-in
index 2833c6b8319..aeb281ae1ac 100644
--- a/lisp/makefile.w32-in
+++ b/lisp/makefile.w32-in
@@ -432,12 +432,13 @@ install:
432# since cp does not preserve time stamps 432# since cp does not preserve time stamps
433install-lisp-SH: 433install-lisp-SH:
434 cp -f *.el "$(INSTALL_DIR)/lisp" 434 cp -f *.el "$(INSTALL_DIR)/lisp"
435 for dir in $(WINS); do mkdir "$(INSTALL_DIR)/lisp/$$dir" && cp -f $$dir/*.el "$(INSTALL_DIR)/lisp/$$dir"; done 435 for dir in $(WINS); do [ -d "$(INSTALL_DIR)/lisp/$$dir" ] || mkdir "$(INSTALL_DIR)/lisp/$$dir"; done
436 for dir in $(WINS); do cp -f $$dir/*.el "$(INSTALL_DIR)/lisp/$$dir"; done
436 for dir in . $(WINS); do cp $$dir/*.elc "$(INSTALL_DIR)/lisp/$$dir"; done 437 for dir in . $(WINS); do cp $$dir/*.elc "$(INSTALL_DIR)/lisp/$$dir"; done
437 438
438install-lisp-CMD: 439install-lisp-CMD:
439 cp -f *.el "$(INSTALL_DIR)/lisp" 440 cp -f *.el "$(INSTALL_DIR)/lisp"
440 for %%f in ($(WINS)) do mkdir "$(INSTALL_DIR)/lisp/%%f" 441 for %%f in ($(WINS)) do if not exist "$(INSTALL_DIR)/lisp/%%f" mkdir "$(INSTALL_DIR)/lisp/%%f"
441 for %%f in ($(WINS)) do cp -f %%f/*.el "$(INSTALL_DIR)/lisp/%%f" 442 for %%f in ($(WINS)) do cp -f %%f/*.el "$(INSTALL_DIR)/lisp/%%f"
442 for %%f in (. $(WINS)) do cp -f %%f/*.elc "$(INSTALL_DIR)/lisp/%%f" 443 for %%f in (. $(WINS)) do cp -f %%f/*.elc "$(INSTALL_DIR)/lisp/%%f"
443 444
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 792233925fc..aa7456ad29a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1528,7 +1528,7 @@ else
1528$uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\"; 1528$uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
1529$gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\"; 1529$gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
1530printf( 1530printf(
1531 \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u %%u t (%%u . %%u) -1)\\n\", 1531 \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) -1)\\n\",
1532 $type, 1532 $type,
1533 $stat[3], 1533 $stat[3],
1534 $uid, 1534 $uid,
@@ -1577,7 +1577,7 @@ for($i = 0; $i < $n; $i++)
1577 $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\"; 1577 $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
1578 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\"; 1578 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
1579 printf( 1579 printf(
1580 \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u %%u t (%%u . %%u) (%%u %%u))\\n\", 1580 \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) (%%u %%u))\\n\",
1581 $filename, 1581 $filename,
1582 $type, 1582 $type,
1583 $stat[3], 1583 $stat[3],
@@ -2390,7 +2390,7 @@ target of the symlink differ."
2390 (tramp-send-command-and-read 2390 (tramp-send-command-and-read
2391 vec 2391 vec
2392 (format 2392 (format
2393 "%s -c '((\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s \"%%A\" t %%i.0 -1)' %s" 2393 "%s -c '((\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s.0 \"%%A\" t %%i.0 -1)' %s"
2394 (tramp-get-remote-stat vec) 2394 (tramp-get-remote-stat vec)
2395 (if (eq id-format 'integer) "%u" "\"%U\"") 2395 (if (eq id-format 'integer) "%u" "\"%U\"")
2396 (if (eq id-format 'integer) "%g" "\"%G\"") 2396 (if (eq id-format 'integer) "%g" "\"%G\"")
@@ -2740,7 +2740,7 @@ of."
2740 (format 2740 (format
2741 (concat 2741 (concat
2742 "cd %s; echo \"(\"; (%s -ab | xargs " 2742 "cd %s; echo \"(\"; (%s -ab | xargs "
2743 "%s -c '(\"%%n\" (\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s \"%%A\" t %%i.0 -1)'); " 2743 "%s -c '(\"%%n\" (\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s.0 \"%%A\" t %%i.0 -1)'); "
2744 "echo \")\"") 2744 "echo \")\"")
2745 (tramp-shell-quote-argument localname) 2745 (tramp-shell-quote-argument localname)
2746 (tramp-get-ls-command vec) 2746 (tramp-get-ls-command vec)
@@ -6253,6 +6253,11 @@ Return ATTR."
6253 (setcar (nthcdr 6 attr) 6253 (setcar (nthcdr 6 attr)
6254 (list (floor (nth 6 attr) 65536) 6254 (list (floor (nth 6 attr) 65536)
6255 (floor (mod (nth 6 attr) 65536))))) 6255 (floor (mod (nth 6 attr) 65536)))))
6256 ;; Convert file size.
6257 (when (< (nth 7 attr) 0)
6258 (setcar (nthcdr 7 attr) -1))
6259 (when (and (floatp (nth 7 attr)) (<= (nth 7 attr) most-positive-fixnum))
6260 (setcar (nthcdr 7 attr) (round (nth 7 attr))))
6256 ;; Convert file mode bits to string. 6261 ;; Convert file mode bits to string.
6257 (unless (stringp (nth 8 attr)) 6262 (unless (stringp (nth 8 attr))
6258 (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr)))) 6263 (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr))))
@@ -6551,8 +6556,7 @@ necessary only. This function will be used in file name completion."
6551 (and 6556 (and
6552 dl 6557 dl
6553 (not 6558 (not
6554 (string-equal 6559 (string-equal result (expand-file-name cmd (car dl)))))
6555 result (expand-file-name-as-directory cmd (car dl)))))
6556 (setq dl (cdr dl))) 6560 (setq dl (cdr dl)))
6557 (setq dl (cdr dl)))))) 6561 (setq dl (cdr dl))))))
6558 (tramp-error vec 'file-error "Couldn't find a proper `ls' command"))))) 6562 (tramp-error vec 'file-error "Couldn't find a proper `ls' command")))))
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index f7961ee267d..eff6a2a772d 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -30,14 +30,14 @@
30;; "autoconf && ./configure" to change them. (X)Emacs version check is defined 30;; "autoconf && ./configure" to change them. (X)Emacs version check is defined
31;; in macro AC_EMACS_INFO of aclocal.m4; should be changed only there. 31;; in macro AC_EMACS_INFO of aclocal.m4; should be changed only there.
32 32
33(defconst tramp-version "2.1.10-pre" 33(defconst tramp-version "2.1.10"
34 "This version of Tramp.") 34 "This version of Tramp.")
35 35
36(defconst tramp-bug-report-address "tramp-devel@gnu.org" 36(defconst tramp-bug-report-address "tramp-devel@gnu.org"
37 "Email address to send bug reports to.") 37 "Email address to send bug reports to.")
38 38
39;; Check for (X)Emacs version. 39;; Check for (X)Emacs version.
40(let ((x (if (or (< emacs-major-version 21) (and (featurep 'xemacs) (< emacs-minor-version 4))) (format "Tramp 2.1.10-pre is not fit for %s" (when (string-match "^.*$" (emacs-version)) (match-string 0 (emacs-version)))) "ok"))) 40(let ((x (if (or (< emacs-major-version 21) (and (featurep 'xemacs) (< emacs-minor-version 4))) (format "Tramp 2.1.10 is not fit for %s" (when (string-match "^.*$" (emacs-version)) (match-string 0 (emacs-version)))) "ok")))
41 (unless (string-match "\\`ok\\'" x) (error x))) 41 (unless (string-match "\\`ok\\'" x) (error x)))
42 42
43(provide 'trampver) 43(provide 'trampver)
diff --git a/lisp/pcvs.el b/lisp/pcvs.el
index 006b2cd905b..12ad6f5e2a0 100644
--- a/lisp/pcvs.el
+++ b/lisp/pcvs.el
@@ -2207,6 +2207,10 @@ With prefix argument, prompt for cvs flags."
2207 (dolist (fi (cvs-mode-marked nil nil)) 2207 (dolist (fi (cvs-mode-marked nil nil))
2208 (let* ((default-directory (cvs-expand-dir-name (cvs-fileinfo->dir fi))) 2208 (let* ((default-directory (cvs-expand-dir-name (cvs-fileinfo->dir fi)))
2209 (buffer-file-name (expand-file-name (cvs-fileinfo->file fi)))) 2209 (buffer-file-name (expand-file-name (cvs-fileinfo->file fi))))
2210 (if (file-directory-p buffer-file-name)
2211 ;; Be careful to use a directory name, otherwise add-log starts
2212 ;; looking for a ChangeLog file in the parent dir.
2213 (setq buffer-file-name (file-name-as-directory buffer-file-name)))
2210 (kill-local-variable 'change-log-default-name) 2214 (kill-local-variable 'change-log-default-name)
2211 (save-excursion (add-change-log-entry-other-window))))) 2215 (save-excursion (add-change-log-entry-other-window)))))
2212 2216
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 94def936fb9..0c57e6f55b1 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -607,7 +607,9 @@ Faces `compilation-error-face', `compilation-warning-face',
607 607
608(defcustom compilation-auto-jump-to-first-error nil 608(defcustom compilation-auto-jump-to-first-error nil
609 "If non-nil, automatically jump to the first error after `compile'." 609 "If non-nil, automatically jump to the first error after `compile'."
610 :type 'boolean) 610 :type 'boolean
611 :group 'compilation
612 :version "23.1")
611 613
612(defvar compilation-auto-jump-to-next nil 614(defvar compilation-auto-jump-to-next nil
613 "If non-nil, automatically jump to the next error encountered.") 615 "If non-nil, automatically jump to the next error encountered.")
@@ -934,7 +936,7 @@ to a function that generates a unique name."
934 (unless (equal command (eval compile-command)) 936 (unless (equal command (eval compile-command))
935 (setq compile-command command)) 937 (setq compile-command command))
936 (save-some-buffers (not compilation-ask-about-save) nil) 938 (save-some-buffers (not compilation-ask-about-save) nil)
937 (setq compilation-directory default-directory) 939 (setq-default compilation-directory default-directory)
938 (compilation-start command comint)) 940 (compilation-start command comint))
939 941
940;; run compile with the default command line 942;; run compile with the default command line
@@ -944,10 +946,7 @@ If this is run in a Compilation mode buffer, re-use the arguments from the
944original use. Otherwise, recompile using `compile-command'." 946original use. Otherwise, recompile using `compile-command'."
945 (interactive) 947 (interactive)
946 (save-some-buffers (not compilation-ask-about-save) nil) 948 (save-some-buffers (not compilation-ask-about-save) nil)
947 (let ((default-directory 949 (let ((default-directory (or compilation-directory default-directory)))
948 (or (and (not (eq major-mode (nth 1 compilation-arguments)))
949 compilation-directory)
950 default-directory)))
951 (apply 'compilation-start (or compilation-arguments 950 (apply 'compilation-start (or compilation-arguments
952 `(,(eval compile-command)))))) 951 `(,(eval compile-command))))))
953 952
@@ -1042,6 +1041,10 @@ Returns the compilation buffer created."
1042 (buffer-disable-undo (current-buffer)) 1041 (buffer-disable-undo (current-buffer))
1043 ;; first transfer directory from where M-x compile was called 1042 ;; first transfer directory from where M-x compile was called
1044 (setq default-directory thisdir) 1043 (setq default-directory thisdir)
1044 ;; Remember the original dir, so we can use it when we recompile.
1045 ;; default-directory' can't be used reliably for that because it may be
1046 ;; affected by the special handling of "cd ...;".
1047 (set (make-local-variable 'compilation-directory) thisdir)
1045 ;; Make compilation buffer read-only. The filter can still write it. 1048 ;; Make compilation buffer read-only. The filter can still write it.
1046 ;; Clear out the compilation buffer. 1049 ;; Clear out the compilation buffer.
1047 (let ((inhibit-read-only t) 1050 (let ((inhibit-read-only t)
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 4903d7d26ec..7e353247b04 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -325,11 +325,6 @@ Return nil if we cannot, non-nil if we can."
325 (or (nth 2 (flymake-get-file-name-mode-and-masks file-name)) 325 (or (nth 2 (flymake-get-file-name-mode-and-masks file-name))
326 'flymake-get-real-file-name)) 326 'flymake-get-real-file-name))
327 327
328(defcustom flymake-buildfile-dirs '("." ".." "../.." "../../.." "../../../.." "../../../../.." "../../../../../.." "../../../../../../.." "../../../../../../../.." "../../../../../../../../.." "../../../../../../../../../.." "../../../../../../../../../../..")
329 "Dirs to look for buildfile."
330 :group 'flymake
331 :type '(repeat (string)))
332
333(defvar flymake-find-buildfile-cache (flymake-makehash 'equal)) 328(defvar flymake-find-buildfile-cache (flymake-makehash 'equal))
334 329
335(defun flymake-get-buildfile-from-cache (dir-name) 330(defun flymake-get-buildfile-from-cache (dir-name)
@@ -346,19 +341,15 @@ Return nil if we cannot, non-nil if we can."
346Buildfile includes Makefile, build.xml etc. 341Buildfile includes Makefile, build.xml etc.
347Return its file name if found, or nil if not found." 342Return its file name if found, or nil if not found."
348 (or (flymake-get-buildfile-from-cache source-dir-name) 343 (or (flymake-get-buildfile-from-cache source-dir-name)
349 (let* ((dirs flymake-buildfile-dirs) 344 (let* ((file (locate-dominating-file
350 (buildfile-dir nil) 345 source-dir-name
351 (found nil)) 346 (concat "\\`" (regexp-quote buildfile-name) "\\'"))))
352 (while (and (not found) dirs) 347 (if file
353 (setq buildfile-dir (concat source-dir-name (car dirs)))
354 (when (file-exists-p (expand-file-name buildfile-name buildfile-dir))
355 (setq found t))
356 (setq dirs (cdr dirs)))
357 (if found
358 (progn 348 (progn
359 (flymake-log 3 "found buildfile at %s/%s" buildfile-dir buildfile-name) 349 (flymake-log 3 "found buildfile at %s" file)
360 (flymake-add-buildfile-to-cache source-dir-name buildfile-dir) 350 (setq file (file-name-directory file))
361 buildfile-dir) 351 (flymake-add-buildfile-to-cache source-dir-name file)
352 file)
362 (progn 353 (progn
363 (flymake-log 3 "buildfile for %s not found" source-dir-name) 354 (flymake-log 3 "buildfile for %s not found" source-dir-name)
364 nil))))) 355 nil)))))
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 24d5eababc6..fd93015ab2c 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -343,6 +343,12 @@ This variable's value takes effect when `grep-compute-defaults' is called.")
343(defvar grep-regexp-history nil) 343(defvar grep-regexp-history nil)
344(defvar grep-files-history '("ch" "el")) 344(defvar grep-files-history '("ch" "el"))
345 345
346(defvar grep-host-defaults-alist nil
347 "Default values depending on target host.
348`grep-compute-defaults' returns default values for every local or
349remote host `grep' runs. These values can differ from host to
350host. Once computed, the default values are kept here in order
351to avoid computing them again.")
346 352
347;;;###autoload 353;;;###autoload
348(defun grep-process-setup () 354(defun grep-process-setup ()
@@ -377,38 +383,51 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
377 383
378;;;###autoload 384;;;###autoload
379(defun grep-compute-defaults () 385(defun grep-compute-defaults ()
380 (let ((host-id 386 ;; Keep default values.
381 (intern (or (file-remote-p default-directory 'host) "localhost")))) 387 (unless grep-host-defaults-alist
388 (add-to-list
389 'grep-host-defaults-alist
390 (cons nil
391 `((grep-command ,grep-command)
392 (grep-template ,grep-template)
393 (grep-use-null-device ,grep-use-null-device)
394 (grep-find-command ,grep-find-command)
395 (grep-find-template ,grep-find-template)
396 (grep-find-use-xargs ,grep-find-use-xargs)
397 (grep-highlight-matches ,grep-highlight-matches)))))
398 (let* ((host-id
399 (intern (or (file-remote-p default-directory 'host) "localhost")))
400 (host-defaults (assq host-id grep-host-defaults-alist))
401 (defaults (assq nil grep-host-defaults-alist)))
382 ;; There are different defaults on different hosts. They must be 402 ;; There are different defaults on different hosts. They must be
383 ;; computed for every host once, then they are kept in the 403 ;; computed for every host once.
384 ;; variables' property host-id for reuse.
385 (setq grep-command 404 (setq grep-command
386 (or (get 'grep-command host-id) 405 (or (cadr (assq 'grep-command host-defaults))
387 (eval (car (get 'grep-command 'standard-value)))) 406 (cadr (assq 'grep-command defaults)))
388 407
389 grep-template 408 grep-template
390 (or (get 'grep-template host-id) 409 (or (cadr (assq 'grep-template host-defaults))
391 (eval (car (get 'grep-template 'standard-value)))) 410 (cadr (assq 'grep-template defaults)))
392 411
393 grep-use-null-device 412 grep-use-null-device
394 (or (get 'grep-use-null-device host-id) 413 (or (cadr (assq 'grep-use-null-device host-defaults))
395 (eval (car (get 'grep-use-null-device 'standard-value)))) 414 (cadr (assq 'grep-use-null-device defaults)))
396 415
397 grep-find-command 416 grep-find-command
398 (or (get 'grep-find-command host-id) 417 (or (cadr (assq 'grep-find-command host-defaults))
399 (eval (car (get 'grep-find-command 'standard-value)))) 418 (cadr (assq 'grep-find-command defaults)))
400 419
401 grep-find-template 420 grep-find-template
402 (or (get 'grep-find-template host-id) 421 (or (cadr (assq 'grep-find-template host-defaults))
403 (eval (car (get 'grep-find-template 'standard-value)))) 422 (cadr (assq 'grep-find-template defaults)))
404 423
405 grep-find-use-xargs 424 grep-find-use-xargs
406 (or (get 'grep-find-use-xargs host-id) 425 (or (cadr (assq 'grep-find-use-xargs host-defaults))
407 (eval (car (get 'grep-find-use-xargs 'standard-value)))) 426 (cadr (assq 'grep-find-use-xargs defaults)))
408 427
409 grep-highlight-matches 428 grep-highlight-matches
410 (or (get 'grep-highlight-matches host-id) 429 (or (cadr (assq 'grep-highlight-matches host-defaults))
411 (eval (car (get 'grep-highlight-matches 'standard-value))))) 430 (cadr (assq 'grep-highlight-matches defaults))))
412 431
413 (unless (or (not grep-use-null-device) (eq grep-use-null-device t)) 432 (unless (or (not grep-use-null-device) (eq grep-use-null-device t))
414 (setq grep-use-null-device 433 (setq grep-use-null-device
@@ -492,13 +511,19 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
492 t)))) 511 t))))
493 512
494 ;; Save defaults for this host. 513 ;; Save defaults for this host.
495 (put 'grep-command host-id grep-command) 514 (setq grep-host-defaults-alist
496 (put 'grep-template host-id grep-template) 515 (delete (assq host-id grep-host-defaults-alist)
497 (put 'grep-use-null-device host-id grep-use-null-device) 516 grep-host-defaults-alist))
498 (put 'grep-find-command host-id grep-find-command) 517 (add-to-list
499 (put 'grep-find-template host-id grep-find-template) 518 'grep-host-defaults-alist
500 (put 'grep-find-use-xargs host-id grep-find-use-xargs) 519 (cons host-id
501 (put 'grep-highlight-matches host-id grep-highlight-matches))) 520 `((grep-command ,grep-command)
521 (grep-template ,grep-template)
522 (grep-use-null-device ,grep-use-null-device)
523 (grep-find-command ,grep-find-command)
524 (grep-find-template ,grep-find-template)
525 (grep-find-use-xargs ,grep-find-use-xargs)
526 (grep-highlight-matches ,grep-highlight-matches))))))
502 527
503(defun grep-tag-default () 528(defun grep-tag-default ()
504 (or (and transient-mark-mode mark-active 529 (or (and transient-mark-mode mark-active
diff --git a/lisp/progmodes/octave-inf.el b/lisp/progmodes/octave-inf.el
index 63f9af50c1e..b46510b5ac9 100644
--- a/lisp/progmodes/octave-inf.el
+++ b/lisp/progmodes/octave-inf.el
@@ -42,7 +42,7 @@
42 :group 'octave-inferior) 42 :group 'octave-inferior)
43 43
44(defcustom inferior-octave-prompt 44(defcustom inferior-octave-prompt
45 "\\(^octave\\(\\|.bin\\)\\(-[.0-9]+\\)?\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ " 45 "\\(^octave\\(\\|.bin\\|.exe\\)\\(-[.0-9]+\\)?\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ "
46 "Regexp to match prompts for the inferior Octave process." 46 "Regexp to match prompts for the inferior Octave process."
47 :type 'regexp 47 :type 'regexp
48 :group 'octave-inferior) 48 :group 'octave-inferior)
diff --git a/lisp/progmodes/vera-mode.el b/lisp/progmodes/vera-mode.el
index 7117ffd15e8..c70ec7eab6c 100644
--- a/lisp/progmodes/vera-mode.el
+++ b/lisp/progmodes/vera-mode.el
@@ -48,7 +48,7 @@
48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
49;; Documentation 49;; Documentation
50 50
51;; See comment string of function `vera-mode' or type `C-c C-h' in Emacs. 51;; See comment string of function `vera-mode' or type `C-h m' in Emacs.
52 52
53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
54;; Installation 54;; Installation
@@ -122,37 +122,37 @@ If nil, TAB always indents current line."
122;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 122;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
123;; Key bindings 123;; Key bindings
124 124
125(defvar vera-mode-map () 125(defvar vera-mode-map
126 (let ((map (make-sparse-keymap)))
127 ;; Backspace/delete key bindings.
128 (define-key map [backspace] 'backward-delete-char-untabify)
129 (unless (boundp 'delete-key-deletes-forward) ; XEmacs variable
130 (define-key map [delete] 'delete-char)
131 (define-key map [(meta delete)] 'kill-word))
132 ;; Standard key bindings.
133 (define-key map "\M-e" 'vera-forward-statement)
134 (define-key map "\M-a" 'vera-backward-statement)
135 (define-key map "\M-\C-e" 'vera-forward-same-indent)
136 (define-key map "\M-\C-a" 'vera-backward-same-indent)
137 ;; Mode specific key bindings.
138 (define-key map "\C-c\t" 'indent-according-to-mode)
139 (define-key map "\M-\C-\\" 'vera-indent-region)
140 (define-key map "\C-c\C-c" 'vera-comment-uncomment-region)
141 (define-key map "\C-c\C-f" 'vera-fontify-buffer)
142 (define-key map "\C-c\C-v" 'vera-version)
143 (define-key map "\M-\t" 'tab-to-tab-stop)
144 ;; Electric key bindings.
145 (define-key map "\t" 'vera-electric-tab)
146 (define-key map "\r" 'vera-electric-return)
147 (define-key map " " 'vera-electric-space)
148 (define-key map "{" 'vera-electric-opening-brace)
149 (define-key map "}" 'vera-electric-closing-brace)
150 (define-key map "#" 'vera-electric-pound)
151 (define-key map "*" 'vera-electric-star)
152 (define-key map "/" 'vera-electric-slash)
153 map)
126 "Keymap for Vera Mode.") 154 "Keymap for Vera Mode.")
127 155
128(setq vera-mode-map (make-sparse-keymap))
129;; backspace/delete key bindings
130(define-key vera-mode-map [backspace] 'backward-delete-char-untabify)
131(unless (boundp 'delete-key-deletes-forward) ; XEmacs variable
132 (define-key vera-mode-map [delete] 'delete-char)
133 (define-key vera-mode-map [(meta delete)] 'kill-word))
134;; standard key bindings
135(define-key vera-mode-map "\M-e" 'vera-forward-statement)
136(define-key vera-mode-map "\M-a" 'vera-backward-statement)
137(define-key vera-mode-map "\M-\C-e" 'vera-forward-same-indent)
138(define-key vera-mode-map "\M-\C-a" 'vera-backward-same-indent)
139;; mode specific key bindings
140(define-key vera-mode-map "\C-c\t" 'indent-according-to-mode)
141(define-key vera-mode-map "\M-\C-\\" 'vera-indent-region)
142(define-key vera-mode-map "\C-c\C-c" 'vera-comment-uncomment-region)
143(define-key vera-mode-map "\C-c\C-f" 'vera-fontify-buffer)
144(define-key vera-mode-map "\C-c\C-v" 'vera-version)
145(define-key vera-mode-map "\M-\t" 'tab-to-tab-stop)
146;; electric key bindings
147(define-key vera-mode-map "\t" 'vera-electric-tab)
148(define-key vera-mode-map "\r" 'vera-electric-return)
149(define-key vera-mode-map " " 'vera-electric-space)
150(define-key vera-mode-map "{" 'vera-electric-opening-brace)
151(define-key vera-mode-map "}" 'vera-electric-closing-brace)
152(define-key vera-mode-map "#" 'vera-electric-pound)
153(define-key vera-mode-map "*" 'vera-electric-star)
154(define-key vera-mode-map "/" 'vera-electric-slash)
155
156;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 156;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
157;; Menu 157;; Menu
158 158
@@ -844,21 +844,19 @@ This function does not modify point or mark."
844 844
845(defsubst vera-re-search-forward (regexp &optional bound noerror) 845(defsubst vera-re-search-forward (regexp &optional bound noerror)
846 "Like `re-search-forward', but skips over matches in literals." 846 "Like `re-search-forward', but skips over matches in literals."
847 (store-match-data '(nil nil)) 847 (let (ret)
848 (while (and (re-search-forward regexp bound noerror) 848 (while (and (setq ret (re-search-forward regexp bound noerror))
849 (vera-skip-forward-literal) 849 (vera-skip-forward-literal)
850 (progn (store-match-data '(nil nil)) 850 (if bound (< (point) bound) t)))
851 (if bound (< (point) bound) t)))) 851 ret))
852 (match-end 0))
853 852
854(defsubst vera-re-search-backward (regexp &optional bound noerror) 853(defsubst vera-re-search-backward (regexp &optional bound noerror)
855 "Like `re-search-backward', but skips over matches in literals." 854 "Like `re-search-backward', but skips over matches in literals."
856 (store-match-data '(nil nil)) 855 (let (ret)
857 (while (and (re-search-backward regexp bound noerror) 856 (while (and (setq ret (re-search-backward regexp bound noerror))
858 (vera-skip-backward-literal) 857 (vera-skip-backward-literal)
859 (progn (store-match-data '(nil nil)) 858 (if bound (> (point) bound) t)))
860 (if bound (> (point) bound) t)))) 859 ret))
861 (match-end 0))
862 860
863(defun vera-forward-syntactic-ws (&optional lim skip-directive) 861(defun vera-forward-syntactic-ws (&optional lim skip-directive)
864 "Forward skip of syntactic whitespace." 862 "Forward skip of syntactic whitespace."
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index eae05d2fc4a..68f4d3b198b 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -5408,9 +5408,11 @@ XSTART YSTART are the relative position for the first page in a sheet.")
5408 ps-zebra-stripe-height) 5408 ps-zebra-stripe-height)
5409 "/ZebraColor " 5409 "/ZebraColor "
5410 (ps-format-color ps-zebra-color 0.95) 5410 (ps-format-color ps-zebra-color 0.95)
5411 "def\n/BackgroundColor " 5411 "def\n")
5412 (ps-output "/BackgroundColor "
5412 (ps-format-color ps-default-background 1.0) 5413 (ps-format-color ps-default-background 1.0)
5413 "def\n/UseSetpagedevice " 5414 "def\n")
5415 (ps-output "/UseSetpagedevice "
5414 (if (eq ps-spool-config 'setpagedevice) 5416 (if (eq ps-spool-config 'setpagedevice)
5415 "/setpagedevice where{pop languagelevel 2 eq}{false}ifelse" 5417 "/setpagedevice where{pop languagelevel 2 eq}{false}ifelse"
5416 "false") 5418 "false")
diff --git a/lisp/replace.el b/lisp/replace.el
index 5d4c2a2eba6..32c170430b9 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1408,38 +1408,36 @@ make, or the user didn't cancel the call."
1408 (or map (setq map query-replace-map)) 1408 (or map (setq map query-replace-map))
1409 (and query-flag minibuffer-auto-raise 1409 (and query-flag minibuffer-auto-raise
1410 (raise-frame (window-frame (minibuffer-window)))) 1410 (raise-frame (window-frame (minibuffer-window))))
1411 (let ((nocasify (not (and case-fold-search case-replace 1411 (let* ((case-fold-search
1412 (string-equal from-string 1412 (and case-fold-search
1413 (downcase from-string))))) 1413 (isearch-no-upper-case-p from-string regexp-flag)))
1414 (case-fold-search (and case-fold-search 1414 (nocasify (not (and case-replace case-fold-search)))
1415 (string-equal from-string 1415 (literal (or (not regexp-flag) (eq regexp-flag 'literal)))
1416 (downcase from-string)))) 1416 (search-function (if regexp-flag 're-search-forward 'search-forward))
1417 (literal (or (not regexp-flag) (eq regexp-flag 'literal))) 1417 (search-string from-string)
1418 (search-function (if regexp-flag 're-search-forward 'search-forward)) 1418 (real-match-data nil) ; The match data for the current match.
1419 (search-string from-string) 1419 (next-replacement nil)
1420 (real-match-data nil) ; the match data for the current match 1420 ;; This is non-nil if we know there is nothing for the user
1421 (next-replacement nil) 1421 ;; to edit in the replacement.
1422 ;; This is non-nil if we know there is nothing for the user 1422 (noedit nil)
1423 ;; to edit in the replacement. 1423 (keep-going t)
1424 (noedit nil) 1424 (stack nil)
1425 (keep-going t) 1425 (replace-count 0)
1426 (stack nil) 1426 (nonempty-match nil)
1427 (replace-count 0) 1427
1428 (nonempty-match nil) 1428 ;; If non-nil, it is marker saying where in the buffer to stop.
1429 1429 (limit nil)
1430 ;; If non-nil, it is marker saying where in the buffer to stop. 1430
1431 (limit nil) 1431 ;; Data for the next match. If a cons, it has the same format as
1432 1432 ;; (match-data); otherwise it is t if a match is possible at point.
1433 ;; Data for the next match. If a cons, it has the same format as 1433 (match-again t)
1434 ;; (match-data); otherwise it is t if a match is possible at point. 1434
1435 (match-again t) 1435 (message
1436 1436 (if query-flag
1437 (message 1437 (apply 'propertize
1438 (if query-flag 1438 (substitute-command-keys
1439 (apply 'propertize 1439 "Query replacing %s with %s: (\\<query-replace-map>\\[help] for help) ")
1440 (substitute-command-keys 1440 minibuffer-prompt-properties))))
1441 "Query replacing %s with %s: (\\<query-replace-map>\\[help] for help) ")
1442 minibuffer-prompt-properties))))
1443 1441
1444 ;; If region is active, in Transient Mark mode, operate on region. 1442 ;; If region is active, in Transient Mark mode, operate on region.
1445 (when start 1443 (when start
diff --git a/lisp/ses.el b/lisp/ses.el
index 4f51c803de1..c729ca4b432 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -1470,17 +1470,22 @@ Narrows the buffer to show only the print area. Gives it `read-only' and
1470 (overlay-put ses--curcell-overlay 'face 'underline)) 1470 (overlay-put ses--curcell-overlay 'face 'underline))
1471 1471
1472(defun ses-cleanup () 1472(defun ses-cleanup ()
1473 "Cleanup when changing a buffer from SES mode to something else. Delete 1473 "Cleanup when changing a buffer from SES mode to something else.
1474overlay, remove special text properties." 1474Delete overlays, remove special text properties."
1475 (widen) 1475 (widen)
1476 (let ((inhibit-read-only t) 1476 (let ((inhibit-read-only t)
1477 ;; When reverting, hide the buffer name, otherwise Emacs will ask
1478 ;; the user "the file is modified, do you really want to make
1479 ;; modifications to this buffer", where the "modifications" refer to
1480 ;; the irrelevant set-text-properties below.
1481 (buffer-file-name nil)
1477 (was-modified (buffer-modified-p))) 1482 (was-modified (buffer-modified-p)))
1478 ;;Delete read-only, keymap, and intangible properties 1483 ;;Delete read-only, keymap, and intangible properties
1479 (set-text-properties (point-min) (point-max) nil) 1484 (set-text-properties (point-min) (point-max) nil)
1480 ;;Delete overlay 1485 ;;Delete overlay
1481 (mapc 'delete-overlay (overlays-in (point-min) (point-max))) 1486 (mapc 'delete-overlay (overlays-in (point-min) (point-max)))
1482 (unless was-modified 1487 (unless was-modified
1483 (set-buffer-modified-p nil)))) 1488 (restore-buffer-modified-p nil))))
1484 1489
1485;;;###autoload 1490;;;###autoload
1486(defun ses-mode () 1491(defun ses-mode ()
diff --git a/lisp/simple.el b/lisp/simple.el
index 3bda23ebd1f..e998cfcfd77 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1300,55 +1300,61 @@ makes the search case-sensitive."
1300 1300
1301(defvar minibuffer-temporary-goal-position nil) 1301(defvar minibuffer-temporary-goal-position nil)
1302 1302
1303(defun goto-history-element (nabs)
1304 "Puts element of the minibuffer history in the minibuffer.
1305The argument NABS specifies the absolute history position."
1306 (interactive "p")
1307 (let ((minimum (if minibuffer-default -1 0))
1308 elt minibuffer-returned-to-present)
1309 (if (and (zerop minibuffer-history-position)
1310 (null minibuffer-text-before-history))
1311 (setq minibuffer-text-before-history
1312 (minibuffer-contents-no-properties)))
1313 (if (< nabs minimum)
1314 (if minibuffer-default
1315 (error "End of history; no next item")
1316 (error "End of history; no default available")))
1317 (if (> nabs (length (symbol-value minibuffer-history-variable)))
1318 (error "Beginning of history; no preceding item"))
1319 (unless (memq last-command '(next-history-element
1320 previous-history-element))
1321 (let ((prompt-end (minibuffer-prompt-end)))
1322 (set (make-local-variable 'minibuffer-temporary-goal-position)
1323 (cond ((<= (point) prompt-end) prompt-end)
1324 ((eobp) nil)
1325 (t (point))))))
1326 (goto-char (point-max))
1327 (delete-minibuffer-contents)
1328 (setq minibuffer-history-position nabs)
1329 (cond ((= nabs -1)
1330 (setq elt minibuffer-default))
1331 ((= nabs 0)
1332 (setq elt (or minibuffer-text-before-history ""))
1333 (setq minibuffer-returned-to-present t)
1334 (setq minibuffer-text-before-history nil))
1335 (t (setq elt (nth (1- minibuffer-history-position)
1336 (symbol-value minibuffer-history-variable)))))
1337 (insert
1338 (if (and (eq minibuffer-history-sexp-flag (minibuffer-depth))
1339 (not minibuffer-returned-to-present))
1340 (let ((print-level nil))
1341 (prin1-to-string elt))
1342 elt))
1343 (goto-char (or minibuffer-temporary-goal-position (point-max)))))
1344
1303(defun next-history-element (n) 1345(defun next-history-element (n)
1304 "Puts next element of the minibuffer history in the minibuffer. 1346 "Puts next element of the minibuffer history in the minibuffer.
1305With argument N, it uses the Nth following element." 1347With argument N, it uses the Nth following element."
1306 (interactive "p") 1348 (interactive "p")
1307 (or (zerop n) 1349 (or (zerop n)
1308 (let ((narg (- minibuffer-history-position n)) 1350 (goto-history-element (- minibuffer-history-position n))))
1309 (minimum (if minibuffer-default -1 0))
1310 elt minibuffer-returned-to-present)
1311 (if (and (zerop minibuffer-history-position)
1312 (null minibuffer-text-before-history))
1313 (setq minibuffer-text-before-history
1314 (minibuffer-contents-no-properties)))
1315 (if (< narg minimum)
1316 (if minibuffer-default
1317 (error "End of history; no next item")
1318 (error "End of history; no default available")))
1319 (if (> narg (length (symbol-value minibuffer-history-variable)))
1320 (error "Beginning of history; no preceding item"))
1321 (unless (memq last-command '(next-history-element
1322 previous-history-element))
1323 (let ((prompt-end (minibuffer-prompt-end)))
1324 (set (make-local-variable 'minibuffer-temporary-goal-position)
1325 (cond ((<= (point) prompt-end) prompt-end)
1326 ((eobp) nil)
1327 (t (point))))))
1328 (goto-char (point-max))
1329 (delete-minibuffer-contents)
1330 (setq minibuffer-history-position narg)
1331 (cond ((= narg -1)
1332 (setq elt minibuffer-default))
1333 ((= narg 0)
1334 (setq elt (or minibuffer-text-before-history ""))
1335 (setq minibuffer-returned-to-present t)
1336 (setq minibuffer-text-before-history nil))
1337 (t (setq elt (nth (1- minibuffer-history-position)
1338 (symbol-value minibuffer-history-variable)))))
1339 (insert
1340 (if (and (eq minibuffer-history-sexp-flag (minibuffer-depth))
1341 (not minibuffer-returned-to-present))
1342 (let ((print-level nil))
1343 (prin1-to-string elt))
1344 elt))
1345 (goto-char (or minibuffer-temporary-goal-position (point-max))))))
1346 1351
1347(defun previous-history-element (n) 1352(defun previous-history-element (n)
1348 "Puts previous element of the minibuffer history in the minibuffer. 1353 "Puts previous element of the minibuffer history in the minibuffer.
1349With argument N, it uses the Nth previous element." 1354With argument N, it uses the Nth previous element."
1350 (interactive "p") 1355 (interactive "p")
1351 (next-history-element (- n))) 1356 (or (zerop n)
1357 (goto-history-element (+ minibuffer-history-position n))))
1352 1358
1353(defun next-complete-history-element (n) 1359(defun next-complete-history-element (n)
1354 "Get next history element which completes the minibuffer before the point. 1360 "Get next history element which completes the minibuffer before the point.
@@ -1381,6 +1387,137 @@ Return 0 if current buffer is not a minibuffer."
1381 ;; the buffer; this should be 0 for normal buffers. 1387 ;; the buffer; this should be 0 for normal buffers.
1382 (1- (minibuffer-prompt-end))) 1388 (1- (minibuffer-prompt-end)))
1383 1389
1390;; isearch minibuffer history
1391(add-hook 'minibuffer-setup-hook 'minibuffer-history-isearch-setup)
1392
1393(defvar minibuffer-history-isearch-message-overlay)
1394(make-variable-buffer-local 'minibuffer-history-isearch-message-overlay)
1395
1396(defun minibuffer-history-isearch-setup ()
1397 "Set up a minibuffer for using isearch to search the minibuffer history.
1398Intended to be added to `minibuffer-setup-hook'."
1399 (set (make-local-variable 'isearch-search-fun-function)
1400 'minibuffer-history-isearch-search)
1401 (set (make-local-variable 'isearch-message-function)
1402 'minibuffer-history-isearch-message)
1403 (set (make-local-variable 'isearch-wrap-function)
1404 'minibuffer-history-isearch-wrap)
1405 (set (make-local-variable 'isearch-push-state-function)
1406 'minibuffer-history-isearch-push-state)
1407 (add-hook 'isearch-mode-end-hook 'minibuffer-history-isearch-end nil t))
1408
1409(defun minibuffer-history-isearch-end ()
1410 "Clean up the minibuffer after terminating isearch in the minibuffer."
1411 (if minibuffer-history-isearch-message-overlay
1412 (delete-overlay minibuffer-history-isearch-message-overlay)))
1413
1414(defun minibuffer-history-isearch-search ()
1415 "Return the proper search function, for isearch in minibuffer history."
1416 (cond
1417 (isearch-word
1418 (if isearch-forward 'word-search-forward 'word-search-backward))
1419 (t
1420 (lambda (string bound noerror)
1421 (let ((search-fun
1422 ;; Use standard functions to search within minibuffer text
1423 (cond
1424 (isearch-regexp
1425 (if isearch-forward 're-search-forward 're-search-backward))
1426 (t
1427 (if isearch-forward 'search-forward 'search-backward))))
1428 found)
1429 ;; Avoid lazy-highlighting matches in the minibuffer prompt when
1430 ;; searching forward. Lazy-highlight calls this lambda with the
1431 ;; bound arg, so skip the minibuffer prompt.
1432 (if (and bound isearch-forward (< (point) (minibuffer-prompt-end)))
1433 (goto-char (minibuffer-prompt-end)))
1434 (or
1435 ;; 1. First try searching in the initial minibuffer text
1436 (funcall search-fun string
1437 (if isearch-forward bound (minibuffer-prompt-end))
1438 noerror)
1439 ;; 2. If the above search fails, start putting next/prev history
1440 ;; elements in the minibuffer successively, and search the string
1441 ;; in them. Do this only when bound is nil (i.e. not while
1442 ;; lazy-highlighting search strings in the current minibuffer text).
1443 (unless bound
1444 (condition-case nil
1445 (progn
1446 (while (not found)
1447 (cond (isearch-forward
1448 (next-history-element 1)
1449 (goto-char (minibuffer-prompt-end)))
1450 (t
1451 (previous-history-element 1)
1452 (goto-char (point-max))))
1453 (setq isearch-barrier (point) isearch-opoint (point))
1454 ;; After putting the next/prev history element, search
1455 ;; the string in them again, until next-history-element
1456 ;; or previous-history-element raises an error at the
1457 ;; beginning/end of history.
1458 (setq found (funcall search-fun string
1459 (unless isearch-forward
1460 ;; For backward search, don't search
1461 ;; in the minibuffer prompt
1462 (minibuffer-prompt-end))
1463 noerror)))
1464 ;; Return point of the new search result
1465 (point))
1466 ;; Return nil when next(prev)-history-element fails
1467 (error nil)))))))))
1468
1469(defun minibuffer-history-isearch-message (&optional c-q-hack ellipsis)
1470 "Display the minibuffer history search prompt.
1471If there are no search errors, this function displays an overlay with
1472the isearch prompt which replaces the original minibuffer prompt.
1473Otherwise, it displays the standard isearch message returned from
1474`isearch-message'."
1475 (if (not (and (minibufferp) isearch-success (not isearch-error)))
1476 ;; Use standard function `isearch-message' when not in the minibuffer,
1477 ;; or search fails, or has an error (like incomplete regexp).
1478 ;; This function overwrites minibuffer text with isearch message,
1479 ;; so it's possible to see what is wrong in the search string.
1480 (isearch-message c-q-hack ellipsis)
1481 ;; Otherwise, put the overlay with the standard isearch prompt over
1482 ;; the initial minibuffer prompt.
1483 (if (overlayp minibuffer-history-isearch-message-overlay)
1484 (move-overlay minibuffer-history-isearch-message-overlay
1485 (point-min) (minibuffer-prompt-end))
1486 (setq minibuffer-history-isearch-message-overlay
1487 (make-overlay (point-min) (minibuffer-prompt-end)))
1488 (overlay-put minibuffer-history-isearch-message-overlay 'evaporate t))
1489 (overlay-put minibuffer-history-isearch-message-overlay
1490 'display (isearch-message-prefix c-q-hack ellipsis))
1491 ;; And clear any previous isearch message.
1492 (message "")))
1493
1494(defun minibuffer-history-isearch-wrap ()
1495 "Wrap the minibuffer history search when search is failed.
1496Move point to the first history element for a forward search,
1497or to the last history element for a backward search."
1498 (unless isearch-word
1499 ;; When `minibuffer-history-isearch-search' fails on reaching the
1500 ;; beginning/end of the history, wrap the search to the first/last
1501 ;; minibuffer history element.
1502 (if isearch-forward
1503 (goto-history-element (length (symbol-value minibuffer-history-variable)))
1504 (goto-history-element 0))
1505 (setq isearch-success t))
1506 (goto-char (if isearch-forward (minibuffer-prompt-end) (point-max))))
1507
1508(defun minibuffer-history-isearch-push-state ()
1509 "Save a function restoring the state of minibuffer history search.
1510Save `minibuffer-history-position' to the additional state parameter
1511in the search status stack."
1512 `(lambda (cmd)
1513 (minibuffer-history-isearch-pop-state cmd ,minibuffer-history-position)))
1514
1515(defun minibuffer-history-isearch-pop-state (cmd hist-pos)
1516 "Restore the minibuffer history search state.
1517Go to the history element by the absolute history position `hist-pos'."
1518 (goto-history-element hist-pos))
1519
1520
1384;Put this on C-x u, so we can force that rather than C-_ into startup msg 1521;Put this on C-x u, so we can force that rather than C-_ into startup msg
1385(defalias 'advertised-undo 'undo) 1522(defalias 'advertised-undo 'undo)
1386 1523
diff --git a/lisp/startup.el b/lisp/startup.el
index 9e2d211ea1e..2242de90acb 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -144,7 +144,7 @@ This is normally copied from `default-directory' when Emacs starts.")
144 ("--foreground-color" 1 x-handle-switch foreground-color) 144 ("--foreground-color" 1 x-handle-switch foreground-color)
145 ("--background-color" 1 x-handle-switch background-color) 145 ("--background-color" 1 x-handle-switch background-color)
146 ("--mouse-color" 1 x-handle-switch mouse-color) 146 ("--mouse-color" 1 x-handle-switch mouse-color)
147 ("--no-bitmap-icon" 0 x-handle-switch icon-type nil) 147 ("--no-bitmap-icon" 0 x-handle-no-bitmap-icon)
148 ("--iconic" 0 x-handle-iconic) 148 ("--iconic" 0 x-handle-iconic)
149 ("--xrm" 1 x-handle-xrm-switch) 149 ("--xrm" 1 x-handle-xrm-switch)
150 ("--cursor-color" 1 x-handle-switch cursor-color) 150 ("--cursor-color" 1 x-handle-switch cursor-color)
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 5f30a1e8117..b46cfe5371b 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -672,7 +672,7 @@ appear on disk when you save the tar-file's buffer."
672 ((eq link-p 38) "a volume header") 672 ((eq link-p 38) "a volume header")
673 ((eq link-p 55) "an extended pax header") 673 ((eq link-p 55) "an extended pax header")
674 (t "a link")))) 674 (t "a link"))))
675 (if (zerop size) (error "This is a zero-length file")) 675 (if (zerop size) (message "This is a zero-length file"))
676 descriptor)) 676 descriptor))
677 677
678(defun tar-mouse-extract (event) 678(defun tar-mouse-extract (event)
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index c779cd98ae7..5fcf90711e8 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -129,6 +129,9 @@
129 initial-frame-alist) 129 initial-frame-alist)
130 x-invocation-args (cdr x-invocation-args))))))) 130 x-invocation-args (cdr x-invocation-args)))))))
131 131
132(defun x-handle-no-bitmap-icon (switch)
133 (setq default-frame-alist (cons '(icon-type) default-frame-alist)))
134
132;; Make -iconic apply only to the initial frame! 135;; Make -iconic apply only to the initial frame!
133(defun x-handle-iconic (switch) 136(defun x-handle-iconic (switch)
134 (setq initial-frame-alist 137 (setq initial-frame-alist
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 343a7c5a947..200d271d631 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -1331,10 +1331,8 @@ Valid actions are: readable, restore, read, kill, write."
1331 (put docstruct-symbol 'modified nil) 1331 (put docstruct-symbol 'modified nil)
1332 (save-excursion 1332 (save-excursion
1333 (if (file-writable-p file) 1333 (if (file-writable-p file)
1334 (progn 1334 (with-temp-file file
1335 (message "Writing parse file %s" (abbreviate-file-name file)) 1335 (message "Writing parse file %s" (abbreviate-file-name file))
1336 (find-file file)
1337 (erase-buffer)
1338 (insert (format ";; RefTeX parse info file\n")) 1336 (insert (format ";; RefTeX parse info file\n"))
1339 (insert (format ";; File: %s\n" master)) 1337 (insert (format ";; File: %s\n" master))
1340 (insert (format ";; User: %s (%s)\n\n" 1338 (insert (format ";; User: %s (%s)\n\n"
@@ -1357,9 +1355,7 @@ Valid actions are: readable, restore, read, kill, write."
1357 ) 1355 )
1358 (t (print x)))) 1356 (t (print x))))
1359 list)) 1357 list))
1360 (insert "))\n\n") 1358 (insert "))\n\n"))
1361 (save-buffer 0)
1362 (kill-buffer (current-buffer)))
1363 (error "Cannot write to file %s" file))) 1359 (error "Cannot write to file %s" file)))
1364 t)))) 1360 t))))
1365 1361
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index eb1429b41e5..748680ab8f7 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -249,7 +249,7 @@ Normally set to either `plain-tex-mode' or `latex-mode'."
249 :group 'tex) 249 :group 'tex)
250(put 'tex-fontify-script 'safe-local-variable 'booleanp) 250(put 'tex-fontify-script 'safe-local-variable 'booleanp)
251 251
252(defcustom tex-font-script-display '(-0.3 . 0.3) 252(defcustom tex-font-script-display '(-0.2 . 0.2)
253 "Display specification for subscript and superscript content. 253 "Display specification for subscript and superscript content.
254The car is used for subscript, the cdr is used for superscripts." 254The car is used for subscript, the cdr is used for superscripts."
255 :group 'tex 255 :group 'tex
@@ -675,11 +675,11 @@ An alternative value is \" . \", if you use a font with a narrow period."
675 (setq beg next)))) 675 (setq beg next))))
676 676
677(defface superscript 677(defface superscript
678 '((t :height 0.8)) ;; :raise 0.3 678 '((t :height 0.8)) ;; :raise 0.2
679 "Face used for superscripts." 679 "Face used for superscripts."
680 :group 'tex) 680 :group 'tex)
681(defface subscript 681(defface subscript
682 '((t :height 0.8)) ;; :raise -0.3 682 '((t :height 0.8)) ;; :raise -0.2
683 "Face used for subscripts." 683 "Face used for subscripts."
684 :group 'tex) 684 :group 'tex)
685 685
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 7c97579ab6e..6a52d751c5b 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -431,11 +431,17 @@ where
431 (def-fun (nth 0 kdf)) 431 (def-fun (nth 0 kdf))
432 (def-fun-txt (format "%s" def-fun)) 432 (def-fun-txt (format "%s" def-fun))
433 (rem-fun (command-remapping def-fun)) 433 (rem-fun (command-remapping def-fun))
434 ;; Handle prefix definitions specially
435 ;; so that a mode that rebinds some subcommands
436 ;; won't make it appear that the whole prefix is gone.
434 (key-fun (if (eq def-fun 'ESC-prefix) 437 (key-fun (if (eq def-fun 'ESC-prefix)
435 (lookup-key global-map [27]) 438 (lookup-key global-map [27])
436 (key-binding key))) 439 (if (eq def-fun 'Control-X-prefix)
440 (lookup-key global-map [24])
441 (key-binding key))))
437 (where (where-is-internal (if rem-fun rem-fun def-fun))) 442 (where (where-is-internal (if rem-fun rem-fun def-fun)))
438 cwhere) 443 cwhere)
444
439 (if where 445 (if where
440 (progn 446 (progn
441 (setq cwhere (car where) 447 (setq cwhere (car where)
diff --git a/lisp/uniquify.el b/lisp/uniquify.el
index d79add6899f..c8bbd9256bd 100644
--- a/lisp/uniquify.el
+++ b/lisp/uniquify.el
@@ -28,7 +28,7 @@
28;;; Commentary: 28;;; Commentary:
29 29
30;; Emacs's standard method for making buffer names unique adds <2>, <3>, 30;; Emacs's standard method for making buffer names unique adds <2>, <3>,
31;; etc. to the end of (all but one of) the buffers. This file replaces 31;; etc.. to the end of (all but one of) the buffers. This file replaces
32;; that behavior, for buffers visiting files and dired buffers, with a 32;; that behavior, for buffers visiting files and dired buffers, with a
33;; uniquification that adds parts of the file name until the buffer names 33;; uniquification that adds parts of the file name until the buffer names
34;; are unique. For instance, buffers visiting /u/mernst/tmp/Makefile and 34;; are unique. For instance, buffers visiting /u/mernst/tmp/Makefile and
@@ -95,7 +95,7 @@
95 95
96 96
97(defcustom uniquify-buffer-name-style nil 97(defcustom uniquify-buffer-name-style nil
98 "*If non-nil, buffer names are uniquified with parts of directory name. 98 "If non-nil, buffer names are uniquified with parts of directory name.
99The value determines the buffer name style and is one of `forward', 99The value determines the buffer name style and is one of `forward',
100`reverse', `post-forward', or `post-forward-angle-brackets'. 100`reverse', `post-forward', or `post-forward-angle-brackets'.
101For example, files `/foo/bar/mumble/name' and `/baz/quux/mumble/name' 101For example, files `/foo/bar/mumble/name' and `/baz/quux/mumble/name'
@@ -104,7 +104,9 @@ would have the following buffer names in the various styles:
104 reverse name\\mumble\\bar name\\mumble\\quux 104 reverse name\\mumble\\bar name\\mumble\\quux
105 post-forward name|bar/mumble name|quux/mumble 105 post-forward name|bar/mumble name|quux/mumble
106 post-forward-angle-brackets name<bar/mumble> name<quux/mumble> 106 post-forward-angle-brackets name<bar/mumble> name<quux/mumble>
107 nil name name<2>" 107 nil name name<2>
108Of course, the \"mumble\" part may be stripped as well, depending on the setting
109of `uniquify-strip-common-suffix'."
108 :type '(radio (const forward) 110 :type '(radio (const forward)
109 (const reverse) 111 (const reverse)
110 (const post-forward) 112 (const post-forward)
@@ -119,7 +121,7 @@ would have the following buffer names in the various styles:
119 :group 'uniquify) 121 :group 'uniquify)
120 122
121(defcustom uniquify-ask-about-buffer-names-p nil 123(defcustom uniquify-ask-about-buffer-names-p nil
122 "*If non-nil, permit user to choose names for buffers with same base file. 124 "If non-nil, permit user to choose names for buffers with same base file.
123If the user chooses to name a buffer, uniquification is preempted and no 125If the user chooses to name a buffer, uniquification is preempted and no
124other buffer names are changed." 126other buffer names are changed."
125 :type 'boolean 127 :type 'boolean
@@ -127,7 +129,7 @@ other buffer names are changed."
127 129
128;; The default value matches certain Gnus buffers. 130;; The default value matches certain Gnus buffers.
129(defcustom uniquify-ignore-buffers-re nil 131(defcustom uniquify-ignore-buffers-re nil
130 "*Regular expression matching buffer names that should not be uniquified. 132 "Regular expression matching buffer names that should not be uniquified.
131For instance, set this to \"^draft-[0-9]+$\" to avoid having uniquify rename 133For instance, set this to \"^draft-[0-9]+$\" to avoid having uniquify rename
132draft buffers even if `uniquify-after-kill-buffer-p' is non-nil and the 134draft buffers even if `uniquify-after-kill-buffer-p' is non-nil and the
133visited file name isn't the same as that of the buffer." 135visited file name isn't the same as that of the buffer."
@@ -135,12 +137,12 @@ visited file name isn't the same as that of the buffer."
135 :group 'uniquify) 137 :group 'uniquify)
136 138
137(defcustom uniquify-min-dir-content 0 139(defcustom uniquify-min-dir-content 0
138 "*Minimum number of directory name components included in buffer name." 140 "Minimum number of directory name components included in buffer name."
139 :type 'integer 141 :type 'integer
140 :group 'uniquify) 142 :group 'uniquify)
141 143
142(defcustom uniquify-separator nil 144(defcustom uniquify-separator nil
143 "*String separator for buffer name components. 145 "String separator for buffer name components.
144When `uniquify-buffer-name-style' is `post-forward', separates 146When `uniquify-buffer-name-style' is `post-forward', separates
145base file name from directory part in buffer names (default \"|\"). 147base file name from directory part in buffer names (default \"|\").
146When `uniquify-buffer-name-style' is `reverse', separates all 148When `uniquify-buffer-name-style' is `reverse', separates all
@@ -149,7 +151,7 @@ file name components (default \"\\\")."
149 :group 'uniquify) 151 :group 'uniquify)
150 152
151(defcustom uniquify-trailing-separator-p nil 153(defcustom uniquify-trailing-separator-p nil
152 "*If non-nil, add a file name separator to dired buffer names. 154 "If non-nil, add a file name separator to dired buffer names.
153If `uniquify-buffer-name-style' is `forward', add the separator at the end; 155If `uniquify-buffer-name-style' is `forward', add the separator at the end;
154if it is `reverse', add the separator at the beginning; otherwise, this 156if it is `reverse', add the separator at the beginning; otherwise, this
155variable is ignored." 157variable is ignored."
@@ -255,7 +257,7 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil."
255 (directory-file-name filename)))))))) 257 (directory-file-name filename))))))))
256 258
257(defun uniquify-rerationalize-w/o-cb (fix-list) 259(defun uniquify-rerationalize-w/o-cb (fix-list)
258 "Re-rationalize the buffers in FIX-LIST, but ignoring current-buffer." 260 "Re-rationalize the buffers in FIX-LIST, but ignoring `current-buffer'."
259 (let ((new-fix-list nil)) 261 (let ((new-fix-list nil))
260 (dolist (item fix-list) 262 (dolist (item fix-list)
261 (let ((buf (uniquify-item-buffer item))) 263 (let ((buf (uniquify-item-buffer item)))
diff --git a/lisp/vc-arch.el b/lisp/vc-arch.el
index c6aaa6c8c0b..eb55506ed63 100644
--- a/lisp/vc-arch.el
+++ b/lisp/vc-arch.el
@@ -198,16 +198,17 @@ Only the value `maybe' can be trusted :-(."
198 ;; creates a {arch} directory somewhere. 198 ;; creates a {arch} directory somewhere.
199 file 'arch-root (vc-find-root file "{arch}/=tagging-method")))) 199 file 'arch-root (vc-find-root file "{arch}/=tagging-method"))))
200 200
201(defun vc-arch-register (file &optional rev comment) 201(defun vc-arch-register (files &optional rev comment)
202 (if rev (error "Explicit initial revision not supported for Arch")) 202 (if rev (error "Explicit initial revision not supported for Arch"))
203 (let ((tagmet (vc-arch-tagging-method file))) 203 (dolist (file files)
204 (if (and (memq tagmet '(tagline implicit)) comment-start) 204 (let ((tagmet (vc-arch-tagging-method file)))
205 (with-current-buffer (find-file-noselect file) 205 (if (and (memq tagmet '(tagline implicit)) comment-start)
206 (if (buffer-modified-p) 206 (with-current-buffer (find-file-noselect file)
207 (error "Save %s first" (buffer-name))) 207 (if (buffer-modified-p)
208 (vc-arch-add-tagline) 208 (error "Save %s first" (buffer-name)))
209 (save-buffer)) 209 (vc-arch-add-tagline)
210 (vc-arch-command nil 0 file "add")))) 210 (save-buffer)))))
211 (vc-arch-command nil 0 files "add"))
211 212
212(defun vc-arch-registered (file) 213(defun vc-arch-registered (file)
213 ;; Don't seriously check whether it's source or not. Checking would 214 ;; Don't seriously check whether it's source or not. Checking would
@@ -371,42 +372,49 @@ Return non-nil if FILE is unchanged."
371 372
372(defun vc-arch-checkout-model (file) 'implicit) 373(defun vc-arch-checkout-model (file) 'implicit)
373 374
374(defun vc-arch-checkin (file rev comment) 375(defun vc-arch-checkin (files rev comment)
375 (if rev (error "Committing to a specific revision is unsupported")) 376 (if rev (error "Committing to a specific revision is unsupported"))
376 (let ((summary (file-relative-name file (vc-arch-root file)))) 377 ;; FIXME: This implementation probably only works for singleton filesets
378 (let ((summary (file-relative-name (car file) (vc-arch-root (car files)))))
377 ;; Extract a summary from the comment. 379 ;; Extract a summary from the comment.
378 (when (or (string-match "\\`Summary:[ \t]*\\(.*[^ \t\n]\\)\\([ \t]*\n\\)*" comment) 380 (when (or (string-match "\\`Summary:[ \t]*\\(.*[^ \t\n]\\)\\([ \t]*\n\\)*" comment)
379 (string-match "\\`[ \t]*\\(.*[^ \t\n]\\)[ \t]*\\(\n?\\'\\|\n\\([ \t]*\n\\)+\\)" comment)) 381 (string-match "\\`[ \t]*\\(.*[^ \t\n]\\)[ \t]*\\(\n?\\'\\|\n\\([ \t]*\n\\)+\\)" comment))
380 (setq summary (match-string 1 comment)) 382 (setq summary (match-string 1 comment))
381 (setq comment (substring comment (match-end 0)))) 383 (setq comment (substring comment (match-end 0))))
382 (vc-arch-command nil 0 file "commit" "-s" summary "-L" comment "--" 384 (vc-arch-command nil 0 files "commit" "-s" summary "-L" comment "--"
383 (vc-switches 'Arch 'checkin)))) 385 (vc-switches 'Arch 'checkin))))
384 386
385(defun vc-arch-diff (file &optional oldvers newvers buffer) 387(defun vc-arch-diff (files &optional oldvers newvers buffer)
386 "Get a difference report using Arch between two versions of FILE." 388 "Get a difference report using Arch between two versions of FILES."
387 (if (and newvers 389 ;; FIXME: This implementation only works for singleton filesets. To make
388 (vc-up-to-date-p file) 390 ;; it work for more cases, we have to either call `file-diffs' manually on
389 (equal newvers (vc-workfile-version file))) 391 ;; each and every `file' in the fileset, or use `changes --diffs' (and
390 ;; Newvers is the base revision and the current file is unchanged, 392 ;; variants) and maybe filter the output with `filterdiff' to only include
391 ;; so we can diff with the current file. 393 ;; the files in which we're interested.
392 (setq newvers nil)) 394 (let ((file (car files)))
393 (if newvers 395 (if (and newvers
394 (error "Diffing specific revisions not implemented") 396 (vc-up-to-date-p file)
395 (let* ((async (and (not vc-disable-async-diff) (fboundp 'start-process))) 397 (equal newvers (vc-workfile-version file)))
396 ;; Run the command from the root dir. 398 ;; Newvers is the base revision and the current file is unchanged,
397 (default-directory (vc-arch-root file)) 399 ;; so we can diff with the current file.
398 (status 400 (setq newvers nil))
399 (vc-arch-command 401 (if newvers
400 (or buffer "*vc-diff*") 402 (error "Diffing specific revisions not implemented")
401 (if async 'async 1) 403 (let* ((async (and (not vc-disable-async-diff) (fboundp 'start-process)))
402 nil "file-diffs" 404 ;; Run the command from the root dir.
403 ;; Arch does not support the typical flags. 405 (default-directory (vc-arch-root file))
404 ;; (vc-switches 'Arch 'diff) 406 (status
405 (file-relative-name file) 407 (vc-arch-command
406 (if (equal oldvers (vc-workfile-version file)) 408 (or buffer "*vc-diff*")
407 nil 409 (if async 'async 1)
408 oldvers)))) 410 nil "file-diffs"
409 (if async 1 status)))) ; async diff, pessimistic assumption. 411 ;; Arch does not support the typical flags.
412 ;; (vc-switches 'Arch 'diff)
413 (file-relative-name file)
414 (if (equal oldvers (vc-workfile-version file))
415 nil
416 oldvers))))
417 (if async 1 status))))) ; async diff, pessimistic assumption.
410 418
411(defun vc-arch-delete-file (file) 419(defun vc-arch-delete-file (file)
412 (vc-arch-command nil 0 file "rm")) 420 (vc-arch-command nil 0 file "rm"))
diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el
index 583816c4cf5..dc8004c25a8 100644
--- a/lisp/vc-bzr.el
+++ b/lisp/vc-bzr.el
@@ -90,7 +90,7 @@
90 90
91;; since v0.9, bzr supports removing the progress indicators 91;; since v0.9, bzr supports removing the progress indicators
92;; by setting environment variable BZR_PROGRESS_BAR to "none". 92;; by setting environment variable BZR_PROGRESS_BAR to "none".
93(defun vc-bzr-command (bzr-command buffer okstatus file &rest args) 93(defun vc-bzr-command (bzr-command buffer okstatus file-or-list &rest args)
94 "Wrapper round `vc-do-command' using `vc-bzr-program' as COMMAND. 94 "Wrapper round `vc-do-command' using `vc-bzr-program' as COMMAND.
95Invoke the bzr command adding `BZR_PROGRESS_BAR=none' to the environment." 95Invoke the bzr command adding `BZR_PROGRESS_BAR=none' to the environment."
96 (let ((process-environment 96 (let ((process-environment
@@ -103,7 +103,7 @@ Invoke the bzr command adding `BZR_PROGRESS_BAR=none' to the environment."
103 ;; This is redundant because vc-do-command does it already. --Stef 103 ;; This is redundant because vc-do-command does it already. --Stef
104 (process-connection-type nil)) 104 (process-connection-type nil))
105 (apply 'vc-do-command buffer okstatus vc-bzr-program 105 (apply 'vc-do-command buffer okstatus vc-bzr-program
106 file bzr-command (append vc-bzr-program-args args)))) 106 file-or-list bzr-command (append vc-bzr-program-args args))))
107 107
108 108
109;;;###autoload 109;;;###autoload
@@ -196,12 +196,16 @@ Return nil if there isn't one."
196(defun vc-bzr-checkout-model (file) 196(defun vc-bzr-checkout-model (file)
197 'implicit) 197 'implicit)
198 198
199(defun vc-bzr-register (file &optional rev comment) 199(defun vc-bzr-create-repo ()
200 "Create a new BZR repository."
201 (vc-bzr-command "init" nil 0 nil))
202
203(defun vc-bzr-register (files &optional rev comment)
200 "Register FILE under bzr. 204 "Register FILE under bzr.
201Signal an error unless REV is nil. 205Signal an error unless REV is nil.
202COMMENT is ignored." 206COMMENT is ignored."
203 (if rev (error "Can't register explicit version with bzr")) 207 (if rev (error "Can't register explicit version with bzr"))
204 (vc-bzr-command "add" nil 0 file)) 208 (vc-bzr-command "add" nil 0 files))
205 209
206;; Could run `bzr status' in the directory and see if it succeeds, but 210;; Could run `bzr status' in the directory and see if it succeeds, but
207;; that's relatively expensive. 211;; that's relatively expensive.
@@ -226,11 +230,11 @@ or a superior directory.")
226 "Unregister FILE from bzr." 230 "Unregister FILE from bzr."
227 (vc-bzr-command "remove" nil 0 file)) 231 (vc-bzr-command "remove" nil 0 file))
228 232
229(defun vc-bzr-checkin (file rev comment) 233(defun vc-bzr-checkin (files rev comment)
230 "Check FILE in to bzr with log message COMMENT. 234 "Check FILE in to bzr with log message COMMENT.
231REV non-nil gets an error." 235REV non-nil gets an error."
232 (if rev (error "Can't check in a specific version with bzr")) 236 (if rev (error "Can't check in a specific version with bzr"))
233 (vc-bzr-command "commit" nil 0 file "-m" comment)) 237 (vc-bzr-command "commit" nil 0 files "-m" comment))
234 238
235(defun vc-bzr-checkout (file &optional editable rev destfile) 239(defun vc-bzr-checkout (file &optional editable rev destfile)
236 "Checkout revision REV of FILE from bzr to DESTFILE. 240 "Checkout revision REV of FILE from bzr to DESTFILE.
@@ -271,12 +275,12 @@ EDITABLE is ignored."
271 (2 'change-log-email)) 275 (2 'change-log-email))
272 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face)))))) 276 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face))))))
273 277
274(defun vc-bzr-print-log (file &optional buffer) ; get buffer arg in Emacs 22 278(defun vc-bzr-print-log (files &optional buffer) ; get buffer arg in Emacs 22
275 "Get bzr change log for FILE into specified BUFFER." 279 "Get bzr change log for FILES into specified BUFFER."
276 ;; Fixme: This might need the locale fixing up if things like `revno' 280 ;; Fixme: This might need the locale fixing up if things like `revno'
277 ;; got localized, but certainly it shouldn't use LC_ALL=C. 281 ;; got localized, but certainly it shouldn't use LC_ALL=C.
278 ;; NB. Can't be async -- see `vc-bzr-post-command-function'. 282 ;; NB. Can't be async -- see `vc-bzr-post-command-function'.
279 (vc-bzr-command "log" buffer 0 file) 283 (vc-bzr-command "log" buffer 0 files)
280 ;; FIXME: Until Emacs-23, VC was missing a hook to sort out the mode for 284 ;; FIXME: Until Emacs-23, VC was missing a hook to sort out the mode for
281 ;; the buffer, or at least set the regexps right. 285 ;; the buffer, or at least set the regexps right.
282 (unless (fboundp 'vc-default-log-view-mode) 286 (unless (fboundp 'vc-default-log-view-mode)
@@ -294,16 +298,16 @@ EDITABLE is ignored."
294 298
295(autoload 'vc-diff-switches-list "vc" nil nil t) 299(autoload 'vc-diff-switches-list "vc" nil nil t)
296 300
297(defun vc-bzr-diff (file &optional rev1 rev2 buffer) 301(defun vc-bzr-diff (files &optional rev1 rev2 buffer)
298 "VC bzr backend for diff." 302 "VC bzr backend for diff."
299 (let ((working (vc-workfile-version file))) 303 (let ((working (vc-workfile-version (car files))))
300 (if (and (equal rev1 working) (not rev2)) 304 (if (and (equal rev1 working) (not rev2))
301 (setq rev1 nil)) 305 (setq rev1 nil))
302 (if (and (not rev1) rev2) 306 (if (and (not rev1) rev2)
303 (setq rev1 working)) 307 (setq rev1 working))
304 ;; NB. Can't be async -- see `vc-bzr-post-command-function'. 308 ;; NB. Can't be async -- see `vc-bzr-post-command-function'.
305 ;; bzr diff produces condition code 1 for some reason. 309 ;; bzr diff produces condition code 1 for some reason.
306 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 1 file 310 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 1 files
307 "--diff-options" (mapconcat 'identity (vc-diff-switches-list bzr) 311 "--diff-options" (mapconcat 'identity (vc-diff-switches-list bzr)
308 " ") 312 " ")
309 (when rev1 313 (when rev1
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el
index 22ed10d1286..452d9c16b19 100644
--- a/lisp/vc-cvs.el
+++ b/lisp/vc-cvs.el
@@ -258,14 +258,25 @@ See also variable `vc-cvs-sticky-date-format-string'."
258Compared to the default implementation, this function does two things: 258Compared to the default implementation, this function does two things:
259Handle the special case of a CVS file that is added but not yet 259Handle the special case of a CVS file that is added but not yet
260committed and support display of sticky tags." 260committed and support display of sticky tags."
261 (let ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag)) 261 (let* ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag))
262 (string (if (string= (vc-workfile-version file) "0") 262 help-echo
263 ;; A file that is added but not yet committed. 263 (string
264 "CVS @@" 264 (if (string= (vc-workfile-version file) "0")
265 (vc-default-mode-line-string 'CVS file)))) 265 ;; A file that is added but not yet committed.
266 (if (zerop (length sticky-tag)) 266 (progn
267 string 267 (setq help-echo "Added file (needs commit) under CVS")
268 (concat string "[" sticky-tag "]")))) 268 "CVS @@")
269 (let ((def-ml (vc-default-mode-line-string 'CVS file)))
270 (setq help-echo
271 (get-text-property 0 'help-echo def-ml))
272 def-ml))))
273 (propertize
274 (if (zerop (length sticky-tag))
275 string
276 (setq help-echo (format "%s on the '%s' branch"
277 help-echo sticky-tag))
278 (concat string "[" sticky-tag "]"))
279 'help-echo help-echo)))
269 280
270(defun vc-cvs-dired-state-info (file) 281(defun vc-cvs-dired-state-info (file)
271 "CVS-specific version of `vc-dired-state-info'." 282 "CVS-specific version of `vc-dired-state-info'."
@@ -281,21 +292,21 @@ committed and support display of sticky tags."
281;;; State-changing functions 292;;; State-changing functions
282;;; 293;;;
283 294
284(defun vc-cvs-register (file &optional rev comment) 295(defun vc-cvs-register (files &optional rev comment)
285 "Register FILE into the CVS version-control system. 296 "Register FILES into the CVS version-control system.
286COMMENT can be used to provide an initial description of FILE. 297COMMENT can be used to provide an initial description of FILES.
287 298
288`vc-register-switches' and `vc-cvs-register-switches' are passed to 299`vc-register-switches' and `vc-cvs-register-switches' are passed to
289the CVS command (in that order)." 300the CVS command (in that order)."
290 (when (and (not (vc-cvs-responsible-p file)) 301 (when (and (not (vc-cvs-responsible-p file))
291 (vc-cvs-could-register file)) 302 (vc-cvs-could-register file))
292 ;; Register the directory if needed. 303 ;; Register the directory if needed.
293 (vc-cvs-register (directory-file-name (file-name-directory file)))) 304 (vc-cvs-register (directory-file-name (file-name-directory file))))
294 (apply 'vc-cvs-command nil 0 file 305 (apply 'vc-cvs-command nil 0 files
295 "add" 306 "add"
296 (and comment (string-match "[^\t\n ]" comment) 307 (and comment (string-match "[^\t\n ]" comment)
297 (concat "-m" comment)) 308 (concat "-m" comment))
298 (vc-switches 'CVS 'register))) 309 (vc-switches 'CVS 'register)))
299 310
300(defun vc-cvs-responsible-p (file) 311(defun vc-cvs-responsible-p (file)
301 "Return non-nil if CVS thinks it is responsible for FILE." 312 "Return non-nil if CVS thinks it is responsible for FILE."
@@ -317,17 +328,18 @@ its parents."
317 t (directory-file-name dir)))) 328 t (directory-file-name dir))))
318 (eq dir t))) 329 (eq dir t)))
319 330
320(defun vc-cvs-checkin (file rev comment) 331(defun vc-cvs-checkin (files rev comment)
321 "CVS-specific version of `vc-backend-checkin'." 332 "CVS-specific version of `vc-backend-checkin'."
322 (unless (or (not rev) (vc-cvs-valid-version-number-p rev)) 333 (unless (or (not rev) (vc-cvs-valid-version-number-p rev))
323 (if (not (vc-cvs-valid-symbolic-tag-name-p rev)) 334 (if (not (vc-cvs-valid-symbolic-tag-name-p rev))
324 (error "%s is not a valid symbolic tag name" rev) 335 (error "%s is not a valid symbolic tag name" rev)
325 ;; If the input revison is a valid symbolic tag name, we create it 336 ;; If the input revison is a valid symbolic tag name, we create it
326 ;; as a branch, commit and switch to it. 337 ;; as a branch, commit and switch to it.
327 (apply 'vc-cvs-command nil 0 file "tag" "-b" (list rev)) 338 (apply 'vc-cvs-command nil 0 files "tag" "-b" (list rev))
328 (apply 'vc-cvs-command nil 0 file "update" "-r" (list rev)) 339 (apply 'vc-cvs-command nil 0 files "update" "-r" (list rev))
329 (vc-file-setprop file 'vc-cvs-sticky-tag rev))) 340 (mapc (lambda (file) (vc-file-setprop file 'vc-cvs-sticky-tag rev))
330 (let ((status (apply 'vc-cvs-command nil 1 file 341 files)))
342 (let ((status (apply 'vc-cvs-command nil 1 files
331 "ci" (if rev (concat "-r" rev)) 343 "ci" (if rev (concat "-r" rev))
332 (concat "-m" comment) 344 (concat "-m" comment)
333 (vc-switches 'CVS 'checkin)))) 345 (vc-switches 'CVS 'checkin))))
@@ -337,7 +349,8 @@ its parents."
337 ;; Check checkin problem. 349 ;; Check checkin problem.
338 (cond 350 (cond
339 ((re-search-forward "Up-to-date check failed" nil t) 351 ((re-search-forward "Up-to-date check failed" nil t)
340 (vc-file-setprop file 'vc-state 'needs-merge) 352 (mapc (lambda (file) (vc-file-setprop file 'vc-state 'needs-merge))
353 files)
341 (error (substitute-command-keys 354 (error (substitute-command-keys
342 (concat "Up-to-date check failed: " 355 (concat "Up-to-date check failed: "
343 "type \\[vc-next-action] to merge in changes")))) 356 "type \\[vc-next-action] to merge in changes"))))
@@ -346,20 +359,25 @@ its parents."
346 (goto-char (point-min)) 359 (goto-char (point-min))
347 (shrink-window-if-larger-than-buffer) 360 (shrink-window-if-larger-than-buffer)
348 (error "Check-in failed")))) 361 (error "Check-in failed"))))
349 ;; Update file properties 362 ;; Single-file commit? Then update the version by parsing the buffer.
350 (vc-file-setprop 363 ;; Otherwise we can't necessarily tell what goes with what; clear
351 file 'vc-workfile-version 364 ;; its properties so they have to be refetched.
352 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) 365 (if (= (length files) 1)
353 ;; Forget the checkout model of the file, because we might have 366 (vc-file-setprop
367 (car files) 'vc-workfile-version
368 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2))
369 (mapc (lambda (file) (vc-file-clearprops file)) files))
370 ;; Anyway, forget the checkout model of the file, because we might have
354 ;; guessed wrong when we found the file. After commit, we can 371 ;; guessed wrong when we found the file. After commit, we can
355 ;; tell it from the permissions of the file (see 372 ;; tell it from the permissions of the file (see
356 ;; vc-cvs-checkout-model). 373 ;; vc-cvs-checkout-model).
357 (vc-file-setprop file 'vc-checkout-model nil) 374 (mapc (lambda (file) (vc-file-setprop file 'vc-checkout-model nil))
375 files)
358 376
359 ;; if this was an explicit check-in (does not include creation of 377 ;; if this was an explicit check-in (does not include creation of
360 ;; a branch), remove the sticky tag. 378 ;; a branch), remove the sticky tag.
361 (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev))) 379 (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev)))
362 (vc-cvs-command nil 0 file "update" "-A")))) 380 (vc-cvs-command nil 0 files "update" "-A"))))
363 381
364(defun vc-cvs-find-version (file rev buffer) 382(defun vc-cvs-find-version (file rev buffer)
365 (apply 'vc-cvs-command 383 (apply 'vc-cvs-command
@@ -481,37 +499,30 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
481;;; History functions 499;;; History functions
482;;; 500;;;
483 501
484(defun vc-cvs-print-log (file &optional buffer) 502(defun vc-cvs-print-log (files &optional buffer)
485 "Get change log associated with FILE." 503 "Get change log associated with FILE."
486 (vc-cvs-command 504 (vc-cvs-command
487 buffer 505 buffer
488 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) 506 (if (and (vc-stay-local-p files) (fboundp 'start-process)) 'async 0)
489 file "log")) 507 files "log"))
490 508
491(defun vc-cvs-diff (file &optional oldvers newvers buffer) 509(defun vc-cvs-wash-log ()
510 "Remove all non-comment information from log output."
511 (vc-call-backend 'RCS 'wash-log)
512 nil)
513
514(defun vc-cvs-diff (files &optional oldvers newvers buffer)
492 "Get a difference report using CVS between two versions of FILE." 515 "Get a difference report using CVS between two versions of FILE."
493 (if (string= (vc-workfile-version file) "0") 516 (let* ((async (and (not vc-disable-async-diff)
494 ;; This file is added but not yet committed; there is no master file. 517 (vc-stay-local-p files)
495 (if (or oldvers newvers) 518 (fboundp 'start-process)))
496 (error "No revisions of %s exist" file)
497 ;; We regard this as "changed".
498 ;; Diff it against /dev/null.
499 ;; Note: this is NOT a "cvs diff".
500 (apply 'vc-do-command (or buffer "*vc-diff*")
501 1 "diff" file
502 (append (vc-switches nil 'diff) '("/dev/null")))
503 ;; Even if it's empty, it's locally modified.
504 1)
505 (let* ((async (and (not vc-disable-async-diff)
506 (vc-stay-local-p file)
507 (fboundp 'start-process)))
508 (status (apply 'vc-cvs-command (or buffer "*vc-diff*") 519 (status (apply 'vc-cvs-command (or buffer "*vc-diff*")
509 (if async 'async 1) 520 (if async 'async 1)
510 file "diff" 521 files "diff"
511 (and oldvers (concat "-r" oldvers)) 522 (and oldvers (concat "-r" oldvers))
512 (and newvers (concat "-r" newvers)) 523 (and newvers (concat "-r" newvers))
513 (vc-switches 'CVS 'diff)))) 524 (vc-switches 'CVS 'diff))))
514 (if async 1 status)))) ; async diff, pessimistic assumption 525 (if async 1 status))) ; async diff, pessimistic assumption
515 526
516(defun vc-cvs-diff-tree (dir &optional rev1 rev2) 527(defun vc-cvs-diff-tree (dir &optional rev1 rev2)
517 "Diff all files at and below DIR." 528 "Diff all files at and below DIR."
@@ -683,11 +694,11 @@ If UPDATE is non-nil, then update (resynch) any affected buffers."
683;;; Internal functions 694;;; Internal functions
684;;; 695;;;
685 696
686(defun vc-cvs-command (buffer okstatus file &rest flags) 697(defun vc-cvs-command (buffer okstatus files &rest flags)
687 "A wrapper around `vc-do-command' for use in vc-cvs.el. 698 "A wrapper around `vc-do-command' for use in vc-cvs.el.
688The difference to vc-do-command is that this function always invokes `cvs', 699The difference to vc-do-command is that this function always invokes `cvs',
689and that it passes `vc-cvs-global-switches' to it before FLAGS." 700and that it passes `vc-cvs-global-switches' to it before FLAGS."
690 (apply 'vc-do-command buffer okstatus "cvs" file 701 (apply 'vc-do-command buffer okstatus "cvs" files
691 (if (stringp vc-cvs-global-switches) 702 (if (stringp vc-cvs-global-switches)
692 (cons vc-cvs-global-switches flags) 703 (cons vc-cvs-global-switches flags)
693 (append vc-cvs-global-switches 704 (append vc-cvs-global-switches
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
new file mode 100644
index 00000000000..de6be9af733
--- /dev/null
+++ b/lisp/vc-git.el
@@ -0,0 +1,439 @@
1;;; vc-git.el --- VC backend for the git version control system
2
3;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
4
5;; Author: Alexandre Julliard <julliard@winehq.org>
6;; Keywords: tools
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;; This file contains a VC backend for the git version control
28;; system.
29;;
30
31;;; Installation:
32
33;; To install: put this file on the load-path and add GIT to the list
34;; of supported backends in `vc-handled-backends'; the following line,
35;; placed in your ~/.emacs, will accomplish this:
36;;
37;; (add-to-list 'vc-handled-backends 'GIT)
38
39;;; Todo:
40;; - check if more functions could use vc-git-command instead
41;; of start-process.
42;; - changelog generation
43;; - working with revisions other than HEAD
44
45;; Implement the rest of the vc interface. See the comment at the
46;; beginning of vc.el. The current status is:
47;;
48;; FUNCTION NAME STATUS
49;; BACKEND PROPERTIES
50;; * revision-granularity OK
51;; STATE-QUERYING FUNCTIONS
52;; * registered (file) OK
53;; * state (file) OK
54;; - state-heuristic (file) ?? PROBABLY NOT NEEDED
55;; - dir-state (dir) OK
56;; * workfile-version (file) OK
57;; - latest-on-branch-p (file) ??
58;; * checkout-model (file) OK
59;; - workfile-unchanged-p (file) MAYBE CAN BE SIMPLIFIED
60;; - mode-line-string (file) NOT NEEDED
61;; - dired-state-info (file) OK
62;; STATE-CHANGING FUNCTIONS
63;; * create-repo () OK
64;; * register (files &optional rev comment) OK
65;; - init-version (file) ??
66;; - responsible-p (file) OK
67;; - could-register (file) NEEDED
68;; - receive-file (file rev) ??
69;; - unregister (file) OK
70;; * checkin (files rev comment) OK
71;; * find-version (file rev buffer) OK
72;; * checkout (file &optional editable rev) OK
73;; * revert (file &optional contents-done) OK
74;; - rollback (files) ?? PROBABLY NOT NEEDED
75;; - merge (file rev1 rev2) NEEDED
76;; - merge-news (file) NEEDED
77;; - steal-lock (file &optional version) NOT NEEDED
78;; HISTORY FUNCTIONS
79;; * print-log (files &optional buffer) OK
80;; - log-view-mode () OK
81;; - show-log-entry (version) NOT NEEDED, DEFAULT IS GOOD
82;; - wash-log (file) ??
83;; - logentry-check () ??
84;; - comment-history (file) ??
85;; - update-changelog (files) ??
86;; * diff (file &optional rev1 rev2 buffer) PORT TO NEW VC INTERFACE
87;; - revision-completion-table (file) NEEDED?
88;; - diff-tree (dir &optional rev1 rev2) OK
89;; - annotate-command (file buf &optional rev) OK
90;; - annotate-time () OK
91;; - annotate-current-time () ?? NOT NEEDED
92;; - annotate-extract-revision-at-line () OK
93;; SNAPSHOT SYSTEM
94;; - create-snapshot (dir name branchp) NEEDED
95;; - assign-name (file name) NOT NEEDED
96;; - retrieve-snapshot (dir name update) NEEDED
97;; MISCELLANEOUS
98;; - make-version-backups-p (file) ??
99;; - repository-hostname (dirname) ??
100;; - previous-version (file rev) ??
101;; - next-version (file rev) ??
102;; - check-headers () ??
103;; - clear-headers () ??
104;; - delete-file (file) OK
105;; - rename-file (old new) OK
106;; - find-file-hook () PROBABLY NOT NEEDED
107;; - find-file-not-found-hook () PROBABLY NOT NEEDED
108
109(eval-when-compile (require 'cl) (require 'vc))
110
111(defvar git-commits-coding-system 'utf-8
112 "Default coding system for git commits.")
113
114;; XXX when this backend is considered sufficiently reliable this
115;; should be moved to vc-hooks.el
116(add-to-list 'vc-handled-backends 'GIT)
117(eval-after-load "vc"
118 '(add-to-list 'vc-directory-exclusion-list ".bzr" t))
119
120;;; BACKEND PROPERTIES
121
122(defun vc-git-revision-granularity ()
123 'repository)
124
125;;; STATE-QUERYING FUNCTIONS
126
127;;;###autoload (defun vc-git-registered (file)
128;;;###autoload "Return non-nil if FILE is registered with git."
129;;;###autoload (if (vc-find-root file ".git") ; short cut
130;;;###autoload (progn
131;;;###autoload (load "vc-git")
132;;;###autoload (vc-git-registered file))))
133
134(defun vc-git-registered (file)
135 "Check whether FILE is registered with git."
136 (when (vc-git-root file)
137 (with-temp-buffer
138 (let* ((dir (file-name-directory file))
139 (name (file-relative-name file dir)))
140 (and (ignore-errors
141 (when dir (cd dir))
142 (eq 0 (call-process "git" nil '(t nil) nil "ls-files" "-c" "-z" "--" name)))
143 (let ((str (buffer-string)))
144 (and (> (length str) (length name))
145 (string= (substring str 0 (1+ (length name))) (concat name "\0")))))))))
146
147(defun vc-git-state (file)
148 "Git-specific version of `vc-state'."
149 (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--")))
150 (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} [ADMU]\0[^\0]+\0" diff))
151 'edited
152 'up-to-date)))
153
154(defun vc-git-dir-state (dir)
155 (with-temp-buffer
156 (vc-git-command (current-buffer) nil nil "ls-files" "-t")
157 (goto-char (point-min))
158 (let ((status-char nil)
159 (file nil))
160 (while (not (eobp))
161 (setq status-char (char-after))
162 (setq file
163 (expand-file-name
164 (buffer-substring-no-properties (+ (point) 2) (line-end-position))))
165 (cond
166 ;; The rest of the possible states in "git ls-files -t" output:
167 ;; R removed/deleted
168 ;; K to be killed
169 ;; should not show up in vc-dired, so don't deal with them
170 ;; here.
171 ((eq status-char ?H)
172 (vc-file-setprop file 'vc-state 'up-to-date))
173 ((eq status-char ?M)
174 (vc-file-setprop file 'vc-state 'edited))
175 ((eq status-char ?C)
176 (vc-file-setprop file 'vc-state 'edited))
177 ((eq status-char ??)
178 (vc-file-setprop file 'vc-backend 'none)
179 (vc-file-setprop file 'vc-state 'nil)))
180 (forward-line)))))
181
182(defun vc-git-workfile-version (file)
183 "Git-specific version of `vc-workfile-version'."
184 (let ((str (with-output-to-string
185 (with-current-buffer standard-output
186 (call-process "git" nil '(t nil) nil "symbolic-ref" "HEAD")))))
187 (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
188 (match-string 2 str)
189 str)))
190
191(defun vc-git-checkout-model (file)
192 'implicit)
193
194(defun vc-git-workfile-unchanged-p (file)
195 ;; The reason this does not use the result of vc-git-state is that
196 ;; git-diff-index (used by vc-git-state) doesn't refresh the cached
197 ;; stat info, so if the file has been modified it will always show
198 ;; up as modified in vc-git-state, even if the change has been
199 ;; undone, until git-update-index --refresh is run.
200
201 ;; OTOH the vc-git-workfile-unchanged-p implementation checks the
202 ;; actual content, so it will detect the case of a file reverted
203 ;; back to its original state.
204
205 ;; The ideal implementation would be to refresh the stat cache and
206 ;; then call vc-git-state, but at the moment there's no git command
207 ;; to refresh a single file, so this will have to be added first.
208 (let ((sha1 (vc-git--run-command-string file "hash-object" "--"))
209 (head (vc-git--run-command-string file "ls-tree" "-z" "HEAD" "--")))
210 (and head
211 (string-match "[0-7]\\{6\\} blob \\([0-9a-f]\\{40\\}\\)\t[^\0]+\0" head)
212 (string= (car (split-string sha1 "\n")) (match-string 1 head)))))
213
214(defun vc-git-dired-state-info (file)
215 "Git-specific version of `vc-dired-state-info'."
216 (let ((git-state (vc-state file)))
217 (if (eq git-state 'edited)
218 "(modified)"
219 ;; fall back to the default VC representation
220 (vc-default-dired-state-info 'GIT file))))
221
222;;; STATE-CHANGING FUNCTIONS
223
224(defun vc-git-create-repo ()
225 "Create a new GIT repository."
226 (vc-git-command "init" nil 0 nil))
227
228(defun vc-git-register (files &optional rev comment)
229 "Register FILE into the git version-control system."
230 (vc-git-command nil 0 files "update-index" "--add" "--"))
231
232(defalias 'vc-git-responsible-p 'vc-git-root)
233
234(defun vc-git-unregister (file)
235 (vc-git-command nil 0 file "rm" "-f" "--cached" "--"))
236
237
238(defun vc-git-checkin (files rev comment)
239 (let ((coding-system-for-write git-commits-coding-system))
240 (vc-git-command nil 0 files "commit" "-m" comment "--only" "--")))
241
242(defun vc-git-find-version (file rev buffer)
243 (let ((coding-system-for-read 'binary)
244 (coding-system-for-write 'binary)
245 (fullname (substring
246 (vc-git--run-command-string
247 file "ls-files" "-z" "--full-name" "--")
248 0 -1)))
249 (vc-git-command
250 buffer 0
251 (concat (if rev rev "HEAD") ":" fullname) "cat-file" "blob")))
252
253(defun vc-git-checkout (file &optional editable rev)
254 (vc-git-command nil0 file "checkout" (or rev "HEAD")))
255
256(defun vc-git-revert (file &optional contents-done)
257 "Revert FILE to the version stored in the git repository."
258 (if contents-done
259 (vc-git-command nil 0 file "update-index" "--")
260 (vc-git-command nil 0 file "checkout" "HEAD")))
261
262;;; HISTORY FUNCTIONS
263
264(defun vc-git-print-log (files &optional buffer)
265 "Get change log associated with FILES."
266 (let ((name (file-relative-name file))
267 (coding-system-for-read git-commits-coding-system))
268 ;; `log-view-mode' needs to have the file name in order to function
269 ;; correctly. "git log" does not print it, so we insert it here by
270 ;; hand.
271
272 ;; `vc-do-command' creates the buffer, but we need it before running
273 ;; the command.
274 (vc-setup-buffer buffer)
275 ;; If the buffer exists from a previous invocation it might be
276 ;; read-only.
277 (let ((inhibit-read-only t))
278 ;; XXX Here loop and call "git rev-list" on each file separately
279 ;; to make sure that each file gets a "File:" header before the
280 ;; corresponding log. Maybe there is a way to do this with one
281 ;; command...
282 (dolist (file files)
283 (with-current-buffer
284 buffer
285 (insert "File: " (file-name-nondirectory file) "\n")))
286 (vc-git-command buffer 'async name "rev-list" "--pretty" "HEAD" "--"))))
287
288(defvar log-view-message-re)
289(defvar log-view-file-re)
290(defvar log-view-font-lock-keywords)
291
292(define-derived-mode vc-git-log-view-mode log-view-mode "GIT-Log-View"
293 (require 'add-log) ;; we need the faces add-log
294 ;; Don't have file markers, so use impossible regexp.
295 (set (make-local-variable 'log-view-file-re) "^File:[ \t]+\\(.+\\)")
296 (set (make-local-variable 'log-view-message-re)
297 "^commit *\\([0-9a-z]+\\)")
298 (set (make-local-variable 'log-view-font-lock-keywords)
299 (append
300 `((,log-view-message-re (1 'change-log-acknowledgement))
301 (,log-view-file-re (1 'change-log-file-face)))
302 ;; Handle the case:
303 ;; user: foo@bar
304 '(("^Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
305 (1 'change-log-email))
306 ;; Handle the case:
307 ;; user: FirstName LastName <foo@bar>
308 ("^Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
309 (1 'change-log-name)
310 (2 'change-log-email))
311 ("^Date: \\(.+\\)" (1 'change-log-date))
312 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
313
314(defun vc-git-diff (file &optional rev1 rev2 buffer)
315 (let ((name (file-relative-name file))
316 (buf (or buffer "*vc-diff*")))
317 (if (and rev1 rev2)
318 (vc-git-command buf 0 name "diff-tree" "-p" rev1 rev2 "--")
319 (vc-git-command buf 0 name "diff-index" "-p" (or rev1 "HEAD") "--"))
320 ;; git-diff-index doesn't set exit status like diff does
321 (if (vc-git-workfile-unchanged-p file) 0 1)))
322
323(defun vc-git-diff-tree (dir &optional rev1 rev2)
324 (vc-git-diff dir rev1 rev2))
325
326(defun vc-git-annotate-command (file buf &optional rev)
327 ;; FIXME: rev is ignored
328 (let ((name (file-relative-name file)))
329 (vc-git-command buf 0 name "blame" (if rev (concat "-r" rev)))))
330
331(defun vc-git-annotate-time ()
332 (and (re-search-forward "[0-9a-f]+ (.* \\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) \\([-+0-9]+\\) +[0-9]+)" nil t)
333 (vc-annotate-convert-time
334 (apply #'encode-time (mapcar (lambda (match) (string-to-number (match-string match))) '(6 5 4 3 2 1 7))))))
335
336(defun vc-git-annotate-extract-revision-at-line ()
337 (save-excursion
338 (move-beginning-of-line 1)
339 (and (looking-at "[0-9a-f]+")
340 (buffer-substring-no-properties (match-beginning 0) (match-end 0)))))
341
342;;; MISCELLANEOUS
343
344(defun vc-git-previous-version (file rev)
345 "Git-specific version of `vc-previous-version'."
346 (let ((default-directory (file-name-directory (expand-file-name file)))
347 (file (file-name-nondirectory file)))
348 (vc-git-symbolic-commit
349 (with-temp-buffer
350 (and
351 (zerop
352 (call-process "git" nil '(t nil) nil "rev-list"
353 "-2" rev "--" file))
354 (goto-char (point-max))
355 (bolp)
356 (zerop (forward-line -1))
357 (not (bobp))
358 (buffer-substring-no-properties
359 (point)
360 (1- (point-max))))))))
361
362(defun vc-git-next-version (file rev)
363 "Git-specific version of `vc-next-version'."
364 (let* ((default-directory (file-name-directory
365 (expand-file-name file)))
366 (file (file-name-nondirectory file))
367 (current-rev
368 (with-temp-buffer
369 (and
370 (zerop
371 (call-process "git" nil '(t nil) nil "rev-list"
372 "-1" rev "--" file))
373 (goto-char (point-max))
374 (bolp)
375 (zerop (forward-line -1))
376 (bobp)
377 (buffer-substring-no-properties
378 (point)
379 (1- (point-max)))))))
380 (and current-rev
381 (vc-git-symbolic-commit
382 (with-temp-buffer
383 (and
384 (zerop
385 (call-process "git" nil '(t nil) nil "rev-list"
386 "HEAD" "--" file))
387 (goto-char (point-min))
388 (search-forward current-rev nil t)
389 (zerop (forward-line -1))
390 (buffer-substring-no-properties
391 (point)
392 (progn (forward-line 1) (1- (point))))))))))
393
394(defun vc-git-delete-file (file)
395 (vc-git-command nil 0 file "rm" "-f" "--"))
396
397(defun vc-git-rename-file (old new)
398 (vc-git-command nil 0 (list old new) "mv" "-f" "--"))
399
400
401;; Internal commands
402
403(defun vc-git-root (file)
404 (vc-find-root file ".git"))
405
406(defun vc-git-command (buffer okstatus file-or-list &rest flags)
407 "A wrapper around `vc-do-command' for use in vc-git.el.
408The difference to vc-do-command is that this function always invokes `git'."
409 (apply 'vc-do-command buffer okstatus "git" file-or-list flags))
410
411(defun vc-git--run-command-string (file &rest args)
412 "Run a git command on FILE and return its output as string."
413 (let* ((ok t)
414 (str (with-output-to-string
415 (with-current-buffer standard-output
416 (unless (eq 0 (apply #'call-process "git" nil '(t nil) nil
417 (append args (list (file-relative-name file)))))
418 (setq ok nil))))))
419 (and ok str)))
420
421(defun vc-git-symbolic-commit (commit)
422 "Translate COMMIT string into symbolic form.
423Returns nil if not possible."
424 (and commit
425 (with-temp-buffer
426 (and
427 (zerop
428 (call-process "git" nil '(t nil) nil "name-rev"
429 "--name-only" "--tags"
430 commit))
431 (goto-char (point-min))
432 (= (forward-line 2) 1)
433 (bolp)
434 (buffer-substring-no-properties (point-min) (1- (point-max)))))))
435
436(provide 'vc-git)
437
438;; arch-tag: bd10664a-0e5b-48f5-a877-6c17b135be12
439;;; vc-git.el ends here
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el
index 416c08ae4ca..b4aa7d3a124 100644
--- a/lisp/vc-hg.el
+++ b/lisp/vc-hg.el
@@ -4,7 +4,6 @@
4 4
5;; Author: Ivan Kanis 5;; Author: Ivan Kanis
6;; Keywords: tools 6;; Keywords: tools
7;; Version: 1889
8 7
9;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
10 9
@@ -39,41 +38,45 @@
39;; beginning of vc.el. The current status is: 38;; beginning of vc.el. The current status is:
40 39
41;; FUNCTION NAME STATUS 40;; FUNCTION NAME STATUS
41;; BACKEND PROPERTIES
42;; * revision-granularity OK
43;; STATE-QUERYING FUNCTIONS
42;; * registered (file) OK 44;; * registered (file) OK
43;; * state (file) OK 45;; * state (file) OK
44;; - state-heuristic (file) ?? PROBABLY NOT NEEDED 46;; - state-heuristic (file) ?? PROBABLY NOT NEEDED
45;; - dir-state (dir) NEEDED 47;; - dir-state (dir) OK
46;; * workfile-version (file) OK 48;; * workfile-version (file) OK
47;; - latest-on-branch-p (file) ?? 49;; - latest-on-branch-p (file) ??
48;; * checkout-model (file) OK 50;; * checkout-model (file) OK
49;; - workfile-unchanged-p (file) ?? 51;; - workfile-unchanged-p (file) OK
50;; - mode-line-string (file) NOT NEEDED 52;; - mode-line-string (file) NOT NEEDED
51;; - dired-state-info (file) NEEDED 53;; - dired-state-info (file) OK
52;; STATE-CHANGING FUNCTIONS 54;; STATE-CHANGING FUNCTIONS
53;; * register (file &optional rev comment) OK 55;; * register (files &optional rev comment) OK
56;; * create-repo () OK
54;; - init-version () NOT NEEDED 57;; - init-version () NOT NEEDED
55;; - responsible-p (file) OK 58;; - responsible-p (file) OK
56;; - could-register (file) OK 59;; - could-register (file) OK
57;; - receive-file (file rev) ?? PROBABLY NOT NEEDED 60;; - receive-file (file rev) ?? PROBABLY NOT NEEDED
58;; - unregister (file) COMMENTED OUT, MAY BE INCORRECT 61;; - unregister (file) COMMENTED OUT, MAY BE INCORRECT
59;; * checkin (file rev comment) OK 62;; * checkin (files rev comment) OK
60;; * find-version (file rev buffer) OK 63;; * find-version (file rev buffer) OK
61;; * checkout (file &optional editable rev) NOT NEEDED, COMMENTED OUT 64;; * checkout (file &optional editable rev) OK
62;; * revert (file &optional contents-done) OK 65;; * revert (file &optional contents-done) OK
63;; - cancel-version (file editable) ?? PROBABLY NOT NEEDED 66;; - rollback (files) ?? PROBABLY NOT NEEDED
64;; - merge (file rev1 rev2) NEEDED 67;; - merge (file rev1 rev2) NEEDED
65;; - merge-news (file) NEEDED 68;; - merge-news (file) NEEDED
66;; - steal-lock (file &optional version) NOT NEEDED 69;; - steal-lock (file &optional version) NOT NEEDED
67;; HISTORY FUNCTIONS 70;; HISTORY FUNCTIONS
68;; * print-log (file &optional buffer) OK 71;; * print-log (files &optional buffer) OK
69;; - log-view-mode () OK 72;; - log-view-mode () OK
70;; - show-log-entry (version) NOT NEEDED, DEFAULT IS GOOD 73;; - show-log-entry (version) NOT NEEDED, DEFAULT IS GOOD
71;; - wash-log (file) ?? 74;; - wash-log (file) ??
72;; - logentry-check () NOT NEEDED 75;; - logentry-check () NOT NEEDED
73;; - comment-history (file) NOT NEEDED 76;; - comment-history (file) NOT NEEDED
74;; - update-changelog (files) NOT NEEDED 77;; - update-changelog (files) NOT NEEDED
75;; * diff (file &optional rev1 rev2 buffer) OK 78;; * diff (files &optional rev1 rev2 buffer) OK
76;; - revision-completion-table (file) ?? 79;; - revision-completion-table (file) OK
77;; - diff-tree (dir &optional rev1 rev2) TEST IT 80;; - diff-tree (dir &optional rev1 rev2) TEST IT
78;; - annotate-command (file buf &optional rev) OK 81;; - annotate-command (file buf &optional rev) OK
79;; - annotate-time () OK 82;; - annotate-time () OK
@@ -111,6 +114,7 @@
111;;; Code: 114;;; Code:
112 115
113(eval-when-compile 116(eval-when-compile
117 (require 'cl)
114 (require 'vc)) 118 (require 'vc))
115 119
116;;; Customization options 120;;; Customization options
@@ -125,6 +129,12 @@
125 :version "22.2" 129 :version "22.2"
126 :group 'vc) 130 :group 'vc)
127 131
132
133;;; Properties of the backend
134
135(defun vc-hg-revision-granularity ()
136 'repository)
137
128;;; State querying functions 138;;; State querying functions
129 139
130;;;###autoload (defun vc-hg-registered (file) 140;;;###autoload (defun vc-hg-registered (file)
@@ -137,8 +147,8 @@
137;; Modelled after the similar function in vc-bzr.el 147;; Modelled after the similar function in vc-bzr.el
138(defun vc-hg-registered (file) 148(defun vc-hg-registered (file)
139 "Return non-nil if FILE is registered with hg." 149 "Return non-nil if FILE is registered with hg."
140 (if (vc-hg-root file) ; short cut 150 (when (vc-hg-root file) ; short cut
141 (vc-hg-state file))) ; expensive 151 (vc-hg-state file))) ; expensive
142 152
143(defun vc-hg-state (file) 153(defun vc-hg-state (file)
144 "Hg-specific version of `vc-state'." 154 "Hg-specific version of `vc-state'."
@@ -159,13 +169,43 @@
159 (error nil))))))) 169 (error nil)))))))
160 (when (eq 0 status) 170 (when (eq 0 status)
161 (if (eq 0 (length out)) 'up-to-date 171 (if (eq 0 (length out)) 'up-to-date
162 (let ((state (aref out 0))) 172 (when (null (string-match ".*: No such file or directory$" out))
163 (cond 173 (let ((state (aref out 0)))
164 ((eq state ?M) 'edited) 174 (cond
165 ((eq state ?A) 'edited) 175 ((eq state ?A) 'edited)
166 ((eq state ?P) 'needs-patch) 176 ((eq state ?M) 'edited)
167 ((eq state ??) nil) 177 ((eq state ?R) nil)
168 (t 'up-to-date))))))) 178 ((eq state ??) nil)
179 (t 'up-to-date))))))))
180
181(defun vc-hg-dir-state (dir)
182 (with-temp-buffer
183 (vc-hg-command (current-buffer) nil nil "status")
184 (goto-char (point-min))
185 (let ((status-char nil)
186 (file nil))
187 (while (not (eobp))
188 (setq status-char (char-after))
189 (setq file
190 (expand-file-name
191 (buffer-substring-no-properties (+ (point) 2)
192 (line-end-position))))
193 (cond
194 ;; The rest of the possible states in "hg status" output:
195 ;; R = removed
196 ;; ! = deleted, but still tracked
197 ;; ? = not tracked
198 ;; should not show up in vc-dired, so don't deal with them
199 ;; here.
200 ((eq status-char ?A)
201 (vc-file-setprop file 'vc-workfile-version "0")
202 (vc-file-setprop file 'vc-state 'edited))
203 ((eq status-char ?M)
204 (vc-file-setprop file 'vc-state 'edited))
205 ((eq status-char ??)
206 (vc-file-setprop file 'vc-backend 'none)
207 (vc-file-setprop file 'vc-state 'nil)))
208 (forward-line)))))
169 209
170(defun vc-hg-workfile-version (file) 210(defun vc-hg-workfile-version (file)
171 "Hg-specific version of `vc-workfile-version'." 211 "Hg-specific version of `vc-workfile-version'."
@@ -191,8 +231,8 @@
191 231
192;;; History functions 232;;; History functions
193 233
194(defun vc-hg-print-log(file &optional buffer) 234(defun vc-hg-print-log(files &optional buffer)
195 "Get change log associated with FILE." 235 "Get change log associated with FILES."
196 ;; `log-view-mode' needs to have the file name in order to function 236 ;; `log-view-mode' needs to have the file name in order to function
197 ;; correctly. "hg log" does not print it, so we insert it here by 237 ;; correctly. "hg log" does not print it, so we insert it here by
198 ;; hand. 238 ;; hand.
@@ -203,13 +243,14 @@
203 ;; If the buffer exists from a previous invocation it might be 243 ;; If the buffer exists from a previous invocation it might be
204 ;; read-only. 244 ;; read-only.
205 (let ((inhibit-read-only t)) 245 (let ((inhibit-read-only t))
206 (with-current-buffer 246 ;; We need to loop and call "hg log" on each file separately.
207 buffer 247 ;; "hg log" with multiple file arguments mashes all the logs
208 (insert "File: " (file-name-nondirectory file) "\n"))) 248 ;; together.
209 (vc-hg-command 249 (dolist (file files)
210 buffer 250 (with-current-buffer
211 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) 251 buffer
212 file "log")) 252 (insert "File: " (file-name-nondirectory file) "\n"))
253 (vc-hg-command buffer 0 file "log"))))
213 254
214(defvar log-view-message-re) 255(defvar log-view-message-re)
215(defvar log-view-file-re) 256(defvar log-view-file-re)
@@ -236,24 +277,41 @@
236 ("^date: \\(.+\\)" (1 'change-log-date)) 277 ("^date: \\(.+\\)" (1 'change-log-date))
237 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))) 278 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
238 279
239(defun vc-hg-diff (file &optional oldvers newvers buffer) 280(defun vc-hg-diff (files &optional oldvers newvers buffer)
240 "Get a difference report using hg between two versions of FILE." 281 "Get a difference report using hg between two versions of FILES."
241 (let ((working (vc-workfile-version file))) 282 (let ((working (vc-workfile-version (car files))))
242 (if (and (equal oldvers working) (not newvers)) 283 (if (and (equal oldvers working) (not newvers))
243 (setq oldvers nil)) 284 (setq oldvers nil))
244 (if (and (not oldvers) newvers) 285 (if (and (not oldvers) newvers)
245 (setq oldvers working)) 286 (setq oldvers working))
246 (apply 'call-process "hg" nil (or buffer "*vc-diff*") nil 287 (apply #'vc-hg-command (or buffer "*vc-diff*") nil
247 "--cwd" (file-name-directory file) "diff" 288 (mapcar (lambda (file) (file-name-nondirectory file)) files)
289 "--cwd" (file-name-directory (car files))
290 "diff"
248 (append 291 (append
249 (if oldvers 292 (if oldvers
250 (if newvers 293 (if newvers
251 (list "-r" oldvers "-r" newvers) 294 (list "-r" oldvers "-r" newvers)
252 (list "-r" oldvers)) 295 (list "-r" oldvers))
253 (list "")) 296 (list ""))))))
254 (list (file-name-nondirectory file)))))) 297
255 298(defun vc-hg-revision-table (file)
256(defalias 'vc-hg-diff-tree 'vc-hg-diff) 299 (let ((default-directory (file-name-directory file)))
300 (with-temp-buffer
301 (vc-hg-command t nil file "log" "--template" "{rev} ")
302 (split-string
303 (buffer-substring-no-properties (point-min) (point-max))))))
304
305;; Modelled after the similar function in vc-cvs.el
306(defun vc-hg-revision-completion-table (file)
307 (lexical-let ((file file)
308 table)
309 (setq table (lazy-completion-table
310 table (lambda () (vc-hg-revision-table file))))
311 table))
312
313(defun vc-hg-diff-tree (file &optional oldvers newvers buffer)
314 (vc-hg-diff (list file) oldvers newvers buffer))
257 315
258(defun vc-hg-annotate-command (file buffer &optional version) 316(defun vc-hg-annotate-command (file buffer &optional version)
259 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER. 317 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
@@ -290,7 +348,7 @@ Optional arg VERSION is a version to annotate from."
290 (let ((newrev (1+ (string-to-number rev))) 348 (let ((newrev (1+ (string-to-number rev)))
291 (tip-version 349 (tip-version
292 (with-temp-buffer 350 (with-temp-buffer
293 (vc-hg-command t nil nil "tip") 351 (vc-hg-command t 0 nil "tip")
294 (goto-char (point-min)) 352 (goto-char (point-min))
295 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):") 353 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):")
296 (string-to-number (match-string-no-properties 1))))) 354 (string-to-number (match-string-no-properties 1)))))
@@ -305,18 +363,22 @@ Optional arg VERSION is a version to annotate from."
305 (condition-case () 363 (condition-case ()
306 (delete-file file) 364 (delete-file file)
307 (file-error nil)) 365 (file-error nil))
308 (vc-hg-command nil nil file "remove" "--after" "--force")) 366 (vc-hg-command nil 0 file "remove" "--after" "--force"))
309 367
310;; Modelled after the similar function in vc-bzr.el 368;; Modelled after the similar function in vc-bzr.el
311(defun vc-hg-rename-file (old new) 369(defun vc-hg-rename-file (old new)
312 "Rename file from OLD to NEW using `hg mv'." 370 "Rename file from OLD to NEW using `hg mv'."
313 (vc-hg-command nil nil new old "mv")) 371 (vc-hg-command nil 0 new old "mv"))
314 372
315(defun vc-hg-register (file &optional rev comment) 373(defun vc-hg-register (files &optional rev comment)
316 "Register FILE under hg. 374 "Register FILES under hg.
317REV is ignored. 375REV is ignored.
318COMMENT is ignored." 376COMMENT is ignored."
319 (vc-hg-command nil nil file "add")) 377 (vc-hg-command nil 0 files "add"))
378
379(defun vc-hg-create-repo ()
380 "Create a new Mercurial repository."
381 (vc-hg-command nil 0 nil "init"))
320 382
321(defalias 'vc-hg-responsible-p 'vc-hg-root) 383(defalias 'vc-hg-responsible-p 'vc-hg-root)
322 384
@@ -336,49 +398,58 @@ COMMENT is ignored."
336;; "Unregister FILE from hg." 398;; "Unregister FILE from hg."
337;; (vc-hg-command nil nil file "remove")) 399;; (vc-hg-command nil nil file "remove"))
338 400
339(defun vc-hg-checkin (file rev comment) 401(defun vc-hg-checkin (files rev comment)
340 "HG-specific version of `vc-backend-checkin'. 402 "HG-specific version of `vc-backend-checkin'.
341REV is ignored." 403REV is ignored."
342 (vc-hg-command nil nil file "commit" "-m" comment)) 404 (vc-hg-command nil 0 files "commit" "-m" comment))
343 405
344(defun vc-hg-find-version (file rev buffer) 406(defun vc-hg-find-version (file rev buffer)
345 (let ((coding-system-for-read 'binary) 407 (let ((coding-system-for-read 'binary)
346 (coding-system-for-write 'binary)) 408 (coding-system-for-write 'binary))
347 (if rev 409 (if rev
348 (vc-hg-command buffer nil file "cat" "-r" rev) 410 (vc-hg-command buffer 0 file "cat" "-r" rev)
349 (vc-hg-command buffer nil file "cat")))) 411 (vc-hg-command buffer 0 file "cat"))))
350 412
351;; Modelled after the similar function in vc-bzr.el 413;; Modelled after the similar function in vc-bzr.el
352;; This should not be needed, `vc-hg-find-version' provides the same 414(defun vc-hg-checkout (file &optional editable rev)
353;; functionality. 415 "Retrieve a revision of FILE.
354;; (defun vc-hg-checkout (file &optional editable rev workfile) 416EDITABLE is ignored.
355;; "Retrieve a revision of FILE into a WORKFILE. 417REV is the revision to check out into WORKFILE."
356;; EDITABLE is ignored. 418 (let ((coding-system-for-read 'binary)
357;; REV is the revision to check out into WORKFILE." 419 (coding-system-for-write 'binary))
358;; (unless workfile 420 (with-current-buffer (or (get-file-buffer file) (current-buffer))
359;; (setq workfile (vc-version-backup-file-name file rev))) 421 (if rev
360;; (let ((coding-system-for-read 'binary) 422 (vc-hg-command t 0 file "cat" "-r" rev)
361;; (coding-system-for-write 'binary)) 423 (vc-hg-command t 0 file "cat")))))
362;; (with-temp-file workfile
363;; (if rev
364;; (vc-hg-command t nil file "cat" "-r" rev)
365;; (vc-hg-command t nil file "cat")))))
366 424
367(defun vc-hg-checkout-model (file) 425(defun vc-hg-checkout-model (file)
368 'implicit) 426 'implicit)
369 427
370;; Modelled after the similar function in vc-bzr.el 428;; Modelled after the similar function in vc-bzr.el
429(defun vc-hg-workfile-unchanged-p (file)
430 (eq 'up-to-date (vc-hg-state file)))
431
432(defun vc-hg-dired-state-info (file)
433 "Hg-specific version of `vc-dired-state-info'."
434 (let ((hg-state (vc-state file)))
435 (if (eq hg-state 'edited)
436 (if (equal (vc-workfile-version file) "0")
437 "(added)" "(modified)")
438 ;; fall back to the default VC representation
439 (vc-default-dired-state-info 'HG file))))
440
441;; Modelled after the similar function in vc-bzr.el
371(defun vc-hg-revert (file &optional contents-done) 442(defun vc-hg-revert (file &optional contents-done)
372 (unless contents-done 443 (unless contents-done
373 (with-temp-buffer (vc-hg-command t nil file "revert")))) 444 (with-temp-buffer (vc-hg-command t 0 file "revert"))))
374 445
375;;; Internal functions 446;;; Internal functions
376 447
377(defun vc-hg-command (buffer okstatus file &rest flags) 448(defun vc-hg-command (buffer okstatus file-or-list &rest flags)
378 "A wrapper around `vc-do-command' for use in vc-hg.el. 449 "A wrapper around `vc-do-command' for use in vc-hg.el.
379The difference to vc-do-command is that this function always invokes `hg', 450The difference to vc-do-command is that this function always invokes `hg',
380and that it passes `vc-hg-global-switches' to it before FLAGS." 451and that it passes `vc-hg-global-switches' to it before FLAGS."
381 (apply 'vc-do-command buffer okstatus "hg" file 452 (apply 'vc-do-command buffer okstatus "hg" file-or-list
382 (if (stringp vc-hg-global-switches) 453 (if (stringp vc-hg-global-switches)
383 (cons vc-hg-global-switches flags) 454 (cons vc-hg-global-switches flags)
384 (append vc-hg-global-switches 455 (append vc-hg-global-switches
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 38ddb35c976..1029e745cde 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -159,32 +159,36 @@ by these regular expressions."
159 159
160(defun vc-stay-local-p (file) 160(defun vc-stay-local-p (file)
161 "Return non-nil if VC should stay local when handling FILE. 161 "Return non-nil if VC should stay local when handling FILE.
162This uses the `repository-hostname' backend operation." 162This uses the `repository-hostname' backend operation.
163 (let* ((backend (vc-backend file)) 163If FILE is a list of files, return non-nil if any of them
164 (sym (vc-make-backend-sym backend 'stay-local)) 164individually should stay local."
165 (stay-local (if (boundp sym) (symbol-value sym) t))) 165 (if (listp file)
166 (if (eq stay-local t) (setq stay-local vc-stay-local)) 166 (delq nil (mapcar 'vc-stay-local-p file))
167 (if (symbolp stay-local) stay-local 167 (let* ((backend (vc-backend file))
168 (let ((dirname (if (file-directory-p file) 168 (sym (vc-make-backend-sym backend 'stay-local))
169 (directory-file-name file) 169 (stay-local (if (boundp sym) (symbol-value sym) t)))
170 (file-name-directory file)))) 170 (if (eq stay-local t) (setq stay-local vc-stay-local))
171 (eq 'yes 171 (if (symbolp stay-local) stay-local
172 (or (vc-file-getprop dirname 'vc-stay-local-p) 172 (let ((dirname (if (file-directory-p file)
173 (vc-file-setprop 173 (directory-file-name file)
174 dirname 'vc-stay-local-p 174 (file-name-directory file))))
175 (let ((hostname (vc-call-backend 175 (eq 'yes
176 backend 'repository-hostname dirname))) 176 (or (vc-file-getprop dirname 'vc-stay-local-p)
177 (if (not hostname) 177 (vc-file-setprop
178 'no 178 dirname 'vc-stay-local-p
179 (let ((default t)) 179 (let ((hostname (vc-call-backend
180 (if (eq (car-safe stay-local) 'except) 180 backend 'repository-hostname dirname)))
181 (setq default nil stay-local (cdr stay-local))) 181 (if (not hostname)
182 (when (consp stay-local) 182 'no
183 (setq stay-local 183 (let ((default t))
184 (mapconcat 'identity stay-local "\\|"))) 184 (if (eq (car-safe stay-local) 'except)
185 (if (if (string-match stay-local hostname) 185 (setq default nil stay-local (cdr stay-local)))
186 default (not default)) 186 (when (consp stay-local)
187 'yes 'no))))))))))) 187 (setq stay-local
188 (mapconcat 'identity stay-local "\\|")))
189 (if (if (string-match stay-local hostname)
190 default (not default))
191 'yes 'no))))))))))))
188 192
189;;; This is handled specially now. 193;;; This is handled specially now.
190;; Tell Emacs about this new kind of minor mode 194;; Tell Emacs about this new kind of minor mode
@@ -315,22 +319,25 @@ The function walks up the directory tree from FILE looking for WITNESS.
315If WITNESS if not found, return nil, otherwise return the root." 319If WITNESS if not found, return nil, otherwise return the root."
316 ;; Represent /home/luser/foo as ~/foo so that we don't try to look for 320 ;; Represent /home/luser/foo as ~/foo so that we don't try to look for
317 ;; witnesses in /home or in /. 321 ;; witnesses in /home or in /.
322 (while (not (file-directory-p file))
323 (setq file (file-name-directory (directory-file-name file))))
318 (setq file (abbreviate-file-name file)) 324 (setq file (abbreviate-file-name file))
319 (let ((root nil) 325 (let ((root nil)
320 (user (nth 2 (file-attributes file)))) 326 (user (nth 2 (file-attributes file))))
321 (while (not (or root 327 (while (not (or root
322 (equal file (setq file (file-name-directory file))) 328 (null file)
323 (null file) 329 ;; As a heuristic, we stop looking up the hierarchy of
324 ;; As a heuristic, we stop looking up the hierarchy of 330 ;; directories as soon as we find a directory belonging
325 ;; directories as soon as we find a directory belonging 331 ;; to another user. This should save us from looking in
326 ;; to another user. This should save us from looking in 332 ;; things like /net and /afs. This assumes that all the
327 ;; things like /net and /afs. This assumes that all the 333 ;; files inside a project belong to the same user.
328 ;; files inside a project belong to the same user. 334 (not (equal user (nth 2 (file-attributes file))))
329 (not (equal user (nth 2 (file-attributes file)))) 335 (string-match vc-ignore-dir-regexp file)))
330 (string-match vc-ignore-dir-regexp file)))
331 (if (file-exists-p (expand-file-name witness file)) 336 (if (file-exists-p (expand-file-name witness file))
332 (setq root file) 337 (setq root file)
333 (setq file (directory-file-name file)))) 338 (if (equal file
339 (setq file (file-name-directory (directory-file-name file))))
340 (setq file nil))))
334 root)) 341 root))
335 342
336;; Access functions to file properties 343;; Access functions to file properties
@@ -373,20 +380,26 @@ backend is tried first."
373 (vc-file-setprop file 'vc-backend 'none) 380 (vc-file-setprop file 'vc-backend 'none)
374 nil))))) 381 nil)))))
375 382
376(defun vc-backend (file) 383(defun vc-backend (file-or-list)
377 "Return the version control type of FILE, nil if it is not registered." 384 "Return the version control type of FILE-OR-LIST, nil if it's not registered.
385If the argument is a list, the files must all have the same back end."
378 ;; `file' can be nil in several places (typically due to the use of 386 ;; `file' can be nil in several places (typically due to the use of
379 ;; code like (vc-backend buffer-file-name)). 387 ;; code like (vc-backend buffer-file-name)).
380 (when (stringp file) 388 (cond ((stringp file-or-list)
381 (let ((property (vc-file-getprop file 'vc-backend))) 389 (let ((property (vc-file-getprop file-or-list 'vc-backend)))
382 ;; Note that internally, Emacs remembers unregistered 390 ;; Note that internally, Emacs remembers unregistered
383 ;; files by setting the property to `none'. 391 ;; files by setting the property to `none'.
384 (cond ((eq property 'none) nil) 392 (cond ((eq property 'none) nil)
385 (property) 393 (property)
386 ;; vc-registered sets the vc-backend property 394 ;; vc-registered sets the vc-backend property
387 (t (if (vc-registered file) 395 (t (if (vc-registered file-or-list)
388 (vc-file-getprop file 'vc-backend) 396 (vc-file-getprop file-or-list 'vc-backend)
389 nil)))))) 397 nil)))))
398 ((and file-or-list (listp file-or-list))
399 (vc-backend (car file-or-list)))
400 (t
401 nil)))
402
390 403
391(defun vc-backend-subdirectory-name (file) 404(defun vc-backend-subdirectory-name (file)
392 "Return where the master and lock FILEs for the current directory are kept." 405 "Return where the master and lock FILEs for the current directory are kept."
@@ -480,7 +493,7 @@ For registered files, the value returned is one of:
480 ;; - `removed' 493 ;; - `removed'
481 ;; - `copied' and `moved' (might be handled by `removed' and `added') 494 ;; - `copied' and `moved' (might be handled by `removed' and `added')
482 (or (vc-file-getprop file 'vc-state) 495 (or (vc-file-getprop file 'vc-state)
483 (if (vc-backend file) 496 (if (and (> (length file) 0) (vc-backend file))
484 (vc-file-setprop file 'vc-state 497 (vc-file-setprop file 'vc-state
485 (vc-call state-heuristic file))))) 498 (vc-call state-heuristic file)))))
486 499
@@ -518,7 +531,7 @@ Return non-nil if FILE is unchanged."
518 (zerop (condition-case err 531 (zerop (condition-case err
519 ;; If the implementation supports it, let the output 532 ;; If the implementation supports it, let the output
520 ;; go to *vc*, not *vc-diff*, since this is an internal call. 533 ;; go to *vc*, not *vc-diff*, since this is an internal call.
521 (vc-call diff file nil nil "*vc*") 534 (vc-call diff (list file) nil nil "*vc*")
522 (wrong-number-of-arguments 535 (wrong-number-of-arguments
523 ;; If this error came from the above call to vc-BACKEND-diff, 536 ;; If this error came from the above call to vc-BACKEND-diff,
524 ;; try again without the optional buffer argument (for 537 ;; try again without the optional buffer argument (for
@@ -529,10 +542,10 @@ Return non-nil if FILE is unchanged."
529 'diff)))) 542 'diff))))
530 (not (eq (caddr err) 4))) 543 (not (eq (caddr err) 4)))
531 (signal (car err) (cdr err)) 544 (signal (car err) (cdr err))
532 (vc-call diff file)))))) 545 (vc-call diff (list file)))))))
533 546
534(defun vc-workfile-version (file) 547(defun vc-workfile-version (file)
535 "Return the version level of the current workfile FILE. 548 "Return the repository version from which FILE was checked out.
536If FILE is not registered, this function always returns nil." 549If FILE is not registered, this function always returns nil."
537 (or (vc-file-getprop file 'vc-workfile-version) 550 (or (vc-file-getprop file 'vc-workfile-version)
538 (if (vc-backend file) 551 (if (vc-backend file)
@@ -703,6 +716,11 @@ Before doing that, check if there are any old backups and get rid of them."
703 ;; any VC Dired buffer to synchronize. 716 ;; any VC Dired buffer to synchronize.
704 (vc-dired-resynch-file file))))) 717 (vc-dired-resynch-file file)))))
705 718
719(defconst vc-mode-line-map
720 (let ((map (make-sparse-keymap)))
721 (define-key map [mode-line down-mouse-1] 'vc-menu-map)
722 map))
723
706(defun vc-mode-line (file) 724(defun vc-mode-line (file)
707 "Set `vc-mode' to display type of version control for FILE. 725 "Set `vc-mode' to display type of version control for FILE.
708The value is set in the current buffer, which should be the buffer 726The value is set in the current buffer, which should be the buffer
@@ -711,9 +729,22 @@ visiting FILE."
711 (let ((backend (vc-backend file))) 729 (let ((backend (vc-backend file)))
712 (if (not backend) 730 (if (not backend)
713 (setq vc-mode nil) 731 (setq vc-mode nil)
714 (setq vc-mode (concat " " (if vc-display-status 732 (let* ((ml-string (vc-call mode-line-string file))
715 (vc-call mode-line-string file) 733 (ml-echo (get-text-property 0 'help-echo ml-string)))
716 (symbol-name backend)))) 734 (setq vc-mode
735 (concat
736 " "
737 (if (null vc-display-status)
738 (symbol-name backend)
739 (propertize
740 ml-string
741 'mouse-face 'mode-line-highlight
742 'help-echo
743 (concat (or ml-echo
744 (format "File under the %s version control system"
745 backend))
746 "\nmouse-1: Version Control menu")
747 'local-map vc-mode-line-map)))))
717 ;; If the file is locked by some other user, make 748 ;; If the file is locked by some other user, make
718 ;; the buffer read-only. Like this, even root 749 ;; the buffer read-only. Like this, even root
719 ;; cannot modify a file that someone else has locked. 750 ;; cannot modify a file that someone else has locked.
@@ -757,13 +788,10 @@ This function assumes that the file is registered."
757 ;; Not just for the 'edited state, but also a fallback 788 ;; Not just for the 'edited state, but also a fallback
758 ;; for all other states. Think about different symbols 789 ;; for all other states. Think about different symbols
759 ;; for 'needs-patch and 'needs-merge. 790 ;; for 'needs-patch and 'needs-merge.
760 (setq state-echo "Edited file") 791 (setq state-echo "Locally modified file")
761 (concat backend ":" rev))) 792 (concat backend ":" rev)))
762 'mouse-face 'mode-line-highlight 793 'help-echo (concat state-echo " under the " backend
763 'local-map (let ((map (make-sparse-keymap))) 794 " version control system"))))
764 (define-key map [mode-line down-mouse-1] 'vc-menu-map) map)
765 'help-echo (concat state-echo " under the " backend
766 " version control system\nmouse-1: VC Menu"))))
767 795
768(defun vc-follow-link () 796(defun vc-follow-link ()
769 "If current buffer visits a symbolic link, visit the real file. 797 "If current buffer visits a symbolic link, visit the real file.
@@ -873,7 +901,7 @@ Used in `find-file-not-found-functions'."
873 (let ((map (make-sparse-keymap))) 901 (let ((map (make-sparse-keymap)))
874 (define-key map "a" 'vc-update-change-log) 902 (define-key map "a" 'vc-update-change-log)
875 (define-key map "b" 'vc-switch-backend) 903 (define-key map "b" 'vc-switch-backend)
876 (define-key map "c" 'vc-cancel-version) 904 (define-key map "c" 'vc-rollback)
877 (define-key map "d" 'vc-directory) 905 (define-key map "d" 'vc-directory)
878 (define-key map "g" 'vc-annotate) 906 (define-key map "g" 'vc-annotate)
879 (define-key map "h" 'vc-insert-headers) 907 (define-key map "h" 'vc-insert-headers)
@@ -882,8 +910,9 @@ Used in `find-file-not-found-functions'."
882 (define-key map "m" 'vc-merge) 910 (define-key map "m" 'vc-merge)
883 (define-key map "r" 'vc-retrieve-snapshot) 911 (define-key map "r" 'vc-retrieve-snapshot)
884 (define-key map "s" 'vc-create-snapshot) 912 (define-key map "s" 'vc-create-snapshot)
885 (define-key map "u" 'vc-revert-buffer) 913 (define-key map "u" 'vc-revert)
886 (define-key map "v" 'vc-next-action) 914 (define-key map "v" 'vc-next-action)
915 (define-key map "+" 'vc-update)
887 (define-key map "=" 'vc-diff) 916 (define-key map "=" 'vc-diff)
888 (define-key map "~" 'vc-version-other-window) 917 (define-key map "~" 'vc-version-other-window)
889 map)) 918 map))
@@ -913,9 +942,9 @@ Used in `find-file-not-found-functions'."
913 (define-key vc-menu-map [separator2] '("----")) 942 (define-key vc-menu-map [separator2] '("----"))
914 (define-key vc-menu-map [vc-insert-header] 943 (define-key vc-menu-map [vc-insert-header]
915 '("Insert Header" . vc-insert-headers)) 944 '("Insert Header" . vc-insert-headers))
916 (define-key vc-menu-map [undo] '("Undo Last Check-In" . vc-cancel-version)) 945 (define-key vc-menu-map [undo] '("Undo Last Check-In" . vc-rollback))
917 (define-key vc-menu-map [vc-revert-buffer] 946 (define-key vc-menu-map [vc-revert]
918 '("Revert to Base Version" . vc-revert-buffer)) 947 '("Revert to Base Version" . vc-revert))
919 (define-key vc-menu-map [vc-update] 948 (define-key vc-menu-map [vc-update]
920 '("Update to Latest Version" . vc-update)) 949 '("Update to Latest Version" . vc-update))
921 (define-key vc-menu-map [vc-next-action] '("Check In/Out" . vc-next-action)) 950 (define-key vc-menu-map [vc-next-action] '("Check In/Out" . vc-next-action))
@@ -932,8 +961,8 @@ Used in `find-file-not-found-functions'."
932;;(put 'vc-update-change-log 'menu-enable 961;;(put 'vc-update-change-log 'menu-enable
933;; '(member (vc-buffer-backend) '(RCS CVS))) 962;; '(member (vc-buffer-backend) '(RCS CVS)))
934;;(put 'vc-print-log 'menu-enable 'vc-mode) 963;;(put 'vc-print-log 'menu-enable 'vc-mode)
935;;(put 'vc-cancel-version 'menu-enable 'vc-mode) 964;;(put 'vc-rollback 'menu-enable 'vc-mode)
936;;(put 'vc-revert-buffer 'menu-enable 'vc-mode) 965;;(put 'vc-revert 'menu-enable 'vc-mode)
937;;(put 'vc-insert-headers 'menu-enable 'vc-mode) 966;;(put 'vc-insert-headers 'menu-enable 'vc-mode)
938;;(put 'vc-next-action 'menu-enable 'vc-mode) 967;;(put 'vc-next-action 'menu-enable 'vc-mode)
939;;(put 'vc-register 'menu-enable '(and buffer-file-name (not vc-mode))) 968;;(put 'vc-register 'menu-enable '(and buffer-file-name (not vc-mode)))
diff --git a/lisp/vc-mcvs.el b/lisp/vc-mcvs.el
index 7e5dbd47a70..debdf892183 100644
--- a/lisp/vc-mcvs.el
+++ b/lisp/vc-mcvs.el
@@ -109,6 +109,11 @@ This is only meaningful if you don't use the implicit checkout model
109 :version "22.1" 109 :version "22.1"
110 :group 'vc) 110 :group 'vc)
111 111
112;;; Properties of the backend
113
114(defun vc-mcvs-revision-granularity ()
115 'file)
116
112;;; 117;;;
113;;; State-querying functions 118;;; State-querying functions
114;;; 119;;;
@@ -202,13 +207,16 @@ This is only meaningful if you don't use the implicit checkout model
202;;; State-changing functions 207;;; State-changing functions
203;;; 208;;;
204 209
205(defun vc-mcvs-register (file &optional rev comment) 210(defun vc-mcvs-register (files &optional rev comment)
206 "Register FILE into the Meta-CVS version-control system. 211 "Register FILES into the Meta-CVS version-control system.
207COMMENT can be used to provide an initial description of FILE. 212COMMENT can be used to provide an initial description of FILE.
208 213
209`vc-register-switches' and `vc-mcvs-register-switches' are passed to 214`vc-register-switches' and `vc-mcvs-register-switches' are passed to
210the Meta-CVS command (in that order)." 215the Meta-CVS command (in that order)."
211 (let* ((filename (file-name-nondirectory file)) 216 ;; FIXME: multiple-file case should be made to work
217 (if (> (length files) 1) (error "Registering filesets is not yet supported."))
218 (let* ((file (car files))
219 (filename (file-name-nondirectory file))
212 (extpos (string-match "\\." filename)) 220 (extpos (string-match "\\." filename))
213 (ext (if extpos (substring filename (1+ extpos)))) 221 (ext (if extpos (substring filename (1+ extpos))))
214 (root (vc-mcvs-root file)) 222 (root (vc-mcvs-root file))
@@ -257,7 +265,7 @@ the Meta-CVS command (in that order)."
257 "Return non-nil if FILE could be registered in Meta-CVS. 265 "Return non-nil if FILE could be registered in Meta-CVS.
258This is only possible if Meta-CVS is responsible for FILE's directory.") 266This is only possible if Meta-CVS is responsible for FILE's directory.")
259 267
260(defun vc-mcvs-checkin (file rev comment) 268(defun vc-mcvs-checkin (files rev comment)
261 "Meta-CVS-specific version of `vc-backend-checkin'." 269 "Meta-CVS-specific version of `vc-backend-checkin'."
262 (unless (or (not rev) (vc-mcvs-valid-version-number-p rev)) 270 (unless (or (not rev) (vc-mcvs-valid-version-number-p rev))
263 (if (not (vc-mcvs-valid-symbolic-tag-name-p rev)) 271 (if (not (vc-mcvs-valid-symbolic-tag-name-p rev))
@@ -267,14 +275,15 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
267 ;; This file-specific form of branching is deprecated. 275 ;; This file-specific form of branching is deprecated.
268 ;; We can't use `mcvs branch' and `mcvs switch' because they cannot 276 ;; We can't use `mcvs branch' and `mcvs switch' because they cannot
269 ;; be applied just to this one file. 277 ;; be applied just to this one file.
270 (apply 'vc-mcvs-command nil 0 file "tag" "-b" (list rev)) 278 (apply 'vc-mcvs-command nil 0 files "tag" "-b" (list rev))
271 (apply 'vc-mcvs-command nil 0 file "update" "-r" (list rev)) 279 (apply 'vc-mcvs-command nil 0 files "update" "-r" (list rev))
272 (vc-file-setprop file 'vc-mcvs-sticky-tag rev) 280 (mapcar (lambda (file) (vc-file-setprop file 'vc-mcvs-sticky-tag rev))
281 files)
273 (setq rev nil))) 282 (setq rev nil)))
274 ;; This commit might cvs-commit several files (e.g. MAP and TYPES) 283 ;; This commit might cvs-commit several files (e.g. MAP and TYPES)
275 ;; so using numbered revs here is dangerous and somewhat meaningless. 284 ;; so using numbered revs here is dangerous and somewhat meaningless.
276 (when rev (error "Cannot commit to a specific revision number")) 285 (when rev (error "Cannot commit to a specific revision number"))
277 (let ((status (apply 'vc-mcvs-command nil 1 file 286 (let ((status (apply 'vc-mcvs-command nil 1 files
278 "ci" "-m" comment 287 "ci" "-m" comment
279 (vc-switches 'MCVS 'checkin)))) 288 (vc-switches 'MCVS 'checkin))))
280 (set-buffer "*vc*") 289 (set-buffer "*vc*")
@@ -283,7 +292,8 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
283 ;; Check checkin problem. 292 ;; Check checkin problem.
284 (cond 293 (cond
285 ((re-search-forward "Up-to-date check failed" nil t) 294 ((re-search-forward "Up-to-date check failed" nil t)
286 (vc-file-setprop file 'vc-state 'needs-merge) 295 (mapcar (lambda (file) (vc-file-setprop file 'vc-state 'needs-merge))
296 files)
287 (error (substitute-command-keys 297 (error (substitute-command-keys
288 (concat "Up-to-date check failed: " 298 (concat "Up-to-date check failed: "
289 "type \\[vc-next-action] to merge in changes")))) 299 "type \\[vc-next-action] to merge in changes"))))
@@ -292,20 +302,25 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
292 (goto-char (point-min)) 302 (goto-char (point-min))
293 (shrink-window-if-larger-than-buffer) 303 (shrink-window-if-larger-than-buffer)
294 (error "Check-in failed")))) 304 (error "Check-in failed"))))
295 ;; Update file properties 305 ;; Single-file commit? Then update the version by parsing the buffer.
296 (vc-file-setprop 306 ;; Otherwise we can't necessarily tell what goes with what; clear
297 file 'vc-workfile-version 307 ;; its properties so they have to be refetched.
298 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) 308 (if (= (length files) 1)
299 ;; Forget the checkout model of the file, because we might have 309 (vc-file-setprop
310 (car files) 'vc-workfile-version
311 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2))
312 (mapc (lambda (file) (vc-file-clearprops file)) files))
313 ;; Anyway, forget the checkout model of the file, because we might have
300 ;; guessed wrong when we found the file. After commit, we can 314 ;; guessed wrong when we found the file. After commit, we can
301 ;; tell it from the permissions of the file (see 315 ;; tell it from the permissions of the file (see
302 ;; vc-mcvs-checkout-model). 316 ;; vc-mcvs-checkout-model).
303 (vc-file-setprop file 'vc-checkout-model nil) 317 (mapc (lambda (file) (vc-file-setprop file 'vc-checkout-model nil))
318 files)
304 319
305 ;; if this was an explicit check-in (does not include creation of 320 ;; if this was an explicit check-in (does not include creation of
306 ;; a branch), remove the sticky tag. 321 ;; a branch), remove the sticky tag.
307 (if (and rev (not (vc-mcvs-valid-symbolic-tag-name-p rev))) 322 (if (and rev (not (vc-mcvs-valid-symbolic-tag-name-p rev)))
308 (vc-mcvs-command nil 0 file "update" "-A")))) 323 (vc-mcvs-command nil 0 files "update" "-A"))))
309 324
310(defun vc-mcvs-find-version (file rev buffer) 325(defun vc-mcvs-find-version (file rev buffer)
311 (apply 'vc-mcvs-command 326 (apply 'vc-mcvs-command
@@ -421,44 +436,32 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
421;;; History functions 436;;; History functions
422;;; 437;;;
423 438
424(defun vc-mcvs-print-log (file &optional buffer) 439(defun vc-mcvs-print-log (files &optional buffer)
425 "Get change log associated with FILE." 440 "Get change log associated with FILES."
426 (let ((default-directory (vc-mcvs-root file))) 441 (let ((default-directory (vc-mcvs-root (car files))))
427 ;; Run the command from the root dir so that `mcvs filt' returns 442 ;; Run the command from the root dir so that `mcvs filt' returns
428 ;; valid relative names. 443 ;; valid relative names.
429 (vc-mcvs-command 444 (vc-mcvs-command
430 buffer 445 buffer
431 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) 446 (if (and (vc-stay-local-p files) (fboundp 'start-process)) 'async 0)
432 file "log"))) 447 files "log")))
433 448
434(defun vc-mcvs-diff (file &optional oldvers newvers buffer) 449(defun vc-mcvs-diff (files &optional oldvers newvers buffer)
435 "Get a difference report using Meta-CVS between two versions of FILE." 450 "Get a difference report using Meta-CVS between two versions of FILES."
436 (if (string= (vc-workfile-version file) "0")
437 ;; This file is added but not yet committed; there is no master file.
438 (if (or oldvers newvers)
439 (error "No revisions of %s exist" file)
440 ;; We regard this as "changed".
441 ;; Diff it against /dev/null.
442 ;; Note: this is NOT a "mcvs diff".
443 (apply 'vc-do-command (or buffer "*vc-diff*")
444 1 "diff" file
445 (append (vc-switches nil 'diff) '("/dev/null")))
446 ;; Even if it's empty, it's locally modified.
447 1)
448 (let* ((async (and (not vc-disable-async-diff) 451 (let* ((async (and (not vc-disable-async-diff)
449 (vc-stay-local-p file) 452 (vc-stay-local-p files)
450 (fboundp 'start-process))) 453 (fboundp 'start-process)))
451 ;; Run the command from the root dir so that `mcvs filt' returns 454 ;; Run the command from the root dir so that `mcvs filt' returns
452 ;; valid relative names. 455 ;; valid relative names.
453 (default-directory (vc-mcvs-root file)) 456 (default-directory (vc-mcvs-root (car files)))
454 (status 457 (status
455 (apply 'vc-mcvs-command (or buffer "*vc-diff*") 458 (apply 'vc-mcvs-command (or buffer "*vc-diff*")
456 (if async 'async 1) 459 (if async 'async 1)
457 file "diff" 460 files "diff"
458 (and oldvers (concat "-r" oldvers)) 461 (and oldvers (concat "-r" oldvers))
459 (and newvers (concat "-r" newvers)) 462 (and newvers (concat "-r" newvers))
460 (vc-switches 'MCVS 'diff)))) 463 (vc-switches 'MCVS 'diff))))
461 (if async 1 status)))) ; async diff, pessimistic assumption. 464 (if async 1 status))) ; async diff, pessimistic assumption.
462 465
463(defun vc-mcvs-diff-tree (dir &optional rev1 rev2) 466(defun vc-mcvs-diff-tree (dir &optional rev1 rev2)
464 "Diff all files at and below DIR." 467 "Diff all files at and below DIR."
diff --git a/lisp/vc-rcs.el b/lisp/vc-rcs.el
index a4b3b11301e..a4be8064338 100644
--- a/lisp/vc-rcs.el
+++ b/lisp/vc-rcs.el
@@ -29,6 +29,10 @@
29 29
30;; See vc.el 30;; See vc.el
31 31
32;; TODO:
33;; - remove call to vc-expand-dirs by implementing our own (which can just
34;; list the RCS subdir instead).
35
32;;; Code: 36;;; Code:
33 37
34;;; 38;;;
@@ -96,6 +100,11 @@ For a description of possible values, see `vc-check-master-templates'."
96 :group 'vc) 100 :group 'vc)
97 101
98 102
103;;; Properties of the backend
104
105(defun vc-rcs-revision-granularity ()
106 'file)
107
99;;; 108;;;
100;;; State-querying functions 109;;; State-querying functions
101;;; 110;;;
@@ -230,17 +239,23 @@ When VERSION is given, perform check for that version."
230;;; State-changing functions 239;;; State-changing functions
231;;; 240;;;
232 241
233(defun vc-rcs-register (file &optional rev comment) 242(defun vc-rcs-create-repo ()
234 "Register FILE into the RCS version-control system. 243 "Create a new RCS repository."
235REV is the optional revision number for the file. COMMENT can be used 244 ;; RCS is totally file-oriented, so all we have to do is make the directory
236to provide an initial description of FILE. 245 (make-directory "RCS"))
246
247(defun vc-rcs-register (files &optional rev comment)
248 "Register FILES into the RCS version-control system.
249REV is the optional revision number for the files. COMMENT can be used
250to provide an initial description for each FILES.
237 251
238`vc-register-switches' and `vc-rcs-register-switches' are passed to 252`vc-register-switches' and `vc-rcs-register-switches' are passed to
239the RCS command (in that order). 253the RCS command (in that order).
240 254
241Automatically retrieve a read-only version of the file with keywords 255Automatically retrieve a read-only version of the file with keywords
242expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." 256expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
243 (let ((subdir (expand-file-name "RCS" (file-name-directory file)))) 257 (let ((subdir (expand-file-name "RCS" (file-name-directory file))))
258 (dolist (file files)
244 (and (not (file-exists-p subdir)) 259 (and (not (file-exists-p subdir))
245 (not (directory-files (file-name-directory file) 260 (not (directory-files (file-name-directory file)
246 nil ".*,v$" t)) 261 nil ".*,v$" t))
@@ -273,7 +288,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
273 (if (re-search-forward 288 (if (re-search-forward
274 "^initial revision: \\([0-9.]+\\).*\n" 289 "^initial revision: \\([0-9.]+\\).*\n"
275 nil t) 290 nil t)
276 (match-string 1)))))) 291 (match-string 1)))))))
277 292
278(defun vc-rcs-responsible-p (file) 293(defun vc-rcs-responsible-p (file)
279 "Return non-nil if RCS thinks it would be responsible for registering FILE." 294 "Return non-nil if RCS thinks it would be responsible for registering FILE."
@@ -307,55 +322,57 @@ whether to remove it."
307 (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) 322 (yes-or-no-p (format "Directory %s is empty; remove it? " dir))
308 (delete-directory dir)))) 323 (delete-directory dir))))
309 324
310(defun vc-rcs-checkin (file rev comment) 325(defun vc-rcs-checkin (files rev comment)
311 "RCS-specific version of `vc-backend-checkin'." 326 "RCS-specific version of `vc-backend-checkin'."
312 (let ((switches (vc-switches 'RCS 'checkin))) 327 (let ((switches (vc-switches 'RCS 'checkin)))
313 (let ((old-version (vc-workfile-version file)) new-version 328 ;; Now operate on the files
314 (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) 329 (dolist (file files)
315 ;; Force branch creation if an appropriate 330 (let ((old-version (vc-workfile-version file)) new-version
316 ;; default branch has been set. 331 (default-branch (vc-file-getprop file 'vc-rcs-default-branch)))
317 (and (not rev) 332 ;; Force branch creation if an appropriate
318 default-branch 333 ;; default branch has been set.
319 (string-match (concat "^" (regexp-quote old-version) "\\.") 334 (and (not rev)
320 default-branch) 335 default-branch
321 (setq rev default-branch) 336 (string-match (concat "^" (regexp-quote old-version) "\\.")
322 (setq switches (cons "-f" switches))) 337 default-branch)
323 (if (and (not rev) old-version) 338 (setq rev default-branch)
324 (setq rev (vc-branch-part old-version))) 339 (setq switches (cons "-f" switches)))
325 (apply 'vc-do-command nil 0 "ci" (vc-name file) 340 (if (and (not rev) old-version)
326 ;; if available, use the secure check-in option 341 (setq rev (vc-branch-part old-version)))
327 (and (vc-rcs-release-p "5.6.4") "-j") 342 (apply 'vc-do-command nil 0 "ci" (vc-name file)
328 (concat (if vc-keep-workfiles "-u" "-r") rev) 343 ;; if available, use the secure check-in option
329 (concat "-m" comment) 344 (and (vc-rcs-release-p "5.6.4") "-j")
330 switches) 345 (concat (if vc-keep-workfiles "-u" "-r") rev)
331 (vc-file-setprop file 'vc-workfile-version nil) 346 (concat "-m" comment)
332 347 switches)
333 ;; determine the new workfile version 348 (vc-file-setprop file 'vc-workfile-version nil)
334 (set-buffer "*vc*") 349
335 (goto-char (point-min)) 350 ;; determine the new workfile version
336 (when (or (re-search-forward 351 (set-buffer "*vc*")
337 "new revision: \\([0-9.]+\\);" nil t) 352 (goto-char (point-min))
338 (re-search-forward 353 (when (or (re-search-forward
339 "reverting to previous revision \\([0-9.]+\\)" nil t)) 354 "new revision: \\([0-9.]+\\);" nil t)
340 (setq new-version (match-string 1)) 355 (re-search-forward
341 (vc-file-setprop file 'vc-workfile-version new-version)) 356 "reverting to previous revision \\([0-9.]+\\)" nil t))
342 357 (setq new-version (match-string 1))
343 ;; if we got to a different branch, adjust the default 358 (vc-file-setprop file 'vc-workfile-version new-version))
344 ;; branch accordingly 359
345 (cond 360 ;; if we got to a different branch, adjust the default
346 ((and old-version new-version 361 ;; branch accordingly
347 (not (string= (vc-branch-part old-version) 362 (cond
348 (vc-branch-part new-version)))) 363 ((and old-version new-version
349 (vc-rcs-set-default-branch file 364 (not (string= (vc-branch-part old-version)
350 (if (vc-trunk-p new-version) nil 365 (vc-branch-part new-version))))
351 (vc-branch-part new-version))) 366 (vc-rcs-set-default-branch file
352 ;; If this is an old RCS release, we might have 367 (if (vc-trunk-p new-version) nil
353 ;; to remove a remaining lock. 368 (vc-branch-part new-version)))
354 (if (not (vc-rcs-release-p "5.6.2")) 369 ;; If this is an old RCS release, we might have
355 ;; exit status of 1 is also accepted. 370 ;; to remove a remaining lock.
356 ;; It means that the lock was removed before. 371 (if (not (vc-rcs-release-p "5.6.2"))
357 (vc-do-command nil 1 "rcs" (vc-name file) 372 ;; exit status of 1 is also accepted.
358 (concat "-u" old-version)))))))) 373 ;; It means that the lock was removed before.
374 (vc-do-command nil 1 "rcs" (vc-name file)
375 (concat "-u" old-version)))))))))
359 376
360(defun vc-rcs-find-version (file rev buffer) 377(defun vc-rcs-find-version (file rev buffer)
361 (apply 'vc-do-command 378 (apply 'vc-do-command
@@ -427,41 +444,48 @@ whether to remove it."
427 new-version))))) 444 new-version)))))
428 (message "Checking out %s...done" file))))) 445 (message "Checking out %s...done" file)))))
429 446
447(defun vc-rcs-rollback (files)
448 "Roll back, undoing the most recent checkins of FILES."
449 (if (not files)
450 (error "RCS backend doesn't support directory-level rollback."))
451 (dolist (file files)
452 (let* ((discard (vc-workfile-version file))
453 (previous (if (vc-trunk-p discard) "" (vc-branch-part discard)))
454 (config (current-window-configuration))
455 (done nil))
456 (if (null (yes-or-no-p (format "Remove version %s from %s history? "
457 discard file)))
458 (error "Aborted"))
459 (message "Removing revision %s from %s." discard file)
460 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" discard))
461 ;; Check out the most recent remaining version. If it
462 ;; fails, because the whole branch got deleted, do a
463 ;; double-take and check out the version where the branch
464 ;; started.
465 (while (not done)
466 (condition-case err
467 (progn
468 (vc-do-command nil 0 "co" (vc-name file) "-f"
469 (concat "-u" previous))
470 (setq done t))
471 (error (set-buffer "*vc*")
472 (goto-char (point-min))
473 (if (search-forward "no side branches present for" nil t)
474 (progn (setq previous (vc-branch-part previous))
475 (vc-rcs-set-default-branch file previous)
476 ;; vc-do-command popped up a window with
477 ;; the error message. Get rid of it, by
478 ;; restoring the old window configuration.
479 (set-window-configuration config))
480 ;; No, it was some other error: re-signal it.
481 (signal (car err) (cdr err)))))))))
482
430(defun vc-rcs-revert (file &optional contents-done) 483(defun vc-rcs-revert (file &optional contents-done)
431 "Revert FILE to the version it was based on." 484 "Revert FILE to the version it was based on."
432 (vc-do-command nil 0 "co" (vc-name file) "-f" 485 (vc-do-command nil 0 "co" (vc-name file) "-f"
433 (concat (if (eq (vc-state file) 'edited) "-u" "-r") 486 (concat (if (eq (vc-state file) 'edited) "-u" "-r")
434 (vc-workfile-version file)))) 487 (vc-workfile-version file))))
435 488
436(defun vc-rcs-cancel-version (file editable)
437 "Undo the most recent checkin of FILE.
438EDITABLE non-nil means previous version should be locked."
439 (let* ((target (vc-workfile-version file))
440 (previous (if (vc-trunk-p target) "" (vc-branch-part target)))
441 (config (current-window-configuration))
442 (done nil))
443 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" target))
444 ;; Check out the most recent remaining version. If it fails, because
445 ;; the whole branch got deleted, do a double-take and check out the
446 ;; version where the branch started.
447 (while (not done)
448 (condition-case err
449 (progn
450 (vc-do-command nil 0 "co" (vc-name file) "-f"
451 (concat (if editable "-l" "-u") previous))
452 (setq done t))
453 (error (set-buffer "*vc*")
454 (goto-char (point-min))
455 (if (search-forward "no side branches present for" nil t)
456 (progn (setq previous (vc-branch-part previous))
457 (vc-rcs-set-default-branch file previous)
458 ;; vc-do-command popped up a window with
459 ;; the error message. Get rid of it, by
460 ;; restoring the old window configuration.
461 (set-window-configuration config))
462 ;; No, it was some other error: re-signal it.
463 (signal (car err) (cdr err))))))))
464
465(defun vc-rcs-merge (file first-version &optional second-version) 489(defun vc-rcs-merge (file first-version &optional second-version)
466 "Merge changes into current working copy of FILE. 490 "Merge changes into current working copy of FILE.
467The changes are between FIRST-VERSION and SECOND-VERSION." 491The changes are between FIRST-VERSION and SECOND-VERSION."
@@ -484,19 +508,38 @@ Needs RCS 5.6.2 or later for -M."
484;;; History functions 508;;; History functions
485;;; 509;;;
486 510
487(defun vc-rcs-print-log (file &optional buffer) 511(defun vc-rcs-print-log (files &optional buffer)
488 "Get change log associated with FILE." 512 "Get change log associated with FILE."
489 (vc-do-command buffer 0 "rlog" (vc-name file))) 513 (vc-do-command buffer 0 "rlog" (mapcar 'vc-name files)))
490 514
491(defun vc-rcs-diff (file &optional oldvers newvers buffer) 515(defun vc-rcs-diff (files &optional oldvers newvers buffer)
492 "Get a difference report using RCS between two versions of FILE." 516 "Get a difference report using RCS between two sets of files."
493 (if (not oldvers) (setq oldvers (vc-workfile-version file))) 517 (apply 'vc-do-command (or buffer "*vc-diff*")
494 (apply 'vc-do-command (or buffer "*vc-diff*") 1 "rcsdiff" file 518 1 ;; Always go synchronous, the repo is local
519 "rcsdiff" (vc-expand-dirs files)
495 (append (list "-q" 520 (append (list "-q"
496 (concat "-r" oldvers) 521 (and oldvers (concat "-r" oldvers))
497 (and newvers (concat "-r" newvers))) 522 (and newvers (concat "-r" newvers)))
498 (vc-switches 'RCS 'diff)))) 523 (vc-switches 'RCS 'diff))))
499 524
525(defun vc-rcs-wash-log ()
526 "Remove all non-comment information from log output."
527 (let ((separator (concat "^-+\nrevision [0-9.]+\ndate: .*\n"
528 "\\(branches: .*;\n\\)?"
529 "\\(\\*\\*\\* empty log message \\*\\*\\*\n\\)?")))
530 (goto-char (point-max)) (forward-line -1)
531 (while (looking-at "=*\n")
532 (delete-char (- (match-end 0) (match-beginning 0)))
533 (forward-line -1))
534 (goto-char (point-min))
535 (if (looking-at "[\b\t\n\v\f\r ]+")
536 (delete-char (- (match-end 0) (match-beginning 0))))
537 (goto-char (point-min))
538 (re-search-forward separator nil t)
539 (delete-region (point-min) (point))
540 (while (re-search-forward separator nil t)
541 (delete-region (match-beginning 0) (match-end 0)))))
542
500(defun vc-rcs-annotate-command (file buffer &optional revision) 543(defun vc-rcs-annotate-command (file buffer &optional revision)
501 "Annotate FILE, inserting the results in BUFFER. 544 "Annotate FILE, inserting the results in BUFFER.
502Optional arg REVISION is a revision to annotate from." 545Optional arg REVISION is a revision to annotate from."
@@ -666,7 +709,6 @@ Optional arg REVISION is a revision to annotate from."
666 " " 709 " "
667 (aref rda 0) 710 (aref rda 0)
668 ls) 711 ls)
669 :vc-annotate-prefix t
670 :vc-rcs-r/d/a rda))) 712 :vc-rcs-r/d/a rda)))
671 (maphash 713 (maphash
672 (if all-me 714 (if all-me
diff --git a/lisp/vc-sccs.el b/lisp/vc-sccs.el
index bad1c2b3099..38f0442b192 100644
--- a/lisp/vc-sccs.el
+++ b/lisp/vc-sccs.el
@@ -27,6 +27,10 @@
27 27
28;;; Commentary: 28;;; Commentary:
29 29
30;; TODO:
31;; - remove call to vc-expand-dirs by implementing our own (which can just
32;; list the SCCS subdir instead).
33
30;;; Code: 34;;; Code:
31 35
32(eval-when-compile 36(eval-when-compile
@@ -85,6 +89,11 @@ For a description of possible values, see `vc-check-master-templates'."
85(defconst vc-sccs-name-assoc-file "VC-names") 89(defconst vc-sccs-name-assoc-file "VC-names")
86 90
87 91
92;;; Properties of the backend
93
94(defun vc-sccs-revision-granularity ()
95 'file)
96
88;;; 97;;;
89;;; State-querying functions 98;;; State-querying functions
90;;; 99;;;
@@ -161,16 +170,22 @@ For a description of possible values, see `vc-check-master-templates'."
161;;; State-changing functions 170;;; State-changing functions
162;;; 171;;;
163 172
164(defun vc-sccs-register (file &optional rev comment) 173(defun vc-sccs-create-repo ()
165 "Register FILE into the SCCS version-control system. 174 "Create a new SCCS repository."
175 ;; SCCS is totally file-oriented, so all we have to do is make the directory
176 (make-directory "SCCS"))
177
178(defun vc-sccs-register (files &optional rev comment)
179 "Register FILES into the SCCS version-control system.
166REV is the optional revision number for the file. COMMENT can be used 180REV is the optional revision number for the file. COMMENT can be used
167to provide an initial description of FILE. 181to provide an initial description of FILES.
168 182
169`vc-register-switches' and `vc-sccs-register-switches' are passed to 183`vc-register-switches' and `vc-sccs-register-switches' are passed to
170the SCCS command (in that order). 184the SCCS command (in that order).
171 185
172Automatically retrieve a read-only version of the file with keywords 186Automatically retrieve a read-only version of the files with keywords
173expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." 187expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
188 (dolist (file files)
174 (let* ((dirname (or (file-name-directory file) "")) 189 (let* ((dirname (or (file-name-directory file) ""))
175 (basename (file-name-nondirectory file)) 190 (basename (file-name-nondirectory file))
176 (project-file (vc-sccs-search-project-dir dirname basename))) 191 (project-file (vc-sccs-search-project-dir dirname basename)))
@@ -178,14 +193,14 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
178 (or project-file 193 (or project-file
179 (format (car vc-sccs-master-templates) dirname basename)))) 194 (format (car vc-sccs-master-templates) dirname basename))))
180 (apply 'vc-do-command nil 0 "admin" vc-name 195 (apply 'vc-do-command nil 0 "admin" vc-name
181 (and rev (concat "-r" rev)) 196 (and rev (not (string= rev "")) (concat "-r" rev))
182 "-fb" 197 "-fb"
183 (concat "-i" (file-relative-name file)) 198 (concat "-i" (file-relative-name file))
184 (and comment (concat "-y" comment)) 199 (and comment (concat "-y" comment))
185 (vc-switches 'SCCS 'register))) 200 (vc-switches 'SCCS 'register)))
186 (delete-file file) 201 (delete-file file)
187 (if vc-keep-workfiles 202 (if vc-keep-workfiles
188 (vc-do-command nil 0 "get" (vc-name file))))) 203 (vc-do-command nil 0 "get" (vc-name file))))))
189 204
190(defun vc-sccs-responsible-p (file) 205(defun vc-sccs-responsible-p (file)
191 "Return non-nil if SCCS thinks it would be responsible for registering FILE." 206 "Return non-nil if SCCS thinks it would be responsible for registering FILE."
@@ -194,14 +209,15 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
194 (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "") 209 (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "")
195 (file-name-nondirectory file))))) 210 (file-name-nondirectory file)))))
196 211
197(defun vc-sccs-checkin (file rev comment) 212(defun vc-sccs-checkin (files rev comment)
198 "SCCS-specific version of `vc-backend-checkin'." 213 "SCCS-specific version of `vc-backend-checkin'."
199 (apply 'vc-do-command nil 0 "delta" (vc-name file) 214 (dolist (file files)
200 (if rev (concat "-r" rev)) 215 (apply 'vc-do-command nil 0 "delta" (vc-name file)
201 (concat "-y" comment) 216 (if rev (concat "-r" rev))
202 (vc-switches 'SCCS 'checkin)) 217 (concat "-y" comment)
203 (if vc-keep-workfiles 218 (vc-switches 'SCCS 'checkin))
204 (vc-do-command nil 0 "get" (vc-name file)))) 219 (if vc-keep-workfiles
220 (vc-do-command nil 0 "get" (vc-name file)))))
205 221
206(defun vc-sccs-find-version (file rev buffer) 222(defun vc-sccs-find-version (file rev buffer)
207 (apply 'vc-do-command 223 (apply 'vc-do-command
@@ -242,6 +258,19 @@ locked. REV is the revision to check out."
242 switches)))) 258 switches))))
243 (message "Checking out %s...done" file))) 259 (message "Checking out %s...done" file)))
244 260
261(defun vc-sccs-cancel-version (files)
262 "Roll back, undoing the most recent checkins of FILES."
263 (if (not files)
264 (error "SCCS backend doesn't support directory-level rollback."))
265 (dolist (file files)
266 (let ((discard (vc-workfile-version file)))
267 (if (null (yes-or-no-p (format "Remove version %s from %s history? "
268 discard file)))
269 (error "Aborted"))
270 (message "Removing revision %s from %s..." discard file)
271 (vc-do-command nil 0 "rmdel" (vc-name file) (concat "-r" discard))
272 (vc-do-command nil 0 "get" (vc-name file) nil))))
273
245(defun vc-sccs-revert (file &optional contents-done) 274(defun vc-sccs-revert (file &optional contents-done)
246 "Revert FILE to the version it was based on." 275 "Revert FILE to the version it was based on."
247 (vc-do-command nil 0 "unget" (vc-name file)) 276 (vc-do-command nil 0 "unget" (vc-name file))
@@ -251,16 +280,6 @@ locked. REV is the revision to check out."
251 ;; vc-workfile-version is cleared here so that it gets recomputed. 280 ;; vc-workfile-version is cleared here so that it gets recomputed.
252 (vc-file-setprop file 'vc-workfile-version nil)) 281 (vc-file-setprop file 'vc-workfile-version nil))
253 282
254(defun vc-sccs-cancel-version (file editable)
255 "Undo the most recent checkin of FILE.
256EDITABLE non-nil means previous version should be locked."
257 (vc-do-command nil 0 "rmdel"
258 (vc-name file)
259 (concat "-r" (vc-workfile-version file)))
260 (vc-do-command nil 0 "get"
261 (vc-name file)
262 (if editable "-e")))
263
264(defun vc-sccs-steal-lock (file &optional rev) 283(defun vc-sccs-steal-lock (file &optional rev)
265 "Steal the lock on the current workfile for FILE and revision REV." 284 "Steal the lock on the current workfile for FILE and revision REV."
266 (vc-do-command nil 0 "unget" (vc-name file) "-n" (if rev (concat "-r" rev))) 285 (vc-do-command nil 0 "unget" (vc-name file) "-n" (if rev (concat "-r" rev)))
@@ -271,9 +290,14 @@ EDITABLE non-nil means previous version should be locked."
271;;; History functions 290;;; History functions
272;;; 291;;;
273 292
274(defun vc-sccs-print-log (file &optional buffer) 293(defun vc-sccs-print-log (files &optional buffer)
275 "Get change log associated with FILE." 294 "Get change log associated with FILES."
276 (vc-do-command buffer 0 "prs" (vc-name file))) 295 (vc-do-command buffer 0 "prs" (mapcar 'vc-name files)))
296
297(defun vc-sccs-wash-log ()
298 "Remove all non-comment information from log output."
299 ;; FIXME: not implemented for SCCS
300 nil)
277 301
278(defun vc-sccs-logentry-check () 302(defun vc-sccs-logentry-check ()
279 "Check that the log entry in the current buffer is acceptable for SCCS." 303 "Check that the log entry in the current buffer is acceptable for SCCS."
@@ -281,11 +305,12 @@ EDITABLE non-nil means previous version should be locked."
281 (goto-char 512) 305 (goto-char 512)
282 (error "Log must be less than 512 characters; point is now at pos 512"))) 306 (error "Log must be less than 512 characters; point is now at pos 512")))
283 307
284(defun vc-sccs-diff (file &optional oldvers newvers buffer) 308(defun vc-sccs-diff (files &optional oldvers newvers buffer)
285 "Get a difference report using SCCS between two versions of FILE." 309 "Get a difference report using SCCS between two filesets."
286 (setq oldvers (vc-sccs-lookup-triple file oldvers)) 310 (setq oldvers (vc-sccs-lookup-triple file oldvers))
287 (setq newvers (vc-sccs-lookup-triple file newvers)) 311 (setq newvers (vc-sccs-lookup-triple file newvers))
288 (apply 'vc-do-command (or buffer "*vc-diff*") 1 "vcdiff" (vc-name file) 312 (apply 'vc-do-command (or buffer "*vc-diff*")
313 1 "vcdiff" (mapcar 'vc-name (vc-expand-dirs files))
289 (append (list "-q" 314 (append (list "-q"
290 (and oldvers (concat "-r" oldvers)) 315 (and oldvers (concat "-r" oldvers))
291 (and newvers (concat "-r" newvers))) 316 (and newvers (concat "-r" newvers)))
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el
index 2c6046cab36..1539c5c2d5d 100644
--- a/lisp/vc-svn.el
+++ b/lisp/vc-svn.el
@@ -96,6 +96,10 @@ If you want to force an empty list of arguments, use t."
96 (t ".svn")) 96 (t ".svn"))
97 "The name of the \".svn\" subdirectory or its equivalent.") 97 "The name of the \".svn\" subdirectory or its equivalent.")
98 98
99;;; Properties of the backend
100
101(defun vc-svn-revision-granularity ()
102 'repository)
99;;; 103;;;
100;;; State-querying functions 104;;; State-querying functions
101;;; 105;;;
@@ -206,13 +210,19 @@ If you want to force an empty list of arguments, use t."
206;;; State-changing functions 210;;; State-changing functions
207;;; 211;;;
208 212
209(defun vc-svn-register (file &optional rev comment) 213(defun vc-svn-create-repo ()
210 "Register FILE into the SVN version-control system. 214 "Create a new SVN repository."
211COMMENT can be used to provide an initial description of FILE. 215 (vc-do-command nil 0 "svnadmin" '("create" "SVN"))
216 (vc-do-command nil 0 "svn" '(".")
217 "checkout" (concat "file://" default-directory "SVN")))
218
219(defun vc-svn-register (files &optional rev comment)
220 "Register FILES into the SVN version-control system.
221The COMMENT argument is ignored This does an add but not a commit.
212 222
213`vc-register-switches' and `vc-svn-register-switches' are passed to 223`vc-register-switches' and `vc-svn-register-switches' are passed to
214the SVN command (in that order)." 224the SVN command (in that order)."
215 (apply 'vc-svn-command nil 0 file "add" (vc-switches 'SVN 'register))) 225 (apply 'vc-svn-command nil 0 files "add" (vc-switches 'SVN 'register)))
216 226
217(defun vc-svn-responsible-p (file) 227(defun vc-svn-responsible-p (file)
218 "Return non-nil if SVN thinks it is responsible for FILE." 228 "Return non-nil if SVN thinks it is responsible for FILE."
@@ -225,10 +235,11 @@ the SVN command (in that order)."
225 "Return non-nil if FILE could be registered in SVN. 235 "Return non-nil if FILE could be registered in SVN.
226This is only possible if SVN is responsible for FILE's directory.") 236This is only possible if SVN is responsible for FILE's directory.")
227 237
228(defun vc-svn-checkin (file rev comment) 238(defun vc-svn-checkin (files rev comment)
229 "SVN-specific version of `vc-backend-checkin'." 239 "SVN-specific version of `vc-backend-checkin'."
240 (if rev (error "Committing to a specific revision is unsupported in SVN."))
230 (let ((status (apply 241 (let ((status (apply
231 'vc-svn-command nil 1 file "ci" 242 'vc-svn-command nil 1 files "ci"
232 (nconc (list "-m" comment) (vc-switches 'SVN 'checkin))))) 243 (nconc (list "-m" comment) (vc-switches 'SVN 'checkin)))))
233 (set-buffer "*vc*") 244 (set-buffer "*vc*")
234 (goto-char (point-min)) 245 (goto-char (point-min))
@@ -236,7 +247,8 @@ This is only possible if SVN is responsible for FILE's directory.")
236 ;; Check checkin problem. 247 ;; Check checkin problem.
237 (cond 248 (cond
238 ((search-forward "Transaction is out of date" nil t) 249 ((search-forward "Transaction is out of date" nil t)
239 (vc-file-setprop file 'vc-state 'needs-merge) 250 (mapc (lambda (file) (vc-file-setprop file 'vc-state 'needs-merge))
251 files)
240 (error (substitute-command-keys 252 (error (substitute-command-keys
241 (concat "Up-to-date check failed: " 253 (concat "Up-to-date check failed: "
242 "type \\[vc-next-action] to merge in changes")))) 254 "type \\[vc-next-action] to merge in changes"))))
@@ -252,6 +264,7 @@ This is only possible if SVN is responsible for FILE's directory.")
252 )) 264 ))
253 265
254(defun vc-svn-find-version (file rev buffer) 266(defun vc-svn-find-version (file rev buffer)
267 "SVN-specific retrieval of a specified version into a buffer."
255 (apply 'vc-svn-command 268 (apply 'vc-svn-command
256 buffer 0 file 269 buffer 0 file
257 "cat" 270 "cat"
@@ -362,53 +375,41 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
362;;; History functions 375;;; History functions
363;;; 376;;;
364 377
365(defun vc-svn-print-log (file &optional buffer) 378(defun vc-svn-print-log (files &optional buffer)
366 "Get change log associated with FILE." 379 "Get change log(s) associated with FILES."
367 (save-current-buffer 380 (save-current-buffer
368 (vc-setup-buffer buffer) 381 (vc-setup-buffer buffer)
369 (let ((inhibit-read-only t)) 382 (let ((inhibit-read-only t))
370 (goto-char (point-min)) 383 (goto-char (point-min))
371 ;; Add a line to tell log-view-mode what file this is. 384 ;; Add a line to tell log-view-mode what file this is.
372 (insert "Working file: " (file-relative-name file) "\n")) 385 (insert "Working file(s): " (vc-delistify (mapcar 'file-relative-name files)) "\n"))
373 (vc-svn-command 386 (vc-svn-command
374 buffer 387 buffer
375 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) 388 (if (and (= (length files) 1) (vc-stay-local-p (car files)) (fboundp 'start-process)) 'async 0)
376 file "log" 389 files "log"
377 ;; By default Subversion only shows the log upto the working version, 390 ;; By default Subversion only shows the log upto the working version,
378 ;; whereas we also want the log of the subsequent commits. At least 391 ;; whereas we also want the log of the subsequent commits. At least
379 ;; that's what the vc-cvs.el code does. 392 ;; that's what the vc-cvs.el code does.
380 "-rHEAD:0"))) 393 "-rHEAD:0")))
381 394
382(defun vc-svn-diff (file &optional oldvers newvers buffer) 395(defun vc-svn-wash-log ()
383 "Get a difference report using SVN between two versions of FILE." 396 "Remove all non-comment information from log output."
384 (unless buffer (setq buffer "*vc-diff*")) 397 ;; FIXME: not implemented for SVN
385 (if (and oldvers (equal oldvers (vc-workfile-version file))) 398 nil)
386 ;; Use nil rather than the current revision because svn handles it 399
387 ;; better (i.e. locally). 400(defun vc-svn-diff (files &optional oldvers newvers buffer)
388 (setq oldvers nil)) 401 "Get a difference report using SVN between two versions of fileset FILES."
389 (if (string= (vc-workfile-version file) "0") 402 (let* ((switches
390 ;; This file is added but not yet committed; there is no master file.
391 (if (or oldvers newvers)
392 (error "No revisions of %s exist" file)
393 ;; We regard this as "changed".
394 ;; Diff it against /dev/null.
395 ;; Note: this is NOT a "svn diff".
396 (apply 'vc-do-command buffer
397 1 "diff" file
398 (append (vc-switches nil 'diff) '("/dev/null")))
399 ;; Even if it's empty, it's locally modified.
400 1)
401 (let* ((switches
402 (if vc-svn-diff-switches 403 (if vc-svn-diff-switches
403 (vc-switches 'SVN 'diff) 404 (vc-switches 'SVN 'diff)
404 (list "-x" (mapconcat 'identity (vc-switches nil 'diff) " ")))) 405 (list "-x" (mapconcat 'identity (vc-switches nil 'diff) " "))))
405 (async (and (not vc-disable-async-diff) 406 (async (and (not vc-disable-async-diff)
406 (vc-stay-local-p file) 407 (vc-stay-local-p files)
407 (or oldvers newvers) ; Svn diffs those locally. 408 (or oldvers newvers) ; Svn diffs those locally.
408 (fboundp 'start-process)))) 409 (fboundp 'start-process))))
409 (apply 'vc-svn-command buffer 410 (apply 'vc-svn-command buffer
410 (if async 'async 0) 411 (if async 'async 0)
411 file "diff" 412 files "diff"
412 (append 413 (append
413 switches 414 switches
414 (when oldvers 415 (when oldvers
@@ -417,7 +418,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
417 (if async 1 ; async diff => pessimistic assumption 418 (if async 1 ; async diff => pessimistic assumption
418 ;; For some reason `svn diff' does not return a useful 419 ;; For some reason `svn diff' does not return a useful
419 ;; status w.r.t whether the diff was empty or not. 420 ;; status w.r.t whether the diff was empty or not.
420 (buffer-size (get-buffer buffer)))))) 421 (buffer-size (get-buffer buffer)))))
421 422
422(defun vc-svn-diff-tree (dir &optional rev1 rev2) 423(defun vc-svn-diff-tree (dir &optional rev1 rev2)
423 "Diff all files at and below DIR." 424 "Diff all files at and below DIR."
@@ -469,11 +470,11 @@ NAME is assumed to be a URL."
469 :type 'string 470 :type 'string
470 :group 'vc) 471 :group 'vc)
471 472
472(defun vc-svn-command (buffer okstatus file &rest flags) 473(defun vc-svn-command (buffer okstatus file-or-list &rest flags)
473 "A wrapper around `vc-do-command' for use in vc-svn.el. 474 "A wrapper around `vc-do-command' for use in vc-svn.el.
474The difference to vc-do-command is that this function always invokes `svn', 475The difference to vc-do-command is that this function always invokes `svn',
475and that it passes `vc-svn-global-switches' to it before FLAGS." 476and that it passes `vc-svn-global-switches' to it before FLAGS."
476 (apply 'vc-do-command buffer okstatus vc-svn-program file 477 (apply 'vc-do-command buffer okstatus vc-svn-program file-or-list
477 (if (stringp vc-svn-global-switches) 478 (if (stringp vc-svn-global-switches)
478 (cons vc-svn-global-switches flags) 479 (cons vc-svn-global-switches flags)
479 (append vc-svn-global-switches 480 (append vc-svn-global-switches
diff --git a/lisp/vc.el b/lisp/vc.el
index a147f7e4dd0..0bbaf33d78d 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -46,8 +46,9 @@
46 46
47;; This mode is fully documented in the Emacs user's manual. 47;; This mode is fully documented in the Emacs user's manual.
48;; 48;;
49;; Supported version-control systems presently include CVS, RCS, GNU Arch, 49;; Supported version-control systems presently include CVS, RCS, GNU
50;; Subversion, Meta-CVS, and SCCS (or its free replacement, CSSC). 50;; Arch, Subversion, Bzr, Mercurial, Meta-CVS, and SCCS (or its free
51;; replacement, CSSC).
51;; 52;;
52;; Some features will not work with old RCS versions. Where 53;; Some features will not work with old RCS versions. Where
53;; appropriate, VC finds out which version you have, and allows or 54;; appropriate, VC finds out which version you have, and allows or
@@ -101,13 +102,23 @@
101;; with `vc-sys-'. Some of the functions are mandatory (marked with a 102;; with `vc-sys-'. Some of the functions are mandatory (marked with a
102;; `*'), others are optional (`-'). 103;; `*'), others are optional (`-').
103;; 104;;
105;; BACKEND PROPERTIES
106;;
107;; * revision-granularity
108;;
109;; Takes no arguments. Returns either 'file or 'repository.
110;;
104;; STATE-QUERYING FUNCTIONS 111;; STATE-QUERYING FUNCTIONS
105;; 112;;
106;; * registered (file) 113;; * registered (file)
107;; 114;;
108;; Return non-nil if FILE is registered in this backend. Both this 115;; Return non-nil if FILE is registered in this backend. Both this
109;; function as well as `state' should be careful to fail gracefully in the 116;; function as well as `state' should be careful to fail gracefully
110;; event that the backend executable is absent. 117;; in the event that the backend executable is absent. It is
118;; preferable that this function's body is autoloaded, that way only
119;; calling vc-registered does not cause the backend to be loaded
120;; (all the vc-FOO-registered functions are called to try to find
121;; the controlling backend for FILE.
111;; 122;;
112;; * state (file) 123;; * state (file)
113;; 124;;
@@ -159,9 +170,12 @@
159;; 170;;
160;; - mode-line-string (file) 171;; - mode-line-string (file)
161;; 172;;
162;; If provided, this function should return the VC-specific mode line 173;; If provided, this function should return the VC-specific mode
163;; string for FILE. The default implementation deals well with all 174;; line string for FILE. The returned string should have a
164;; states that `vc-state' can return. 175;; `help-echo' property which is the text to be displayed as a
176;; tooltip when the mouse hovers over the VC entry on the mode-line.
177;; The default implementation deals well with all states that
178;; `vc-state' can return.
165;; 179;;
166;; - dired-state-info (file) 180;; - dired-state-info (file)
167;; 181;;
@@ -171,12 +185,20 @@
171;; 185;;
172;; STATE-CHANGING FUNCTIONS 186;; STATE-CHANGING FUNCTIONS
173;; 187;;
174;; * register (file &optional rev comment) 188;; * create-repo ()
175;; 189;;
176;; Register FILE in this backend. Optionally, an initial revision REV 190;; Create an empty repository in the current directory and initialize
177;; and an initial description of the file, COMMENT, may be specified. 191;; it so VC mode can add files to it. For file-oriented systems, this
192;; need do no more than create a subdirectory with the right name.
193;;
194;; * register (files &optional rev comment)
195;;
196;; Register FILES in this backend. Optionally, an initial revision REV
197;; and an initial description of the file, COMMENT, may be specified,
198;; but it is not guaranteed that the backend will do anything with this.
178;; The implementation should pass the value of vc-register-switches 199;; The implementation should pass the value of vc-register-switches
179;; to the backend command. 200;; to the backend command. (Note: in older versions of VC, this
201;; command took a single file argument and not a list.)
180;; 202;;
181;; - init-version (file) 203;; - init-version (file)
182;; 204;;
@@ -210,12 +232,14 @@
210;; Unregister FILE from this backend. This is only needed if this 232;; Unregister FILE from this backend. This is only needed if this
211;; backend may be used as a "more local" backend for temporary editing. 233;; backend may be used as a "more local" backend for temporary editing.
212;; 234;;
213;; * checkin (file rev comment) 235;; * checkin (files rev comment)
214;; 236;;
215;; Commit changes in FILE to this backend. If REV is non-nil, that 237;; Commit changes in FILES to this backend. If REV is non-nil, that
216;; should become the new revision number. COMMENT is used as a 238;; should become the new revision number (not all backends do
217;; check-in comment. The implementation should pass the value of 239;; anything with it). COMMENT is used as a check-in comment. The
218;; vc-checkin-switches to the backend command. 240;; implementation should pass the value of vc-checkin-switches to
241;; the backend command. (Note: in older versions of VC, this
242;; command took a single file argument and not a list.)
219;; 243;;
220;; * find-version (file rev buffer) 244;; * find-version (file rev buffer)
221;; 245;;
@@ -242,13 +266,14 @@
242;; already been reverted from a version backup, and this function 266;; already been reverted from a version backup, and this function
243;; only needs to update the status of FILE within the backend. 267;; only needs to update the status of FILE within the backend.
244;; 268;;
245;; - cancel-version (file editable) 269;; - rollback (files)
246;; 270;;
247;; Cancel the current workfile version of FILE, i.e. remove it from the 271;; Remove the tip version of each of FILES from the repository. If
248;; master. EDITABLE non-nil means that FILE should be writable 272;; this function is not provided, trying to cancel a version is
249;; afterwards, and if locking is used for FILE, then a lock should also 273;; caught as an error. (Most backends don't provide it.) (Also
250;; be set. If this function is not provided, trying to cancel a 274;; note that older versions of this backend command were called
251;; version is caught as an error. 275;; 'cancel-version' and took a single file arg, not a list of
276;; files.)
252;; 277;;
253;; - merge (file rev1 rev2) 278;; - merge (file rev1 rev2)
254;; 279;;
@@ -267,10 +292,11 @@
267;; 292;;
268;; HISTORY FUNCTIONS 293;; HISTORY FUNCTIONS
269;; 294;;
270;; * print-log (file &optional buffer) 295;; * print-log (files &optional buffer)
271;; 296;;
272;; Insert the revision log of FILE into BUFFER, or the *vc* buffer 297;; Insert the revision log for FILES into BUFFER, or the *vc* buffer
273;; if BUFFER is nil. 298;; if BUFFER is nil. (Note: older versions of this function expected
299;; only a single file argument.)
274;; 300;;
275;; - log-view-mode () 301;; - log-view-mode ()
276;; 302;;
@@ -560,7 +586,8 @@ These are passed to the checkin program by \\[vc-register]."
560 :group 'vc 586 :group 'vc
561 :version "20.3") 587 :version "20.3")
562 588
563(defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS" "MCVS" ".svn" "{arch}") 589(defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS" "MCVS" ".svn"
590 ".hg" ".bzr" "{arch}")
564 "List of directory names to be ignored when walking directory trees." 591 "List of directory names to be ignored when walking directory trees."
565 :type '(repeat string) 592 :type '(repeat string)
566 :group 'vc) 593 :group 'vc)
@@ -588,7 +615,7 @@ to use -L and sets this variable to remember whether it worked."
588 :group 'vc) 615 :group 'vc)
589 616
590(defcustom vc-allow-async-revert nil 617(defcustom vc-allow-async-revert nil
591 "Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous. 618 "Specifies whether the diff during \\[vc-revert] may be asynchronous.
592Enabling this option means that you can confirm a revert operation even 619Enabling this option means that you can confirm a revert operation even
593if the local changes in the file have not been found and displayed yet." 620if the local changes in the file have not been found and displayed yet."
594 :type '(choice (const :tag "No" nil) 621 :type '(choice (const :tag "No" nil)
@@ -976,9 +1003,13 @@ Else, add CODE to the process' sentinel."
976Each function is called inside the buffer in which the command was run 1003Each function is called inside the buffer in which the command was run
977and is passed 3 arguments: the COMMAND, the FILE and the FLAGS.") 1004and is passed 3 arguments: the COMMAND, the FILE and the FLAGS.")
978 1005
1006(defun vc-delistify (filelist)
1007 "Smash a FILELIST into a file list string suitable for info messages."
1008 (if (not filelist) "." (mapconcat 'identity filelist " ")))
1009
979(defvar w32-quote-process-args) 1010(defvar w32-quote-process-args)
980;;;###autoload 1011;;;###autoload
981(defun vc-do-command (buffer okstatus command file &rest flags) 1012(defun vc-do-command (buffer okstatus command file-or-list &rest flags)
982 "Execute a VC command, notifying user and checking for errors. 1013 "Execute a VC command, notifying user and checking for errors.
983Output from COMMAND goes to BUFFER, or *vc* if BUFFER is nil or the 1014Output from COMMAND goes to BUFFER, or *vc* if BUFFER is nil or the
984current buffer if BUFFER is t. If the destination buffer is not 1015current buffer if BUFFER is t. If the destination buffer is not
@@ -986,65 +1017,69 @@ already current, set it up properly and erase it. The command is
986considered successful if its exit status does not exceed OKSTATUS (if 1017considered successful if its exit status does not exceed OKSTATUS (if
987OKSTATUS is nil, that means to ignore error status, if it is `async', that 1018OKSTATUS is nil, that means to ignore error status, if it is `async', that
988means not to wait for termination of the subprocess; if it is t it means to 1019means not to wait for termination of the subprocess; if it is t it means to
989ignore all execution errors). FILE is the 1020ignore all execution errors). FILE-OR-LIST is the name of a working file;
990name of the working file (may also be nil, to execute commands that 1021it may be a list of files or be nil (to execute commands that don't expect
991don't expect a file name). If an optional list of FLAGS is present, 1022a file name or set of files). If an optional list of FLAGS is present,
992that is inserted into the command line before the filename." 1023that is inserted into the command line before the filename."
993 (and file (setq file (expand-file-name file))) 1024 ;; FIXME: file-relative-name can return a bogus result because
994 (if vc-command-messages 1025 ;; it doesn't look at the actual file-system to see if symlinks
995 (message "Running %s on %s..." command file)) 1026 ;; come into play.
996 (save-current-buffer 1027 (let* ((files
997 (unless (or (eq buffer t) 1028 (mapcar (lambda (f) (file-relative-name (expand-file-name f)))
998 (and (stringp buffer) 1029 (if (listp file-or-list) file-or-list (list file-or-list))))
999 (string= (buffer-name) buffer)) 1030 (full-command
1000 (eq buffer (current-buffer))) 1031 (concat command " " (vc-delistify flags) " " (vc-delistify files))))
1001 (vc-setup-buffer buffer)) 1032 (if vc-command-messages
1002 (let ((squeezed (remq nil flags)) 1033 (message "Running %s..." full-command))
1003 (inhibit-read-only t) 1034 (save-current-buffer
1004 (status 0)) 1035 (unless (or (eq buffer t)
1005 (when file 1036 (and (stringp buffer)
1006 ;; FIXME: file-relative-name can return a bogus result because 1037 (string= (buffer-name) buffer))
1007 ;; it doesn't look at the actual file-system to see if symlinks 1038 (eq buffer (current-buffer)))
1008 ;; come into play. 1039 (vc-setup-buffer buffer))
1009 (setq squeezed (append squeezed (list (file-relative-name file))))) 1040 (let ((squeezed (remq nil flags))
1010 (let ((exec-path (append vc-path exec-path)) 1041 (inhibit-read-only t)
1011 ;; Add vc-path to PATH for the execution of this command. 1042 (status 0))
1012 (process-environment 1043 (when files
1013 (cons (concat "PATH=" (getenv "PATH") 1044 (setq squeezed (nconc squeezed files)))
1014 path-separator 1045 (let ((exec-path (append vc-path exec-path))
1015 (mapconcat 'identity vc-path path-separator)) 1046 ;; Add vc-path to PATH for the execution of this command.
1016 process-environment)) 1047 (process-environment
1017 (w32-quote-process-args t)) 1048 (cons (concat "PATH=" (getenv "PATH")
1018 (if (and (eq okstatus 'async) (file-remote-p default-directory)) 1049 path-separator
1019 ;; start-process does not support remote execution 1050 (mapconcat 'identity vc-path path-separator))
1020 (setq okstatus nil)) 1051 process-environment))
1021 (if (eq okstatus 'async) 1052 (w32-quote-process-args t))
1022 (let ((proc 1053 (if (and (eq okstatus 'async) (file-remote-p default-directory))
1023 (let ((process-connection-type nil)) 1054 ;; start-process does not support remote execution
1024 (apply 'start-process command (current-buffer) command 1055 (setq okstatus nil))
1025 squeezed)))) 1056 (if (eq okstatus 'async)
1026 (unless (active-minibuffer-window) 1057 (let ((proc
1027 (message "Running %s in the background..." command)) 1058 (let ((process-connection-type nil))
1028 ;;(set-process-sentinel proc (lambda (p msg) (delete-process p))) 1059 (apply 'start-process command (current-buffer) command
1029 (set-process-filter proc 'vc-process-filter) 1060 squeezed))))
1030 (vc-exec-after 1061 (unless (active-minibuffer-window)
1031 `(unless (active-minibuffer-window) 1062 (message "Running %s in the background..." full-command))
1032 (message "Running %s in the background... done" ',command)))) 1063 ;;(set-process-sentinel proc (lambda (p msg) (delete-process p)))
1033 (let ((buffer-undo-list t)) 1064 (set-process-filter proc 'vc-process-filter)
1034 (setq status (apply 'process-file command nil t nil squeezed))) 1065 (vc-exec-after
1035 (when (and (not (eq t okstatus)) 1066 `(unless (active-minibuffer-window)
1036 (or (not (integerp status)) 1067 (message "Running %s in the background... done" ',full-command))))
1037 (and okstatus (< okstatus status)))) 1068 (let ((buffer-undo-list t))
1038 (pop-to-buffer (current-buffer)) 1069 (setq status (apply 'process-file command nil t nil squeezed)))
1039 (goto-char (point-min)) 1070 (when (and (not (eq t okstatus))
1040 (shrink-window-if-larger-than-buffer) 1071 (or (not (integerp status))
1041 (error "Running %s...FAILED (%s)" command 1072 (and okstatus (< okstatus status))))
1042 (if (integerp status) (format "status %d" status) status)))) 1073 (pop-to-buffer (current-buffer))
1043 (if vc-command-messages 1074 (goto-char (point-min))
1044 (message "Running %s...OK" command))) 1075 (shrink-window-if-larger-than-buffer)
1045 (vc-exec-after 1076 (error "Running %s...FAILED (%s)" full-command
1046 `(run-hook-with-args 'vc-post-command-functions ',command ',file ',flags)) 1077 (if (integerp status) (format "status %d" status) status))))
1047 status))) 1078 (if vc-command-messages
1079 (message "Running %s...OK" full-command)))
1080 (vc-exec-after
1081 `(run-hook-with-args 'vc-post-command-functions ',command ',file-or-list ',flags))
1082 status))))
1048 1083
1049(defun vc-position-context (posn) 1084(defun vc-position-context (posn)
1050 "Save a bit of the text around POSN in the current buffer. 1085 "Save a bit of the text around POSN in the current buffer.
@@ -1274,7 +1309,7 @@ If VERBOSE is non-nil, query the user rather than using default parameters."
1274 ;; DO NOT revert the file without asking the user! 1309 ;; DO NOT revert the file without asking the user!
1275 (if (not visited) (find-file-other-window file)) 1310 (if (not visited) (find-file-other-window file))
1276 (if (yes-or-no-p "Revert to master version? ") 1311 (if (yes-or-no-p "Revert to master version? ")
1277 (vc-revert-buffer))) 1312 (vc-revert)))
1278 (t ;; normal action 1313 (t ;; normal action
1279 (if (not verbose) 1314 (if (not verbose)
1280 (vc-checkin file nil comment) 1315 (vc-checkin file nil comment)
@@ -1464,7 +1499,7 @@ first backend that could register the file is used."
1464 (message "Registering %s... " file) 1499 (message "Registering %s... " file)
1465 (let ((backend (vc-responsible-backend file t))) 1500 (let ((backend (vc-responsible-backend file t)))
1466 (vc-file-clearprops file) 1501 (vc-file-clearprops file)
1467 (vc-call-backend backend 'register file rev comment) 1502 (vc-call-backend backend 'register (list file) rev comment)
1468 (vc-file-setprop file 'vc-backend backend) 1503 (vc-file-setprop file 'vc-backend backend)
1469 (unless vc-make-backup-files 1504 (unless vc-make-backup-files
1470 (make-local-variable 'backup-inhibited) 1505 (make-local-variable 'backup-inhibited)
@@ -1520,6 +1555,16 @@ The default is to return nil always."
1520The default implementation returns t for all files." 1555The default implementation returns t for all files."
1521 t) 1556 t)
1522 1557
1558(defun vc-expand-dirs (file-or-dir-list)
1559 "Expands directories in a file list specification.
1560Only files already under version control are noticed."
1561 ;; FIXME: Kill this function.
1562 (let ((flattened '()))
1563 (dolist (node file-or-dir-list)
1564 (vc-file-tree-walk
1565 node (lambda (f) (if (vc-backend f) (push f flattened)))))
1566 (nreverse flattened)))
1567
1523(defun vc-resynch-window (file &optional keep noquery) 1568(defun vc-resynch-window (file &optional keep noquery)
1524 "If FILE is in the current buffer, either revert or unvisit it. 1569 "If FILE is in the current buffer, either revert or unvisit it.
1525The choice between revert (to see expanded keywords) and unvisit depends on 1570The choice between revert (to see expanded keywords) and unvisit depends on
@@ -1676,7 +1721,7 @@ Runs the normal hook `vc-checkin-hook'."
1676 ;; Change buffers to get local value of vc-checkin-switches. 1721 ;; Change buffers to get local value of vc-checkin-switches.
1677 (with-current-buffer (or (get-file-buffer file) (current-buffer)) 1722 (with-current-buffer (or (get-file-buffer file) (current-buffer))
1678 (progn 1723 (progn
1679 (vc-call checkin file rev comment) 1724 (vc-call checkin (list file) rev comment)
1680 (vc-delete-automatic-version-backups file))) 1725 (vc-delete-automatic-version-backups file)))
1681 `((vc-state . up-to-date) 1726 `((vc-state . up-to-date)
1682 (vc-checkout-time . ,(nth 5 (file-attributes file))) 1727 (vc-checkout-time . ,(nth 5 (file-attributes file)))
@@ -1896,7 +1941,7 @@ actually call the backend, but performs a local diff."
1896 (error "diff failed")) 1941 (error "diff failed"))
1897 (if (not vc-diff-knows-L) (setq vc-diff-knows-L 'yes))) 1942 (if (not vc-diff-knows-L) (setq vc-diff-knows-L 'yes)))
1898 status) 1943 status)
1899 (vc-call diff file rev1 rev2)))) 1944 (vc-call diff (list file) rev1 rev2 "*vc-diff*"))))
1900 1945
1901(defun vc-switches (backend op) 1946(defun vc-switches (backend op)
1902 (let ((switches 1947 (let ((switches
@@ -2467,7 +2512,7 @@ If FOCUS-REV is non-nil, leave the point at that revision."
2467 ;; buffer can be accessed by the command. 2512 ;; buffer can be accessed by the command.
2468 (condition-case err 2513 (condition-case err
2469 (progn 2514 (progn
2470 (vc-call print-log file "*vc-change-log*") 2515 (vc-call print-log (list file) "*vc-change-log*")
2471 (set-buffer "*vc-change-log*")) 2516 (set-buffer "*vc-change-log*"))
2472 (wrong-number-of-arguments 2517 (wrong-number-of-arguments
2473 ;; If this error came from the above call to print-log, try again 2518 ;; If this error came from the above call to print-log, try again
@@ -2480,7 +2525,7 @@ If FOCUS-REV is non-nil, leave the point at that revision."
2480 (not (eq (caddr err) 2))) 2525 (not (eq (caddr err) 2)))
2481 (signal (car err) (cdr err)) 2526 (signal (car err) (cdr err))
2482 ;; for backward compatibility 2527 ;; for backward compatibility
2483 (vc-call print-log file) 2528 (vc-call print-log (list file))
2484 (set-buffer "*vc*")))) 2529 (set-buffer "*vc*"))))
2485 (pop-to-buffer (current-buffer)) 2530 (pop-to-buffer (current-buffer))
2486 (vc-exec-after 2531 (vc-exec-after
@@ -2509,7 +2554,7 @@ If FOCUS-REV is non-nil, leave the point at that revision."
2509 "Return a string with all log entries stored in BACKEND for FILE." 2554 "Return a string with all log entries stored in BACKEND for FILE."
2510 (if (vc-find-backend-function backend 'print-log) 2555 (if (vc-find-backend-function backend 'print-log)
2511 (with-current-buffer "*vc*" 2556 (with-current-buffer "*vc*"
2512 (vc-call print-log file) 2557 (vc-call print-log (list file))
2513 (vc-call wash-log file) 2558 (vc-call wash-log file)
2514 (buffer-string)))) 2559 (buffer-string))))
2515 2560
@@ -2534,7 +2579,7 @@ it if their logs are not in RCS format."
2534 (delete-region (match-beginning 0) (match-end 0))))) 2579 (delete-region (match-beginning 0) (match-end 0)))))
2535 2580
2536;;;###autoload 2581;;;###autoload
2537(defun vc-revert-buffer () 2582(defun vc-revert ()
2538 "Revert the current buffer's file to the version it was based on. 2583 "Revert the current buffer's file to the version it was based on.
2539This asks for confirmation if the buffer contents are not identical 2584This asks for confirmation if the buffer contents are not identical
2540to that version. This function does not automatically pick up newer 2585to that version. This function does not automatically pick up newer
@@ -2593,7 +2638,7 @@ the current branch are merged into the working file."
2593 (if (eq (vc-state file) 'edited) 2638 (if (eq (vc-state file) 'edited)
2594 (error 2639 (error
2595 (substitute-command-keys 2640 (substitute-command-keys
2596 "File is locked--type \\[vc-revert-buffer] to discard changes")) 2641 "File is locked--type \\[vc-revert] to discard changes"))
2597 (error 2642 (error
2598 (substitute-command-keys 2643 (substitute-command-keys
2599 "Unexpected file state (%s)--type \\[vc-next-action] to correct") 2644 "Unexpected file state (%s)--type \\[vc-next-action] to correct")
@@ -2659,21 +2704,20 @@ return its name; otherwise return nil."
2659 (vc-resynch-buffer file t t)) 2704 (vc-resynch-buffer file t t))
2660 2705
2661;;;###autoload 2706;;;###autoload
2662(defun vc-cancel-version (norevert) 2707(defun vc-rollback ()
2663 "Get rid of most recently checked in version of this file. 2708 "Get rid of most recently checked in version of this file."
2664A prefix argument NOREVERT means do not revert the buffer afterwards."
2665 (interactive "P") 2709 (interactive "P")
2666 (vc-ensure-vc-buffer) 2710 (vc-ensure-vc-buffer)
2667 (let* ((file buffer-file-name) 2711 (let* ((file buffer-file-name)
2668 (backend (vc-backend file)) 2712 (backend (vc-backend file))
2669 (target (vc-workfile-version file))) 2713 (target (vc-workfile-version file)))
2670 (cond 2714 (cond
2671 ((not (vc-find-backend-function backend 'cancel-version)) 2715 ((not (vc-find-backend-function backend 'rollback))
2672 (error "Sorry, canceling versions is not supported under %s" backend)) 2716 (error "Sorry, canceling versions is not supported under %s" backend))
2673 ((not (vc-call latest-on-branch-p file)) 2717 ((not (vc-call latest-on-branch-p file))
2674 (error "This is not the latest version; VC cannot cancel it")) 2718 (error "This is not the latest version; VC cannot cancel it"))
2675 ((not (vc-up-to-date-p file)) 2719 ((not (vc-up-to-date-p file))
2676 (error "%s" (substitute-command-keys "File is not up to date; use \\[vc-revert-buffer] to discard changes")))) 2720 (error "%s" (substitute-command-keys "File is not up to date; use \\[vc-revert] to discard changes"))))
2677 (if (null (yes-or-no-p (format "Remove version %s from master? " target))) 2721 (if (null (yes-or-no-p (format "Remove version %s from master? " target)))
2678 (error "Aborted") 2722 (error "Aborted")
2679 (setq norevert (or norevert (not 2723 (setq norevert (or norevert (not
@@ -2682,7 +2726,7 @@ A prefix argument NOREVERT means do not revert the buffer afterwards."
2682 (message "Removing last change from %s..." file) 2726 (message "Removing last change from %s..." file)
2683 (with-vc-properties 2727 (with-vc-properties
2684 file 2728 file
2685 (vc-call cancel-version file norevert) 2729 (vc-call rollback (list file))
2686 `((vc-state . ,(if norevert 'edited 'up-to-date)) 2730 `((vc-state . ,(if norevert 'edited 'up-to-date))
2687 (vc-checkout-time . ,(if norevert 2731 (vc-checkout-time . ,(if norevert
2688 0 2732 0
@@ -3453,6 +3497,7 @@ The annotations are relative to the current time, unless overridden by OFFSET."
3453(defun vc-file-tree-walk (dirname func &rest args) 3497(defun vc-file-tree-walk (dirname func &rest args)
3454 "Walk recursively through DIRNAME. 3498 "Walk recursively through DIRNAME.
3455Invoke FUNC f ARGS on each VC-managed file f underneath it." 3499Invoke FUNC f ARGS on each VC-managed file f underneath it."
3500 ;; FIXME: Kill this function.
3456 (vc-file-tree-walk-internal (expand-file-name dirname) func args) 3501 (vc-file-tree-walk-internal (expand-file-name dirname) func args)
3457 (message "Traversing directory %s...done" dirname)) 3502 (message "Traversing directory %s...done" dirname))
3458 3503
@@ -3463,13 +3508,13 @@ Invoke FUNC f ARGS on each VC-managed file f underneath it."
3463 (let ((dir (file-name-as-directory file))) 3508 (let ((dir (file-name-as-directory file)))
3464 (mapcar 3509 (mapcar
3465 (lambda (f) (or 3510 (lambda (f) (or
3466 (string-equal f ".") 3511 (string-equal f ".")
3467 (string-equal f "..") 3512 (string-equal f "..")
3468 (member f vc-directory-exclusion-list) 3513 (member f vc-directory-exclusion-list)
3469 (let ((dirf (expand-file-name f dir))) 3514 (let ((dirf (expand-file-name f dir)))
3470 (or 3515 (or
3471 (file-symlink-p dirf);; Avoid possible loops 3516 (file-symlink-p dirf) ;; Avoid possible loops.
3472 (vc-file-tree-walk-internal dirf func args))))) 3517 (vc-file-tree-walk-internal dirf func args)))))
3473 (directory-files dir))))) 3518 (directory-files dir)))))
3474 3519
3475(provide 'vc) 3520(provide 'vc)
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 5dc45b43b33..bc81ca4d4e7 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -3,6 +3,10 @@
3 * files.texi (Magic File Names): Introduce optional parameter 3 * files.texi (Magic File Names): Introduce optional parameter
4 IDENTIFICATION for `file-remote-p'. 4 IDENTIFICATION for `file-remote-p'.
5 5
62007-07-16 Richard Stallman <rms@gnu.org>
7
8 * display.texi (Defining Faces): Fix previous change.
9
62007-07-14 Richard Stallman <rms@gnu.org> 102007-07-14 Richard Stallman <rms@gnu.org>
7 11
8 * control.texi (Handling Errors): Document `debug' in handler list. 12 * control.texi (Handling Errors): Document `debug' in handler list.
diff --git a/lispref/display.texi b/lispref/display.texi
index f4d7a5dbcdb..84c9ba84935 100644
--- a/lispref/display.texi
+++ b/lispref/display.texi
@@ -1760,10 +1760,10 @@ When @code{defface} executes, it defines the face according to
1760@var{spec}, then uses any customizations that were read from the 1760@var{spec}, then uses any customizations that were read from the
1761init file (@pxref{Init File}) to override that specification. 1761init file (@pxref{Init File}) to override that specification.
1762 1762
1763When you evaluate a @code{defcustom} form with @kbd{C-M-x} in Emacs 1763When you evaluate a @code{defface} form with @kbd{C-M-x} in Emacs
1764Lisp mode (@code{eval-defun}), a special feature of @code{eval-defun} 1764Lisp mode (@code{eval-defun}), a special feature of @code{eval-defun}
1765overrides any customizations of the face. This way, the face reflects 1765overrides any customizations of the face. This way, the face reflects
1766exactly what the @code{defcustom} says. 1766exactly what the @code{defface} says.
1767 1767
1768The purpose of @var{spec} is to specify how the face should appear on 1768The purpose of @var{spec} is to specify how the face should appear on
1769different kinds of terminals. It should be an alist whose elements 1769different kinds of terminals. It should be an alist whose elements
diff --git a/man/ChangeLog b/man/ChangeLog
index 827cff5a57f..d4049ff11cd 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,35 @@
12007-07-23 Nick Roberts <nickrob@snap.net.nz>
2
3 * screen.texi (Mode Line): Describe new mode-line flag that shows if
4 default-directory for the current buffer is on a remote machine.
5
62007-07-22 Michael Albinus <michael.albinus@gmx.de>
7
8 Sync with Tramp 2.1.10.
9
10 * tramp.texi (trampfn): Expand macro implementation in order to handle
11 empty arguments.
12 (trampfnmhl, trampfnuhl, trampfnhl): Remove macros. Replace all
13 occurencies by trampfn.
14 (Frequently Asked Questions): Extend example code for host
15 identification in the modeline. Add bbdb to approaches shortening Tramp
16 file names to be typed.
17
18 * trampver.texi: Update release number.
19
202007-07-21 Eli Zaretskii <eliz@gnu.org>
21
22 * vc2-xtra.texi (Customizing VC) <vc-handled-backends>: Update the
23 default value.
24
252007-07-21 Richard Stallman <rms@gnu.org>
26
27 * files.texi (Why Version Control?): Improve previous change.
28
292007-07-18 Eric S. Raymond <esr@snark.thyrsus.com>
30
31 * files.texi (Why Version Control?): New node.
32
12007-07-17 Michael Albinus <michael.albinus@gmx.de> 332007-07-17 Michael Albinus <michael.albinus@gmx.de>
2 34
3 * tramp.texi: Move @setfilename ../info/tramp up, outside the header 35 * tramp.texi: Move @setfilename ../info/tramp up, outside the header
diff --git a/man/files.texi b/man/files.texi
index 588fe4cae0b..747b0dba806 100644
--- a/man/files.texi
+++ b/man/files.texi
@@ -1258,11 +1258,32 @@ this section if you are already familiar with the version control system
1258you want to use. 1258you want to use.
1259 1259
1260@menu 1260@menu
1261* Why Version Control?:: Understanding the problems it addresses
1261* Version Systems:: Supported version control back-end systems. 1262* Version Systems:: Supported version control back-end systems.
1262* VC Concepts:: Words and concepts related to version control. 1263* VC Concepts:: Words and concepts related to version control.
1263* Types of Log File:: The per-file VC log in contrast to the ChangeLog. 1264* Types of Log File:: The per-file VC log in contrast to the ChangeLog.
1264@end menu 1265@end menu
1265 1266
1267@node Why Version Control?
1268@subsubsection Understanding the problems it addresses
1269
1270 Version control systems provide you with three important capabilities:
1271reversibility, concurrency, and history.
1272
1273 The most basic capability you get from a version-control system is
1274reversibility, the ability to back up to a saved, known-good state when
1275you discover that some modification you did was a mistake or a bad idea.
1276
1277 Version-control systems also support concurrency, the ability to
1278have many people modifying the same collection of code or documents
1279knowing that conflicting modifications can be detected and resolved.
1280
1281 Version-control systems give you the capability to attach a history
1282to your data, explanatory comments about the intention behind each
1283change to it. Even for a programmer working solo change histories
1284are an important aid to memory; for a multi-person project they
1285become a vitally important form of communication among developers.
1286
1266@node Version Systems 1287@node Version Systems
1267@subsubsection Supported Version Control Systems 1288@subsubsection Supported Version Control Systems
1268 1289
@@ -1351,34 +1372,97 @@ After you are done with a set of changes, you @dfn{check the file in},
1351which records the changes in the master file, along with a log entry for 1372which records the changes in the master file, along with a log entry for
1352them. 1373them.
1353 1374
1354 With CVS, there are usually multiple work files corresponding to a 1375 To go beyond these basic concepts, you will need to understand three
1355single master file---often each user has his own copy. It is also 1376ways in which version-control systems can differ from each other. They
1356possible to use RCS in this way, but this is not the usual way to use 1377can be locking or merging; they can be file-based or changeset-based;
1357RCS. 1378and they can be centralized or decentralized. VC handles all these
1379choices, but they lead to differing behaviors which you will need
1380to understand as you use it.
1358 1381
1359@cindex locking and version control 1382@cindex locking versus merging
1360 A version control system typically has some mechanism to coordinate 1383 A version control system typically has some mechanism to coordinate
1361between users who want to change the same file. One method is 1384between users who want to change the same file. One method is
1362@dfn{locking} (analogous to the locking that Emacs uses to detect 1385@dfn{locking} (analogous to the locking that Emacs uses to detect
1363simultaneous editing of a file, but distinct from it). The other method 1386simultaneous editing of a file, but distinct from it). In a locking
1364is to merge your changes with other people's changes when you check them 1387system, such as SCCS, you must @dfn{lock} a file before you start to
1365in. 1388edit it. The other method is @dfn{merging}; the system tries to
1389merge your changes with other people's changes when you check them in.
1366 1390
1367 With version control locking, work files are normally read-only so 1391 With version control locking, work files are normally read-only so
1368that you cannot change them. You ask the version control system to make 1392that you cannot change them. You ask the version control system to make
1369a work file writable for you by locking it; only one user can do 1393a work file writable for you by locking it; only one user can do
1370this at any given time. When you check in your changes, that unlocks 1394this at any given time. When you check in your changes, that unlocks
1371the file, making the work file read-only again. This allows other users 1395the file, making the work file read-only again. This allows other users
1372to lock the file to make further changes. SCCS always uses locking, and 1396to lock the file to make further changes.
1373RCS normally does. 1397
1374 1398 By contrast, a merging system lets each user check out and modify a
1375 The other alternative for RCS is to let each user modify the work file 1399work file at any time. When you check in a a file, the system will
1376at any time. In this mode, locking is not required, but it is 1400attempt to merge your changes with any others checked into the
1377permitted; check-in is still the way to record a new version. 1401repository since you checked out the file.
1402
1403 Both locking and merging systems can have problems when multiple users
1404try to modify the same file at the same time. Locking systems have
1405@dfn{lock conflicts}; a user may try to check a file out and be unable
1406to because it is locked. In merging systems, @dfn{merge conflicts}
1407happen when you check in a change to a file that conflicts with a change
1408checked in by someone else after your checkout. Both kinds of conflict
1409have to be resolved by human judgment and communication.
1410
1411 SCCS always uses locking. RCS is lock-based by default but can be told
1412to operate in a merging style. CVS is merge-based by default but can
1413be told to operate in a locking mode. Most later version-control
1414systems, such as Subversion and GNU Arch, have been fundamentally
1415merging-based rather than locking-based. This is because experience
1416has shown that the merging-based approach is generally superior to
1417the locking one, both in convenience to developers and in minimizing
1418the number and severity of conflicts that actually occur.
1419
1420 While it is rather unlikely that anyone will ever again build a
1421fundamentally locking-based rather than merging-based version-control
1422system in the future, merging-based version-systems sometimes have locks
1423retrofitted onto them for reasons having nothing to do with technology.
1424@footnote{Usually the control-freak instincts of managers.} For this
1425reason, and to support older systems still in use, VC mode supports
1426both locking and merging version control and tries to hide the differences
1427between them as much as possible.
1428
1429@cindex files versus changesets.
1430 On SCCS, RCS, CVS, and other early version-control systems, checkins
1431and other operations are @dfn{file-based}; each file has its own
1432@dfn{master file} with its own comment- and revision history separate
1433from that of all other files in the system. Later systems, beginning
1434with Subversion, are @dfn{changeset-based}; a checkin may include
1435changes to several files and that change set is treated as a unit by the
1436system. Any comment associated with the change doesn't belong to any
1437one file, but is attached to the changeset itself.
1438
1439 Changeset-based version control is in general both more flexible and
1440more powerful than file-based version control; usually, when a change to
1441multiple files has to be backed out, it's good to be able to easily
1442identify and remove all of it.
1443
1444@cindex centralized vs. decentralized
1445 Early version-control systems were designed around a @dfn{centralized}
1446model in which each project has only one repository used by all
1447developers. SCCS, RCS, CVS, and Subversion share this kind of model.
1448It has two important problems. One is that a single repository is a
1449single point of failure---if the repository server is down all work
1450stops. The other is that you need to be connected live to the server to
1451do checkins and checkouts; if you're offline, you can't work.
1452
1453 Newer version-control systems like GNU Arch are @dfn{decentralized}.
1454A project may have several different repositories, and these systems
1455support a sort of super-merge between repositories that tries to
1456reconcile their change histories. At the limit, each developer has
1457his/her own repository, and repository merges replace checkin/commit
1458operations.
1459
1460 VC's job is to help you manage the traffic between your personal
1461workfiles and a repository. Whether that repository is a single master
1462or one of a network of peer repositories is not something VC has to care
1463about. Thus, the difference between a centralized and a decentralized
1464version-control system is invisible to VC mode.
1378 1465
1379 CVS normally allows each user to modify his own copy of the work file
1380at any time, but requires merging with changes from other users at
1381check-in time. However, CVS can also be set up to require locking.
1382@iftex 1466@iftex
1383(@pxref{CVS Options,,,emacs-xtra, Specialized Emacs Features}). 1467(@pxref{CVS Options,,,emacs-xtra, Specialized Emacs Features}).
1384@end iftex 1468@end iftex
diff --git a/man/screen.texi b/man/screen.texi
index 87b037849ce..90ec645a26f 100644
--- a/man/screen.texi
+++ b/man/screen.texi
@@ -197,7 +197,7 @@ more information.
197 Normally, the mode line looks like this: 197 Normally, the mode line looks like this:
198 198
199@example 199@example
200-@var{cs}:@var{ch}-@var{fr} @var{buf} @var{pos} @var{line} (@var{major} @var{minor})------ 200-@var{cs}:@var{ch}@var{R}-@var{fr} @var{buf} @var{pos} @var{line} (@var{major} @var{minor})------
201@end example 201@end example
202 202
203@noindent 203@noindent
@@ -211,6 +211,9 @@ been edited (the buffer is ``modified''), or @samp{--} if the buffer has
211not been edited. For a read-only buffer, it is @samp{%*} if the buffer 211not been edited. For a read-only buffer, it is @samp{%*} if the buffer
212is modified, and @samp{%%} otherwise. 212is modified, and @samp{%%} otherwise.
213 213
214 @var{R} is @samp{@@} if the default-directory for the current buffer
215is on a remote machine, or a hyphen otherwise.
216
214 @var{fr} gives the selected frame name (@pxref{Frames}). It appears 217 @var{fr} gives the selected frame name (@pxref{Frames}). It appears
215only on text-only terminals. The initial frame's name is @samp{F1}. 218only on text-only terminals. The initial frame's name is @samp{F1}.
216 219
diff --git a/man/tramp.texi b/man/tramp.texi
index eac0a31e0e2..235f0b65254 100644
--- a/man/tramp.texi
+++ b/man/tramp.texi
@@ -17,23 +17,24 @@
17 17
18@include trampver.texi 18@include trampver.texi
19 19
20@c Macros for formatting a filename. 20@c Macro for formatting a filename according to the repective syntax.
21@c trampfn is for a full filename, trampfnmhl means method, host, localname 21@c xxx and yyy are auxiliary macros in order to omit leading and
22@c were given, and so on. 22@c trailing whitespace. Not very elegant, but I don't know it better.
23@macro trampfn {method, user, host, localname}
24@value{prefix}\method\@value{postfixhop}\user\@@\host\@value{postfix}\localname\
25@end macro
26 23
27@macro trampfnmhl {method, host, localname} 24@macro xxx {one}@c
28@value{prefix}\method\@value{postfixhop}\host\@value{postfix}\localname\ 25@set \one\@c
29@end macro 26@end macro
30 27
31@macro trampfnuhl {user, host, localname} 28@macro yyy {one, two}@c
32@value{prefix}\user\@@\host\@value{postfix}\localname\ 29@xxx{x\one\}@c
30@ifclear x@c
31\one\@w{}\two\@c
32@end ifclear
33@clear x\one\@c
33@end macro 34@end macro
34 35
35@macro trampfnhl {host, localname} 36@macro trampfn {method, user, host, localname}@c
36@value{prefix}\host\@value{postfix}\localname\ 37@value{prefix}@yyy{\method\,@value{postfixhop}}@yyy{\user\,@@}\host\@value{postfix}\localname\@c
37@end macro 38@end macro
38 39
39@copying 40@copying
@@ -497,7 +498,7 @@ repository. Being part of the GNU Emacs repository happened in June
497installed. It is initially configured to use the @command{scp} 498installed. It is initially configured to use the @command{scp}
498program to connect to the remote host. So in the easiest case, you 499program to connect to the remote host. So in the easiest case, you
499just type @kbd{C-x C-f} and then enter the filename 500just type @kbd{C-x C-f} and then enter the filename
500@file{@trampfnuhl{user, machine, /path/to.file}}. 501@file{@trampfn{, user, machine, /path/to.file}}.
501 502
502On some hosts, there are problems with opening a connection. These are 503On some hosts, there are problems with opening a connection. These are
503related to the behavior of the remote shell. See @xref{Remote shell 504related to the behavior of the remote shell. See @xref{Remote shell
@@ -1180,7 +1181,7 @@ implementation of @command{ssh}. Or you use Kerberos and thus like
1180For the special case of editing files on the local host as another 1181For the special case of editing files on the local host as another
1181user, see the @option{su} or @option{sudo} methods. They offer 1182user, see the @option{su} or @option{sudo} methods. They offer
1182shortened syntax for the @samp{root} account, like 1183shortened syntax for the @samp{root} account, like
1183@file{@trampfnmhl{su, , /etc/motd}}. 1184@file{@trampfn{su, , , /etc/motd}}.
1184 1185
1185People who edit large files may want to consider @option{scpc} instead 1186People who edit large files may want to consider @option{scpc} instead
1186of @option{ssh}, or @option{pscp} instead of @option{plink}. These 1187of @option{ssh}, or @option{pscp} instead of @option{plink}. These
@@ -1273,11 +1274,11 @@ If you, for example, use @value{tramp} mainly to contact the host
1273 tramp-default-host "target") 1274 tramp-default-host "target")
1274@end lisp 1275@end lisp
1275 1276
1276Then the simple file name @samp{@trampfnmhl{ssh,,}} will connect you 1277Then the simple file name @samp{@trampfn{ssh, , ,}} will connect you
1277to John's home directory on target. 1278to John's home directory on target.
1278@ifset emacs 1279@ifset emacs
1279Note, however, that the most simplification @samp{@trampfnmhl{,,}} 1280Note, however, that the most simplification @samp{/::} won't work,
1280won't work, because @samp{/:} is the prefix for quoted file names. 1281because @samp{/:} is the prefix for quoted file names.
1281@end ifset 1282@end ifset
1282 1283
1283 1284
@@ -1339,7 +1340,7 @@ rule:
1339(add-to-list 'tramp-default-proxies-alist 1340(add-to-list 'tramp-default-proxies-alist
1340 '("\\`bastion\\.your\\.domain\\'" 1341 '("\\`bastion\\.your\\.domain\\'"
1341 "\\`bird\\'" 1342 "\\`bird\\'"
1342 "@trampfnmhl{ssh, jump.your.domain,}")) 1343 "@trampfn{ssh, , jump.your.domain,}"))
1343@end lisp 1344@end lisp
1344 1345
1345@var{proxy} can contain the patterns @code{%h} or @code{%u}. These 1346@var{proxy} can contain the patterns @code{%h} or @code{%u}. These
@@ -1352,15 +1353,15 @@ non-local access, you might add the following rule:
1352 1353
1353@lisp 1354@lisp
1354(add-to-list 'tramp-default-proxies-alist 1355(add-to-list 'tramp-default-proxies-alist
1355 '("\\.your\\.domain\\'" "\\`root\\'" "@trampfnmhl{ssh, %h,}")) 1356 '("\\.your\\.domain\\'" "\\`root\\'" "@trampfn{ssh, , %h,}"))
1356@end lisp 1357@end lisp
1357 1358
1358Opening @file{@trampfnmhl{sudo, randomhost.your.domain,}} would 1359Opening @file{@trampfn{sudo, , randomhost.your.domain,}} would connect
1359connect first @samp{randomhost.your.domain} via @code{ssh} under your 1360first @samp{randomhost.your.domain} via @code{ssh} under your account
1360account name, and perform @code{sudo -u root} on that host afterwards. 1361name, and perform @code{sudo -u root} on that host afterwards. It is
1361It is important to know that the given method is applied on the host 1362important to know that the given method is applied on the host which
1362which has been reached so far. @code{sudo -u root}, applied on your 1363has been reached so far. @code{sudo -u root}, applied on your local
1363local host, wouldn't be useful here. 1364host, wouldn't be useful here.
1364 1365
1365This is the recommended configuration to work as @samp{root} on remote 1366This is the recommended configuration to work as @samp{root} on remote
1366Ubuntu hosts. 1367Ubuntu hosts.
@@ -1382,7 +1383,7 @@ following rule:
1382@lisp 1383@lisp
1383(add-to-list 'tramp-default-proxies-alist 1384(add-to-list 'tramp-default-proxies-alist
1384 '("\\`host\\.other\\.domain\\'" nil 1385 '("\\`host\\.other\\.domain\\'" nil
1385 "@trampfnmhl{tunnel, proxy.your.domain#3128,}")) 1386 "@trampfn{tunnel, , proxy.your.domain#3128,}"))
1386@end lisp 1387@end lisp
1387 1388
1388Gateway methods can be declared as first hop only in a multiple hop 1389Gateway methods can be declared as first hop only in a multiple hop
@@ -2029,32 +2030,32 @@ minute you have already forgotten that you hit that key!
2029@cindex filename examples 2030@cindex filename examples
2030 2031
2031To access the file @var{localname} on the remote machine @var{machine} 2032To access the file @var{localname} on the remote machine @var{machine}
2032you would specify the filename @file{@trampfnhl{@var{machine}, 2033you would specify the filename @file{@trampfn{, , @var{machine},
2033@var{localname}}}. This will connect to @var{machine} and transfer 2034@var{localname}}}. This will connect to @var{machine} and transfer
2034the file using the default method. @xref{Default Method}. 2035the file using the default method. @xref{Default Method}.
2035 2036
2036Some examples of @value{tramp} filenames are shown below. 2037Some examples of @value{tramp} filenames are shown below.
2037 2038
2038@table @file 2039@table @file
2039@item @trampfnhl{melancholia, .emacs} 2040@item @trampfn{, , melancholia, .emacs}
2040Edit the file @file{.emacs} in your home directory on the machine 2041Edit the file @file{.emacs} in your home directory on the machine
2041@code{melancholia}. 2042@code{melancholia}.
2042 2043
2043@item @trampfnhl{melancholia.danann.net, .emacs} 2044@item @trampfn{, , melancholia.danann.net, .emacs}
2044This edits the same file, using the fully qualified domain name of 2045This edits the same file, using the fully qualified domain name of
2045the machine. 2046the machine.
2046 2047
2047@item @trampfnhl{melancholia, ~/.emacs} 2048@item @trampfn{, , melancholia, ~/.emacs}
2048This also edits the same file --- the @file{~} is expanded to your 2049This also edits the same file --- the @file{~} is expanded to your
2049home directory on the remote machine, just like it is locally. 2050home directory on the remote machine, just like it is locally.
2050 2051
2051@item @trampfnhl{melancholia, ~daniel/.emacs} 2052@item @trampfn{, , melancholia, ~daniel/.emacs}
2052This edits the file @file{.emacs} in the home directory of the user 2053This edits the file @file{.emacs} in the home directory of the user
2053@code{daniel} on the machine @code{melancholia}. The @file{~<user>} 2054@code{daniel} on the machine @code{melancholia}. The @file{~<user>}
2054construct is expanded to the home directory of that user on the remote 2055construct is expanded to the home directory of that user on the remote
2055machine. 2056machine.
2056 2057
2057@item @trampfnhl{melancholia, /etc/squid.conf} 2058@item @trampfn{, , melancholia, /etc/squid.conf}
2058This edits the file @file{/etc/squid.conf} on the machine 2059This edits the file @file{/etc/squid.conf} on the machine
2059@code{melancholia}. 2060@code{melancholia}.
2060 2061
@@ -2066,10 +2067,10 @@ need to log in as a different user, you can specify the user name as
2066part of the filename. 2067part of the filename.
2067 2068
2068To log in to the remote machine as a specific user, you use the syntax 2069To log in to the remote machine as a specific user, you use the syntax
2069@file{@trampfnuhl{@var{user}, @var{machine}, @var{path/to.file}}}. 2070@file{@trampfn{, @var{user}, @var{machine}, @var{path/to.file}}}.
2070That means that connecting to @code{melancholia} as @code{daniel} and 2071That means that connecting to @code{melancholia} as @code{daniel} and
2071editing @file{.emacs} in your home directory you would specify 2072editing @file{.emacs} in your home directory you would specify
2072@file{@trampfnuhl{daniel, melancholia, .emacs}}. 2073@file{@trampfn{, daniel, melancholia, .emacs}}.
2073 2074
2074It is also possible to specify other file transfer methods 2075It is also possible to specify other file transfer methods
2075(@pxref{Default Method}) as part of the filename. 2076(@pxref{Default Method}) as part of the filename.
@@ -2160,11 +2161,11 @@ If you, for example, type @kbd{C-x C-f @value{prefix}t
2160 2161
2161@example 2162@example
2162@ifset emacs 2163@ifset emacs
2163@value{prefixhop}telnet@value{postfixhop} tmp/ 2164@value{prefixhop}telnet@value{postfixhop} tmp/
2164@value{prefixhop}toto@value{postfix} 2165@value{prefixhop}toto@value{postfix}
2165@end ifset 2166@end ifset
2166@ifset xemacs 2167@ifset xemacs
2167@value{prefixhop}telnet@value{postfixhop} @value{prefixhop}toto@value{postfix} 2168@value{prefixhop}telnet@value{postfixhop} @value{prefixhop}toto@value{postfix}
2168@end ifset 2169@end ifset
2169@end example 2170@end example
2170 2171
@@ -2184,9 +2185,9 @@ Next @kbd{@key{TAB}} brings you all machine names @value{tramp} detects in
2184your @file{/etc/hosts} file, let's say 2185your @file{/etc/hosts} file, let's say
2185 2186
2186@example 2187@example
2187@trampfnmhl{telnet,127.0.0.1,} @trampfnmhl{telnet,192.168.0.1,} 2188@trampfn{telnet, , 127.0.0.1,} @trampfn{telnet, , 192.168.0.1,}
2188@trampfnmhl{telnet,localhost,} @trampfnmhl{telnet,melancholia.danann.net,} 2189@trampfn{telnet, , localhost,} @trampfn{telnet, , melancholia.danann.net,}
2189@trampfnmhl{telnet,melancholia,} 2190@trampfn{telnet, , melancholia,}
2190@end example 2191@end example
2191 2192
2192Now you can choose the desired machine, and you can continue to 2193Now you can choose the desired machine, and you can continue to
@@ -2209,20 +2210,20 @@ that filename part starts with @file{//}.
2209@end ifinfo 2210@end ifinfo
2210 2211
2211@ifset emacs 2212@ifset emacs
2212As example, @kbd{@trampfnmhl{telnet,melancholia,/usr/local/bin//etc} 2213As example, @kbd{@trampfn{telnet, , melancholia, /usr/local/bin//etc}
2213@key{TAB}} would result in 2214@key{TAB}} would result in
2214@file{@trampfnmhl{telnet,melancholia,/etc}}, whereas 2215@file{@trampfn{telnet, , melancholia, /etc}}, whereas
2215@kbd{@trampfnmhl{telnet,melancholia,//etc} @key{TAB}} reduces the 2216@kbd{@trampfn{telnet, , melancholia, //etc} @key{TAB}} reduces the
2216minibuffer contents to @file{/etc}. A triple-slash stands for the 2217minibuffer contents to @file{/etc}. A triple-slash stands for the
2217default behaviour, 2218default behaviour,
2218i.e. @kbd{@trampfnmhl{telnet,melancholia,/usr/local/bin///etc} 2219i.e. @kbd{@trampfn{telnet, , melancholia, /usr/local/bin///etc}
2219@key{TAB}} expands directly to @file{/etc}. 2220@key{TAB}} expands directly to @file{/etc}.
2220@end ifset 2221@end ifset
2221 2222
2222@ifset xemacs 2223@ifset xemacs
2223As example, @kbd{@trampfnmhl{telnet,melancholia,/usr/local/bin//}} 2224As example, @kbd{@trampfn{telnet, , melancholia, /usr/local/bin//}}
2224would result in @file{@trampfnmhl{telnet,melancholia,/}}, whereas 2225would result in @file{@trampfn{telnet, , melancholia, /}}, whereas
2225@kbd{@trampfnmhl{telnet,melancholia,//}} expands the minibuffer 2226@kbd{@trampfn{telnet, , melancholia, //}} expands the minibuffer
2226contents to @file{/}. 2227contents to @file{/}.
2227@end ifset 2228@end ifset
2228 2229
@@ -2295,7 +2296,7 @@ After you have started @code{eshell}, you could perform commands like
2295this: 2296this:
2296 2297
2297@example 2298@example
2298@b{~ $} cd @trampfnmhl{sudo, , /etc} @key{RET} 2299@b{~ $} cd @trampfn{sudo, , , /etc} @key{RET}
2299@b{@trampfn{sudo, root, host, /etc} $} hostname @key{RET} 2300@b{@trampfn{sudo, root, host, /etc} $} hostname @key{RET}
2300host 2301host
2301@b{@trampfn{sudo, root, host, /etc} $} id @key{RET} 2302@b{@trampfn{sudo, root, host, /etc} $} id @key{RET}
@@ -2324,12 +2325,12 @@ remote hosts. You can call @code{gdb} with a remote file name:
2324 2325
2325@example 2326@example
2326@kbd{M-x gdb @key{RET}} 2327@kbd{M-x gdb @key{RET}}
2327@b{Run gdb (like this):} gdb --annotate=3 @trampfnmhl{ssh, host, ~/myprog} @key{RET} 2328@b{Run gdb (like this):} gdb --annotate=3 @trampfn{ssh, , host, ~/myprog} @key{RET}
2328@end example 2329@end example
2329 2330
2330The file name can also be relative to a remote default directory. 2331The file name can also be relative to a remote default directory.
2331Given you are in a buffer that belongs to the remote directory 2332Given you are in a buffer that belongs to the remote directory
2332@trampfnmhl{ssh, host, /home/user}, you could call 2333@trampfn{ssh, , host, /home/user}, you could call
2333 2334
2334@example 2335@example
2335@kbd{M-x perldb @key{RET}} 2336@kbd{M-x perldb @key{RET}}
@@ -2602,7 +2603,7 @@ remote host.
2602@item 2603@item
2603I'ld like to see a host indication in the mode line when I'm remote 2604I'ld like to see a host indication in the mode line when I'm remote
2604 2605
2605The following code has been tested with @value{emacsname} 22. You 2606The following code has been tested with @value{emacsname} 22.1. You
2606should put it into your @file{~/.emacs}: 2607should put it into your @file{~/.emacs}:
2607 2608
2608@lisp 2609@lisp
@@ -2610,13 +2611,13 @@ should put it into your @file{~/.emacs}:
2610 (list 2611 (list
2611 '(:eval 2612 '(:eval
2612 (let ((host-name 2613 (let ((host-name
2613 (if (file-remote-p default-directory) 2614 (if (file-remote-p default-directory)
2614 (tramp-file-name-host 2615 (tramp-file-name-host
2615 (tramp-dissect-file-name default-directory)) 2616 (tramp-dissect-file-name default-directory))
2616 (system-name)))) 2617 (system-name))))
2617 (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name) 2618 (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name)
2618 (substring host-name 0 (match-beginning 1)) 2619 (substring host-name 0 (match-beginning 1))
2619 host-name))) 2620 host-name)))
2620 ": %12b")) 2621 ": %12b"))
2621 2622
2622(setq-default 2623(setq-default
@@ -2630,6 +2631,18 @@ should put it into your @file{~/.emacs}:
2630 mode-line-buffer-identification 2631 mode-line-buffer-identification
2631 my-mode-line-buffer-identification))) 2632 my-mode-line-buffer-identification)))
2632@end lisp 2633@end lisp
2634
2635Since @value{emacsname} 23, the @code{:eval} clause can be simplified:
2636
2637@lisp
2638 '(:eval
2639 (let ((host-name
2640 (or (file-remote-p default-directory 'host)
2641 (system-name))))
2642 (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name)
2643 (substring host-name 0 (match-beginning 1))
2644 host-name)))
2645@end lisp
2633@end ifset 2646@end ifset
2634 2647
2635 2648
@@ -2693,11 +2706,11 @@ You can define default methods and user names for hosts,
2693@end lisp 2706@end lisp
2694 2707
2695The file name left to type would be 2708The file name left to type would be
2696@kbd{C-x C-f @trampfnhl{news.my.domain, /opt/news/etc}}. 2709@kbd{C-x C-f @trampfn{, , news.my.domain, /opt/news/etc}}.
2697 2710
2698Note, that there are some useful settings already. Accessing your 2711Note, that there are some useful settings already. Accessing your
2699local host as @samp{root} user, is possible just by @kbd{C-x C-f 2712local host as @samp{root} user, is possible just by @kbd{C-x C-f
2700@trampfnmhl{su,,}}. 2713@trampfn{su, , ,}}.
2701 2714
2702@item Use configuration possibilities of your method: 2715@item Use configuration possibilities of your method:
2703 2716
@@ -2711,7 +2724,7 @@ Host xy
2711 User news 2724 User news
2712@end example 2725@end example
2713 2726
2714The file name left to type would be @kbd{C-x C-f @trampfnmhl{ssh, xy, 2727The file name left to type would be @kbd{C-x C-f @trampfn{ssh, , xy,
2715/opt/news/etc}}. Depending on files in your directories, it is even 2728/opt/news/etc}}. Depending on files in your directories, it is even
2716possible to complete the hostname with @kbd{C-x C-f 2729possible to complete the hostname with @kbd{C-x C-f
2717@value{prefix}ssh@value{postfixhop}x @key{TAB}}. 2730@value{prefix}ssh@value{postfixhop}x @key{TAB}}.
@@ -2881,8 +2894,44 @@ C-@key{TAB}} in the minibuffer. The completion is done for the given
2881directory. 2894directory.
2882@end ifset 2895@end ifset
2883 2896
2897@ifset emacs
2898@item Use bbdb:
2899
2900@file{bbdb} has a built-in feature for @value{ftppackagename} files,
2901which works also for @value{tramp}.
2902@ifinfo
2903@pxref{bbdb-ftp, Storing FTP sites in the BBDB, , bbdb}
2904@end ifinfo
2905
2906You need to load @file{bbdb}:
2907
2908@lisp
2909(require 'bbdb)
2910(bbdb-initialize)
2911@end lisp
2912
2913Then you can create a BBDB entry via @kbd{M-x bbdb-create-ftp-site}.
2914Because BBDB is not prepared for @value{tramp} syntax, you must
2915specify a method together with the user name, when needed. Example:
2916
2917@example
2918@kbd{M-x bbdb-create-ftp-site @key{RET}}
2919@b{Ftp Site:} news.my.domain @key{RET}
2920@b{Ftp Directory:} /opt/news/etc/ @key{RET}
2921@b{Ftp Username:} ssh@value{postfixhop}news @key{RET}
2922@b{Company:} @key{RET}
2923@b{Additional Comments:} @key{RET}
2924@end example
2925
2926When you have opened your BBDB buffer, you can access such an entry by
2927pressing the key @key{F}.
2928@end ifset
2929
2884@end enumerate 2930@end enumerate
2885 2931
2932I would like to thank all @value{tramp} users, who have contributed to
2933the different recipes!
2934
2886 2935
2887@item 2936@item
2888How can I disable @value{tramp}? 2937How can I disable @value{tramp}?
diff --git a/man/trampver.texi b/man/trampver.texi
index 6d97869d115..877488c63e6 100644
--- a/man/trampver.texi
+++ b/man/trampver.texi
@@ -4,12 +4,12 @@
4@c In the Tramp CVS, the version number is auto-frobbed from 4@c In the Tramp CVS, the version number is auto-frobbed from
5@c configure.ac, so you should edit that file and run 5@c configure.ac, so you should edit that file and run
6@c "autoconf && ./configure" to change the version number. 6@c "autoconf && ./configure" to change the version number.
7@set trampver 2.1.10-pre 7@set trampver 2.1.10
8 8
9@c Other flags from configuration 9@c Other flags from configuration
10@set instprefix /usr/local 10@set instprefix /usr/local
11@set lispdir /usr/local/share/emacs/site-lisp 11@set lispdir /usr/local/share/emacs/site-lisp
12@set infodir /usr/local/info 12@set infodir /usr/local/share/info
13 13
14@c Formatting of the tramp program name consistent. 14@c Formatting of the tramp program name consistent.
15@set tramp @sc{tramp} 15@set tramp @sc{tramp}
diff --git a/man/vc2-xtra.texi b/man/vc2-xtra.texi
index 11c8ea1fb96..7627787d1d2 100644
--- a/man/vc2-xtra.texi
+++ b/man/vc2-xtra.texi
@@ -590,10 +590,10 @@ headers.
590@vindex vc-handled-backends 590@vindex vc-handled-backends
591The variable @code{vc-handled-backends} determines which version 591The variable @code{vc-handled-backends} determines which version
592control systems VC should handle. The default value is @code{(RCS CVS 592control systems VC should handle. The default value is @code{(RCS CVS
593SVN SCCS Arch MCVS)}, so it contains all six version systems that are 593SVN SCCS BZR HG Arch MCVS)}, so it contains all the version systems
594currently supported. If you want VC to ignore one or more of these 594that are currently supported. If you want VC to ignore one or more of
595systems, exclude its name from the list. To disable VC entirely, set 595these systems, exclude its name from the list. To disable VC entirely,
596this variable to @code{nil}. 596set this variable to @code{nil}.
597 597
598The order of systems in the list is significant: when you visit a file 598The order of systems in the list is significant: when you visit a file
599registered in more than one system (@pxref{Local Version Control}), VC 599registered in more than one system (@pxref{Local Version Control}), VC
diff --git a/src/ChangeLog b/src/ChangeLog
index af29937753c..bbb44e9cd6d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,40 @@
12007-07-22 Nick Roberts <nickrob@snap.net.nz>
2
3 * xdisp.c (decode_mode_spec): Add case 'R' for to test for
4 remote default-directory.
5
6 * buffer.c (mode-line-format): Describe above case in doc string.
7
82007-07-20 Eli Zaretskii <eliz@gnu.org>
9
10 * w32proc.c (IMAGE_NT_OPTIONAL_HDR32_MAGIC, IMAGE_OPTIONAL_HEADER32):
11 Define if not defined.
12
132007-07-18 Jason Rumney <jasonr@gnu.org>
14
15 * w32proc.c (w32_executable_type): Handle 64 bit executables.
16
172007-07-18 Richard Stallman <rms@gnu.org>
18
19 * data.c (Fsetq_default): Doc fix.
20
21 * eval.c (Fsetq): Doc fix.
22
232007-07-18 Juanma Barranquero <lekktu@gmail.com>
24
25 * coding.c (Ffind_operation_coding_system):
26 * eval.c (For, Fand): Doc fixes.
27 Reported by Johan Bockg,Ae(Brd.
28
292007-07-18 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
30
31 * xfns.c (Fx_focus_frame): Call x_ewmh_activate_frame.
32
33 * xterm.h: Declare x_ewmh_activate_frame.
34
35 * xterm.c (x_ewmh_activate_frame): New function.
36 (XTframe_raise_lower): Move code to x_ewmh_activate_frame.
37
12007-07-17 Martin Rudalics <rudalics@gmx.at> 382007-07-17 Martin Rudalics <rudalics@gmx.at>
2 39
3 * window.c (Fdisplay_buffer): If largest or LRU window is the 40 * window.c (Fdisplay_buffer): If largest or LRU window is the
@@ -8097,7 +8134,7 @@
80972005-09-19 Kim F. Storm <storm@cua.dk> 81342005-09-19 Kim F. Storm <storm@cua.dk>
8098 8135
8099 * editfns.c (Fformat): Don't scan past end of format string that 8136 * editfns.c (Fformat): Don't scan past end of format string that
8100 ends in %. Reported by: Johan Bockg,Ae(Brd. 8137 ends in %. Reported by Johan Bockg,Ae(Brd.
8101 8138
81022005-09-18 Andreas Schwab <schwab@suse.de> 81392005-09-18 Andreas Schwab <schwab@suse.de>
8103 8140
diff --git a/src/buffer.c b/src/buffer.c
index 925463a63c3..b401ce97e48 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5517,6 +5517,8 @@ A string is printed verbatim in the mode line except for %-constructs:
5517 %P -- print percent of buffer above bottom of window, perhaps plus Top, 5517 %P -- print percent of buffer above bottom of window, perhaps plus Top,
5518 or print Bottom or All. 5518 or print Bottom or All.
5519 %n -- print Narrow if appropriate. 5519 %n -- print Narrow if appropriate.
5520 %R -- print R or hyphen. R means that default-directory is on a
5521 remote machine.
5520 %t -- visited file is text or binary (if OS supports this distinction). 5522 %t -- visited file is text or binary (if OS supports this distinction).
5521 %z -- print mnemonics of keyboard, terminal, and buffer coding systems. 5523 %z -- print mnemonics of keyboard, terminal, and buffer coding systems.
5522 %Z -- like %z, but including the end-of-line format. 5524 %Z -- like %z, but including the end-of-line format.
diff --git a/src/coding.c b/src/coding.c
index e4ecbf50f62..59592fdd09d 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -8400,7 +8400,7 @@ contents (not yet decoded). If `file-coding-system-alist' specifies a
8400function to call for FILENAME, that function should examine the 8400function to call for FILENAME, that function should examine the
8401contents of BUFFER instead of reading the file. 8401contents of BUFFER instead of reading the file.
8402 8402
8403usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) 8403usage: (find-operation-coding-system OPERATION ARGUMENTS...) */)
8404 (nargs, args) 8404 (nargs, args)
8405 int nargs; 8405 int nargs;
8406 Lisp_Object *args; 8406 Lisp_Object *args;
diff --git a/src/data.c b/src/data.c
index dd5bc0bcb21..99c38db1395 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1440,7 +1440,7 @@ More generally, you can use multiple variables and values, as in
1440This sets each VAR's default value to the corresponding VALUE. 1440This sets each VAR's default value to the corresponding VALUE.
1441The VALUE for the Nth VAR can refer to the new default values 1441The VALUE for the Nth VAR can refer to the new default values
1442of previous VARs. 1442of previous VARs.
1443usage: (setq-default [VAR VALUE...]) */) 1443usage: (setq-default [VAR VALUE]...) */)
1444 (args) 1444 (args)
1445 Lisp_Object args; 1445 Lisp_Object args;
1446{ 1446{
@@ -2195,7 +2195,9 @@ DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0,
2195 return Qnil; 2195 return Qnil;
2196} 2196}
2197 2197
2198/* Convert between long values and pairs of Lisp integers. */ 2198/* Convert between long values and pairs of Lisp integers.
2199 Note that long_to_cons returns a single Lisp integer
2200 when the value fits in one. */
2199 2201
2200Lisp_Object 2202Lisp_Object
2201long_to_cons (i) 2203long_to_cons (i)
diff --git a/src/eval.c b/src/eval.c
index cd0d0fc1c5c..7d7e73484f7 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -330,7 +330,7 @@ DEFUN ("or", For, Sor, 0, UNEVALLED, 0,
330 doc: /* Eval args until one of them yields non-nil, then return that value. 330 doc: /* Eval args until one of them yields non-nil, then return that value.
331The remaining args are not evalled at all. 331The remaining args are not evalled at all.
332If all args return nil, return nil. 332If all args return nil, return nil.
333usage: (or CONDITIONS ...) */) 333usage: (or CONDITIONS...) */)
334 (args) 334 (args)
335 Lisp_Object args; 335 Lisp_Object args;
336{ 336{
@@ -355,7 +355,7 @@ DEFUN ("and", Fand, Sand, 0, UNEVALLED, 0,
355 doc: /* Eval args until one of them yields nil, then return nil. 355 doc: /* Eval args until one of them yields nil, then return nil.
356The remaining args are not evalled at all. 356The remaining args are not evalled at all.
357If no arg yields nil, return the last arg's value. 357If no arg yields nil, return the last arg's value.
358usage: (and CONDITIONS ...) */) 358usage: (and CONDITIONS...) */)
359 (args) 359 (args)
360 Lisp_Object args; 360 Lisp_Object args;
361{ 361{
@@ -531,7 +531,7 @@ Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'.
531The second VAL is not computed until after the first SYM is set, and so on; 531The second VAL is not computed until after the first SYM is set, and so on;
532each VAL can use the new value of variables set earlier in the `setq'. 532each VAL can use the new value of variables set earlier in the `setq'.
533The return value of the `setq' form is the value of the last VAL. 533The return value of the `setq' form is the value of the last VAL.
534usage: (setq SYM VAL SYM VAL ...) */) 534usage: (setq [SYM VAL]...) */)
535 (args) 535 (args)
536 Lisp_Object args; 536 Lisp_Object args;
537{ 537{
diff --git a/src/w32proc.c b/src/w32proc.c
index ab768527658..a7c2cff450d 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -591,6 +591,13 @@ get_result:
591 return pid; 591 return pid;
592} 592}
593 593
594/* Old versions of w32api headers don't have separate 32-bit and
595 64-bit defines, but the one they have matches the 32-bit variety. */
596#ifndef IMAGE_NT_OPTIONAL_HDR32_MAGIC
597# define IMAGE_NT_OPTIONAL_HDR32_MAGIC IMAGE_NT_OPTIONAL_HDR_MAGIC
598# define IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
599#endif
600
594void 601void
595w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, int * is_gui_app) 602w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, int * is_gui_app)
596{ 603{
@@ -651,33 +658,54 @@ w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, int
651 } 658 }
652 else if (nt_header->Signature == IMAGE_NT_SIGNATURE) 659 else if (nt_header->Signature == IMAGE_NT_SIGNATURE)
653 { 660 {
654 /* Look for cygwin.dll in DLL import list. */ 661 IMAGE_DATA_DIRECTORY *data_dir = NULL;
655 IMAGE_DATA_DIRECTORY import_dir = 662 if (nt_header->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
656 nt_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]; 663 {
657 IMAGE_IMPORT_DESCRIPTOR * imports; 664 /* Ensure we are using the 32 bit structure. */
658 IMAGE_SECTION_HEADER * section; 665 IMAGE_OPTIONAL_HEADER32 *opt
659 666 = (IMAGE_OPTIONAL_HEADER32*) &(nt_header->OptionalHeader);
660 section = rva_to_section (import_dir.VirtualAddress, nt_header); 667 data_dir = opt->DataDirectory;
661 imports = RVA_TO_PTR (import_dir.VirtualAddress, section, executable); 668 *is_gui_app = (opt->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI);
662 669 }
663 for ( ; imports->Name; imports++) 670 /* MingW 3.12 has the required 64 bit structs, but in case older
664 { 671 versions don't, only check 64 bit exes if we know how. */
665 char * dllname = RVA_TO_PTR (imports->Name, section, executable); 672#ifdef IMAGE_NT_OPTIONAL_HDR64_MAGIC
666 673 else if (nt_header->OptionalHeader.Magic
667 /* The exact name of the cygwin dll has changed with 674 == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
668 various releases, but hopefully this will be reasonably 675 {
669 future proof. */ 676 IMAGE_OPTIONAL_HEADER64 *opt
670 if (strncmp (dllname, "cygwin", 6) == 0) 677 = (IMAGE_OPTIONAL_HEADER64*) &(nt_header->OptionalHeader);
671 { 678 data_dir = opt->DataDirectory;
672 *is_cygnus_app = TRUE; 679 *is_gui_app = (opt->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI);
673 break; 680 }
674 } 681#endif
675 } 682 if (data_dir)
676 683 {
677 /* Check whether app is marked as a console or windowed (aka 684 /* Look for cygwin.dll in DLL import list. */
678 GUI) app. Accept Posix and OS2 subsytem apps as console 685 IMAGE_DATA_DIRECTORY import_dir =
679 apps. */ 686 data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT];
680 *is_gui_app = (nt_header->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI); 687 IMAGE_IMPORT_DESCRIPTOR * imports;
688 IMAGE_SECTION_HEADER * section;
689
690 section = rva_to_section (import_dir.VirtualAddress, nt_header);
691 imports = RVA_TO_PTR (import_dir.VirtualAddress, section,
692 executable);
693
694 for ( ; imports->Name; imports++)
695 {
696 char * dllname = RVA_TO_PTR (imports->Name, section,
697 executable);
698
699 /* The exact name of the cygwin dll has changed with
700 various releases, but hopefully this will be reasonably
701 future proof. */
702 if (strncmp (dllname, "cygwin", 6) == 0)
703 {
704 *is_cygnus_app = TRUE;
705 break;
706 }
707 }
708 }
681 } 709 }
682 } 710 }
683 711
diff --git a/src/window.c b/src/window.c
index 59b70152b09..fc60b72d937 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7602,4 +7602,4 @@ keys_of_window ()
7602} 7602}
7603 7603
7604/* arch-tag: 90a9c576-0590-48f1-a5f1-6c96a0452d9f 7604/* arch-tag: 90a9c576-0590-48f1-a5f1-6c96a0452d9f
7605 (do not change thisc omment) */ 7605 (do not change this comment) */
diff --git a/src/xdisp.c b/src/xdisp.c
index 05898c51512..c8c519107ac 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -18144,6 +18144,16 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
18144#endif 18144#endif
18145 break; 18145 break;
18146 18146
18147 case 'R':
18148 {
18149 Lisp_Object val;
18150 val = call1 (intern ("file-remote-p"), current_buffer->directory);
18151 if (NILP (val))
18152 return "-";
18153 else
18154 return "@";
18155 }
18156
18147 case 't': /* indicate TEXT or BINARY */ 18157 case 't': /* indicate TEXT or BINARY */
18148#ifdef MODE_LINE_BINARY_TEXT 18158#ifdef MODE_LINE_BINARY_TEXT
18149 return MODE_LINE_BINARY_TEXT (b); 18159 return MODE_LINE_BINARY_TEXT (b);
diff --git a/src/xfns.c b/src/xfns.c
index c90c4eb9cfc..b48a5432a86 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3717,6 +3717,7 @@ FRAME nil means use the selected frame. */)
3717 x_catch_errors (dpy); 3717 x_catch_errors (dpy);
3718 XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 3718 XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
3719 RevertToParent, CurrentTime); 3719 RevertToParent, CurrentTime);
3720 x_ewmh_activate_frame (f);
3720 x_uncatch_errors (); 3721 x_uncatch_errors ();
3721 UNBLOCK_INPUT; 3722 UNBLOCK_INPUT;
3722 3723
diff --git a/src/xterm.c b/src/xterm.c
index 51d40f2a4d4..d2fb432e82e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9144,38 +9144,36 @@ x_lower_frame (f)
9144 } 9144 }
9145} 9145}
9146 9146
9147/* Activate frame with Extended Window Manager Hints */
9148
9149void
9150x_ewmh_activate_frame (f)
9151 FRAME_PTR f;
9152{
9153 /* See Window Manager Specification/Extended Window Manager Hints at
9154 http://freedesktop.org/wiki/Standards_2fwm_2dspec */
9155
9156 const char *atom = "_NET_ACTIVE_WINDOW";
9157 if (f->async_visible && wm_supports (f, atom))
9158 {
9159 Lisp_Object frame;
9160 XSETFRAME (frame, f);
9161 Fx_send_client_event (frame, make_number (0), frame,
9162 make_unibyte_string (atom, strlen (atom)),
9163 make_number (32),
9164 Fcons (make_number (1),
9165 Fcons (make_number (last_user_time),
9166 Qnil)));
9167 }
9168}
9169
9147static void 9170static void
9148XTframe_raise_lower (f, raise_flag) 9171XTframe_raise_lower (f, raise_flag)
9149 FRAME_PTR f; 9172 FRAME_PTR f;
9150 int raise_flag; 9173 int raise_flag;
9151{ 9174{
9152 if (raise_flag) 9175 if (raise_flag)
9153 { 9176 x_raise_frame (f);
9154 /* The following code is needed for `raise-frame' to work on
9155 some versions of metacity; see Window Manager
9156 Specification/Extended Window Manager Hints at
9157 http://freedesktop.org/wiki/Standards_2fwm_2dspec */
9158
9159#if 0
9160 /* However, on other versions (metacity 2.17.2-1.fc7), it
9161 reportedly causes hangs when resizing frames. */
9162
9163 const char *atom = "_NET_ACTIVE_WINDOW";
9164 if (f->async_visible && wm_supports (f, atom))
9165 {
9166 Lisp_Object frame;
9167 XSETFRAME (frame, f);
9168 Fx_send_client_event (frame, make_number (0), frame,
9169 make_unibyte_string (atom, strlen (atom)),
9170 make_number (32),
9171 Fcons (make_number (1),
9172 Fcons (make_number (last_user_time),
9173 Qnil)));
9174 }
9175 else
9176#endif
9177 x_raise_frame (f);
9178 }
9179 else 9177 else
9180 x_lower_frame (f); 9178 x_lower_frame (f);
9181} 9179}
diff --git a/src/xterm.h b/src/xterm.h
index 141f58168e1..c607080a5dc 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -999,6 +999,7 @@ extern void x_fully_uncatch_errors P_ ((void));
999extern void x_set_window_size P_ ((struct frame *, int, int, int)); 999extern void x_set_window_size P_ ((struct frame *, int, int, int));
1000extern void x_set_mouse_position P_ ((struct frame *, int, int)); 1000extern void x_set_mouse_position P_ ((struct frame *, int, int));
1001extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int)); 1001extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));
1002extern void x_ewmh_activate_frame P_ ((struct frame *));
1002extern void x_raise_frame P_ ((struct frame *)); 1003extern void x_raise_frame P_ ((struct frame *));
1003extern void x_lower_frame P_ ((struct frame *)); 1004extern void x_lower_frame P_ ((struct frame *));
1004extern void x_make_frame_visible P_ ((struct frame *)); 1005extern void x_make_frame_visible P_ ((struct frame *));