aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/arevert-xtra.texi183
-rw-r--r--man/cal-xtra.texi830
-rw-r--r--man/dired-xtra.texi41
-rw-r--r--man/emerge-xtra.texi390
-rw-r--r--man/fortran-xtra.texi519
-rw-r--r--man/msdog-xtra.texi550
-rw-r--r--man/picture-xtra.texi273
-rw-r--r--man/vc-xtra.texi24
-rw-r--r--man/vc1-xtra.texi137
-rw-r--r--man/vc2-xtra.texi729
10 files changed, 3676 insertions, 0 deletions
diff --git a/man/arevert-xtra.texi b/man/arevert-xtra.texi
new file mode 100644
index 00000000000..f8498125aa0
--- /dev/null
+++ b/man/arevert-xtra.texi
@@ -0,0 +1,183 @@
1@c This file is included either in emacs-xtra.texi (when producing the
2@c printed version) or in the main Emacs manual (for the on-line version).
3@node Autorevert
4@section Auto Reverting non-file Buffers
5
6Normally Global Auto Revert Mode only reverts file buffers. There are
7two ways to auto-revert certain non-file buffers: enabling Auto Revert
8Mode in those buffers (using @kbd{M-x auto-revert-mode}) and setting
9@code{global-auto-revert-non-file-buffers} to @code{t}. The latter
10enables Auto Reverting for all types of buffers for which it is
11implemented, that is, for the types of buffers listed in the menu
12below.
13
14Like file buffers, non-file buffers should normally not revert while
15you are working on them, or while they contain information that might
16get lost after reverting. Therefore, they do not revert if they are
17``modified''. This can get tricky, because deciding when a non-file
18buffer should be marked modified is usually more difficult than for
19file buffers.
20
21Another tricky detail is that, for efficiency reasons, Auto Revert
22often does not try to detect all possible changes in the buffer, only
23changes that are ``major'' or easy to detect. Hence, enabling
24auto-reverting for a non-file buffer does not always guarantee that
25all information in the buffer is up to date and does not necessarily
26make manual reverts useless.
27
28At the other extreme, certain buffers automatically auto-revert every
29@code{auto-revert-interval} seconds. (This currently only applies to
30the Buffer Menu.) In this case, Auto Revert does not print any
31messages while reverting, even when @code{auto-revert-verbose} is
32non-@code{nil}.
33
34The details depend on the particular types of buffers and are
35explained in the corresponding sections.
36
37@menu
38* Auto Reverting the Buffer Menu::
39* Auto Reverting Dired::
40* Supporting additional buffers::
41@end menu
42
43@node Auto Reverting the Buffer Menu
44@subsection Auto Reverting the Buffer Menu
45
46If auto-reverting of non-file buffers is enabled, the Buffer Menu
47automatically reverts every @code{auto-revert-interval} seconds,
48whether there is a need for it or not. (It would probably take longer
49to check whether there is a need than to actually revert.)
50
51If the Buffer Menu inappropriately gets marked modified, just revert
52it manually using @kbd{g} and auto-reverting will resume. However, if
53you marked certain buffers to get deleted or to be displayed, you have
54to be careful, because reverting erases all marks. The fact that
55adding marks sets the buffer's modified flag prevents Auto Revert from
56automatically erasing the marks.
57
58@node Auto Reverting Dired
59@subsection Auto Reverting Dired buffers
60
61Auto-reverting Dired buffers currently works on GNU or Unix style
62operating systems. It may not work satisfactorily on some other
63systems.
64
65Dired buffers only auto-revert when the file list of the buffer's main
66directory changes. They do not auto-revert when information about a
67particular file changes or when inserted subdirectories change. To be
68sure that @emph{all} listed information is up to date, you have to
69manually revert using @kbd{g}, @emph{even} if auto-reverting is
70enabled in the Dired buffer. Sometimes, you might get the impression
71that modifying or saving files listed in the main directory actually
72does cause auto-reverting. This is because making changes to a file,
73or saving it, very often causes changes in the directory itself, for
74instance, through backup files or auto-save files. However, this is
75not guaranteed.
76
77If the Dired buffer is marked modified and there are no changes you
78want to protect, then most of the time you can make auto-reverting
79resume by manually reverting the buffer using @kbd{g}. There is one
80exception. If you flag or mark files, you can safely revert the
81buffer. This will not erase the flags or marks (unless the marked
82file has been deleted, of course). However, the buffer will stay
83modified, even after reverting, and auto-reverting will not resume.
84This is because, if you flag or mark files, you may be working on the
85buffer and you might not want the buffer to change without warning.
86If you want auto-reverting to resume in the presence of marks and
87flags, mark the buffer non-modified using @kbd{M-~}. However, adding,
88deleting or changing marks or flags will mark it modified again.
89
90Remote Dired buffers are not auto-reverted. Neither are Dired buffers
91for which you used shell wildcards or file arguments to list only some
92of the files. @samp{*Find*} and @samp{*Locate*} buffers do not
93auto-revert either.
94
95@node Supporting additional buffers
96@subsection Adding Support for Auto-Reverting additional Buffers.
97
98This section is intended for Elisp programmers who would like to add
99support for auto-reverting new types of buffers.
100
101To support auto-reverting the buffer must first of all have a
102@code{revert-buffer-function}. @xref{Definition of
103revert-buffer-function,, Reverting, elisp, the Emacs Lisp Reference Manual}.
104
105In addition, it @emph{must} have a @code{buffer-stale-function}.
106
107@defvar buffer-stale-function
108The value of this variable is a function to check whether a non-file
109buffer needs reverting. This should be a function with one optional
110argument @var{noconfirm}. The function should return non-@code{nil}
111if the buffer should be reverted. The buffer is current when this
112function is called.
113
114While this function is mainly intended for use in auto-reverting, it
115could be used for other purposes as well. For instance, if
116auto-reverting is not enabled, it could be used to warn the user that
117the buffer needs reverting. The idea behind the @var{noconfirm}
118argument is that it should be @code{t} if the buffer is going to be
119reverted without asking the user and @code{nil} if the function is
120just going to be used to warn the user that the buffer is out of date.
121In particular, for use in auto-reverting, @var{noconfirm} is @code{t}.
122If the function is only going to be used for auto-reverting, you can
123ignore the @var{noconfirm} argument.
124
125If you just want to automatically auto-revert every
126@code{auto-revert-interval} seconds, use:
127
128@example
129(set (make-local-variable 'buffer-stale-function)
130 #'(lambda (&optional noconfirm) 'fast))
131@end example
132
133@noindent
134in the buffer's mode function.
135
136The special return value @samp{fast} tells the caller that the need
137for reverting was not checked, but that reverting the buffer is fast.
138It also tells Auto Revert not to print any revert messages, even if
139@code{auto-revert-verbose} is non-@code{nil}. This is important, as
140getting revert messages every @code{auto-revert-interval} seconds can
141be very annoying. The information provided by this return value could
142also be useful if the function is consulted for purposes other than
143auto-reverting.
144@end defvar
145
146Once the buffer has a @code{revert-buffer-function} and a
147@code{buffer-stale-function}, several problems usually remain.
148
149The buffer will only auto-revert if it is marked unmodified. Hence,
150you will have to make sure that various functions mark the buffer
151modified if and only if either the buffer contains information that
152might be lost by reverting or there is reason to believe that the user
153might be inconvenienced by auto-reverting, because he is actively
154working on the buffer. The user can always override this by manually
155adjusting the modified status of the buffer. To support this, calling
156the @code{revert-buffer-function} on a buffer that is marked
157unmodified should always keep the buffer marked unmodified.
158
159It is important to assure that point does not continuously jump around
160as a consequence of auto-reverting. Of course, moving point might be
161inevitable if the buffer radically changes.
162
163You should make sure that the @code{revert-buffer-function} does not
164print messages that unnecessarily duplicate Auto Revert's own messages
165if @code{auto-revert-verbose} is @code{t} and effectively override a
166@code{nil} value for @code{auto-revert-verbose}. Hence, adapting a
167mode for auto-reverting often involves getting rid of such messages.
168This is especially important for buffers that automatically
169auto-revert every @code{auto-revert-interval} seconds.
170
171Also, you may want to update the documentation string of
172@code{global-auto-revert-non-file-buffers}.
173
174@ifinfo
175Finally, you should add a node to this chapter's menu. This node
176@end ifinfo
177@ifnotinfo
178Finally, you should add a section to this chapter. This section
179@end ifnotinfo
180should at the very least make clear whether enabling auto-reverting
181for the buffer reliably assures that all information in the buffer is
182completely up to date (or will be after @code{auto-revert-interval}
183seconds).
diff --git a/man/cal-xtra.texi b/man/cal-xtra.texi
new file mode 100644
index 00000000000..1e6b0a11a60
--- /dev/null
+++ b/man/cal-xtra.texi
@@ -0,0 +1,830 @@
1@c This file is included either in emacs-xtra.texi (when producing the
2@c printed version) or in the main Emacs manual (for the on-line version).
3
4@c Moved here from the Emacs Lisp Reference Manual, 2005-03-26.
5@node Advanced Calendar/Diary Usage
6@section Customizing the Calendar and Diary
7
8 There are many customizations that you can use to make the calendar and
9diary suit your personal tastes.
10
11@menu
12* Calendar Customizing:: Defaults you can set.
13* Holiday Customizing:: Defining your own holidays.
14* Date Display Format:: Changing the format.
15* Time Display Format:: Changing the format.
16* Diary Customizing:: Defaults you can set.
17* Hebrew/Islamic Entries:: How to obtain them.
18* Fancy Diary Display:: Enhancing the diary display, sorting entries,
19 using included diary files.
20* Sexp Diary Entries:: Fancy things you can do.
21@end menu
22
23@node Calendar Customizing
24@subsection Customizing the Calendar
25@vindex calendar-holiday-marker
26@vindex diary-entry-marker
27 The variable @code{calendar-holiday-marker} specifies how to mark a
28date as being a holiday. Its value may be a single-character string
29to insert next to the date, or a face name to use for displaying the
30date. Likewise, the variable @code{diary-entry-marker} specifies how
31to mark a date that has diary entries. The calendar creates faces
32named @code{holiday-face} and @code{diary-face} for these purposes;
33those symbols are the default values of these variables.
34
35@vindex calendar-load-hook
36 The variable @code{calendar-load-hook} is a normal hook run when the
37calendar package is first loaded (before actually starting to display
38the calendar).
39
40@vindex initial-calendar-window-hook
41 Starting the calendar runs the normal hook
42@code{initial-calendar-window-hook}. Recomputation of the calendar
43display does not run this hook. But if you leave the calendar with the
44@kbd{q} command and reenter it, the hook runs again.@refill
45
46@vindex today-visible-calendar-hook
47 The variable @code{today-visible-calendar-hook} is a normal hook run
48after the calendar buffer has been prepared with the calendar when the
49current date is visible in the window. One use of this hook is to
50replace today's date with asterisks; to do that, use the hook function
51@code{calendar-star-date}.
52
53@findex calendar-star-date
54@example
55(add-hook 'today-visible-calendar-hook 'calendar-star-date)
56@end example
57
58@noindent
59Another standard hook function marks the current date, either by
60changing its face or by adding an asterisk. Here's how to use it:
61
62@findex calendar-mark-today
63@example
64(add-hook 'today-visible-calendar-hook 'calendar-mark-today)
65@end example
66
67@noindent
68@vindex calendar-today-marker
69The variable @code{calendar-today-marker} specifies how to mark
70today's date. Its value should be a single-character string to insert
71next to the date or a face name to use for displaying the date. A
72face named @code{calendar-today-face} is provided for this purpose;
73that symbol is the default for this variable.
74
75@vindex today-invisible-calendar-hook
76@noindent
77 A similar normal hook, @code{today-invisible-calendar-hook} is run if
78the current date is @emph{not} visible in the window.
79
80@vindex calendar-move-hook
81 Each of the calendar cursor motion commands runs the hook
82@code{calendar-move-hook} after it moves the cursor.
83
84@node Holiday Customizing
85@subsection Customizing the Holidays
86
87@vindex calendar-holidays
88@vindex christian-holidays
89@vindex hebrew-holidays
90@vindex islamic-holidays
91 Emacs knows about holidays defined by entries on one of several lists.
92You can customize these lists of holidays to your own needs, adding or
93deleting holidays. The lists of holidays that Emacs uses are for
94general holidays (@code{general-holidays}), local holidays
95(@code{local-holidays}), Christian holidays (@code{christian-holidays}),
96Hebrew (Jewish) holidays (@code{hebrew-holidays}), Islamic (Muslim)
97holidays (@code{islamic-holidays}), and other holidays
98(@code{other-holidays}).
99
100@vindex general-holidays
101 The general holidays are, by default, holidays common throughout the
102United States. To eliminate these holidays, set @code{general-holidays}
103to @code{nil}.
104
105@vindex local-holidays
106 There are no default local holidays (but sites may supply some). You
107can set the variable @code{local-holidays} to any list of holidays, as
108described below.
109
110@vindex all-christian-calendar-holidays
111@vindex all-hebrew-calendar-holidays
112@vindex all-islamic-calendar-holidays
113 By default, Emacs does not include all the holidays of the religions
114that it knows, only those commonly found in secular calendars. For a
115more extensive collection of religious holidays, you can set any (or
116all) of the variables @code{all-christian-calendar-holidays},
117@code{all-hebrew-calendar-holidays}, or
118@code{all-islamic-calendar-holidays} to @code{t}. If you want to
119eliminate the religious holidays, set any or all of the corresponding
120variables @code{christian-holidays}, @code{hebrew-holidays}, and
121@code{islamic-holidays} to @code{nil}.@refill
122
123@vindex other-holidays
124 You can set the variable @code{other-holidays} to any list of
125holidays. This list, normally empty, is intended for individual use.
126
127@cindex holiday forms
128 Each of the lists (@code{general-holidays}, @code{local-holidays},
129@code{christian-holidays}, @code{hebrew-holidays},
130@code{islamic-holidays}, and @code{other-holidays}) is a list of
131@dfn{holiday forms}, each holiday form describing a holiday (or
132sometimes a list of holidays).
133
134 Here is a table of the possible kinds of holiday form. Day numbers
135and month numbers count starting from 1, but ``dayname'' numbers
136count Sunday as 0. The element @var{string} is always the
137name of the holiday, as a string.
138
139@table @code
140@item (holiday-fixed @var{month} @var{day} @var{string})
141A fixed date on the Gregorian calendar.
142
143@item (holiday-float @var{month} @var{dayname} @var{k} @var{string})
144The @var{k}th @var{dayname} in @var{month} on the Gregorian calendar
145(@var{dayname}=0 for Sunday, and so on); negative @var{k} means count back
146from the end of the month.
147
148@item (holiday-hebrew @var{month} @var{day} @var{string})
149A fixed date on the Hebrew calendar.
150
151@item (holiday-islamic @var{month} @var{day} @var{string})
152A fixed date on the Islamic calendar.
153
154@item (holiday-julian @var{month} @var{day} @var{string})
155A fixed date on the Julian calendar.
156
157@item (holiday-sexp @var{sexp} @var{string})
158A date calculated by the Lisp expression @var{sexp}. The expression
159should use the variable @code{year} to compute and return the date of a
160holiday, or @code{nil} if the holiday doesn't happen this year. The
161value of @var{sexp} must represent the date as a list of the form
162@code{(@var{month} @var{day} @var{year})}.
163
164@item (if @var{condition} @var{holiday-form})
165A holiday that happens only if @var{condition} is true.
166
167@item (@var{function} @r{[}@var{args}@r{]})
168A list of dates calculated by the function @var{function}, called with
169arguments @var{args}.
170@end table
171
172 For example, suppose you want to add Bastille Day, celebrated in
173France on July 14. You can do this as follows:
174
175@smallexample
176(setq other-holidays '((holiday-fixed 7 14 "Bastille Day")))
177@end smallexample
178
179@noindent
180The holiday form @code{(holiday-fixed 7 14 "Bastille Day")} specifies the
181fourteenth day of the seventh month (July).
182
183 Many holidays occur on a specific day of the week, at a specific time
184of month. Here is a holiday form describing Hurricane Supplication Day,
185celebrated in the Virgin Islands on the fourth Monday in August:
186
187@smallexample
188(holiday-float 8 1 4 "Hurricane Supplication Day")
189@end smallexample
190
191@noindent
192Here the 8 specifies August, the 1 specifies Monday (Sunday is 0,
193Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in
194the month (1 specifies the first occurrence, 2 the second occurrence,
195@minus{}1 the last occurrence, @minus{}2 the second-to-last occurrence, and
196so on).
197
198 You can specify holidays that occur on fixed days of the Hebrew,
199Islamic, and Julian calendars too. For example,
200
201@smallexample
202(setq other-holidays
203 '((holiday-hebrew 10 2 "Last day of Hanukkah")
204 (holiday-islamic 3 12 "Mohammed's Birthday")
205 (holiday-julian 4 2 "Jefferson's Birthday")))
206@end smallexample
207
208@noindent
209adds the last day of Hanukkah (since the Hebrew months are numbered with
2101 starting from Nisan), the Islamic feast celebrating Mohammed's
211birthday (since the Islamic months are numbered from 1 starting with
212Muharram), and Thomas Jefferson's birthday, which is 2 April 1743 on the
213Julian calendar.
214
215 To include a holiday conditionally, use either Emacs Lisp's @code{if} or the
216@code{holiday-sexp} form. For example, American presidential elections
217occur on the first Tuesday after the first Monday in November of years
218divisible by 4:
219
220@smallexample
221(holiday-sexp '(if (= 0 (% year 4))
222 (calendar-gregorian-from-absolute
223 (1+ (calendar-dayname-on-or-before
224 1 (+ 6 (calendar-absolute-from-gregorian
225 (list 11 1 year)))))))
226 "US Presidential Election")
227@end smallexample
228
229@noindent
230or
231
232@smallexample
233(if (= 0 (% displayed-year 4))
234 (fixed 11
235 (extract-calendar-day
236 (calendar-gregorian-from-absolute
237 (1+ (calendar-dayname-on-or-before
238 1 (+ 6 (calendar-absolute-from-gregorian
239 (list 11 1 displayed-year)))))))
240 "US Presidential Election"))
241@end smallexample
242
243 Some holidays just don't fit into any of these forms because special
244calculations are involved in their determination. In such cases you
245must write a Lisp function to do the calculation. To include eclipses,
246for example, add @code{(eclipses)} to @code{other-holidays}
247and write an Emacs Lisp function @code{eclipses} that returns a
248(possibly empty) list of the relevant Gregorian dates among the range
249visible in the calendar window, with descriptive strings, like this:
250
251@smallexample
252(((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
253@end smallexample
254
255@node Date Display Format
256@subsection Date Display Format
257@vindex calendar-date-display-form
258
259 You can customize the manner of displaying dates in the diary, in mode
260lines, and in messages by setting @code{calendar-date-display-form}.
261This variable holds a list of expressions that can involve the variables
262@code{month}, @code{day}, and @code{year}, which are all numbers in
263string form, and @code{monthname} and @code{dayname}, which are both
264alphabetic strings. In the American style, the default value of this
265list is as follows:
266
267@smallexample
268((if dayname (concat dayname ", ")) monthname " " day ", " year)
269@end smallexample
270
271@noindent
272while in the European style this value is the default:
273
274@smallexample
275((if dayname (concat dayname ", ")) day " " monthname " " year)
276@end smallexample
277
278@noindent
279The ISO standard date representation is this:
280
281@smallexample
282(year "-" month "-" day)
283@end smallexample
284
285@noindent
286This specifies a typical American format:
287
288@smallexample
289(month "/" day "/" (substring year -2))
290@end smallexample
291
292@node Time Display Format
293@subsection Time Display Format
294@vindex calendar-time-display-form
295
296 The calendar and diary by default display times of day in the
297conventional American style with the hours from 1 through 12, minutes,
298and either @samp{am} or @samp{pm}. If you prefer the European style,
299also known in the US as military, in which the hours go from 00 to 23,
300you can alter the variable @code{calendar-time-display-form}. This
301variable is a list of expressions that can involve the variables
302@code{12-hours}, @code{24-hours}, and @code{minutes}, which are all
303numbers in string form, and @code{am-pm} and @code{time-zone}, which are
304both alphabetic strings. The default value of
305@code{calendar-time-display-form} is as follows:
306
307@smallexample
308(12-hours ":" minutes am-pm
309 (if time-zone " (") time-zone (if time-zone ")"))
310@end smallexample
311
312@noindent
313Here is a value that provides European style times:
314
315@smallexample
316(24-hours ":" minutes
317 (if time-zone " (") time-zone (if time-zone ")"))
318@end smallexample
319
320@node Diary Customizing
321@subsection Customizing the Diary
322
323@vindex holidays-in-diary-buffer
324 Ordinarily, the mode line of the diary buffer window indicates any
325holidays that fall on the date of the diary entries. The process of
326checking for holidays can take several seconds, so including holiday
327information delays the display of the diary buffer noticeably. If you'd
328prefer to have a faster display of the diary buffer but without the
329holiday information, set the variable @code{holidays-in-diary-buffer} to
330@code{nil}.@refill
331
332@vindex number-of-diary-entries
333 The variable @code{number-of-diary-entries} controls the number of
334days of diary entries to be displayed at one time. It affects the
335initial display when @code{view-diary-entries-initially} is @code{t}, as
336well as the command @kbd{M-x diary}. For example, the default value is
3371, which says to display only the current day's diary entries. If the
338value is 2, both the current day's and the next day's entries are
339displayed. The value can also be a vector of seven elements: for
340example, if the value is @code{[0 2 2 2 2 4 1]} then no diary entries
341appear on Sunday, the current date's and the next day's diary entries
342appear Monday through Thursday, Friday through Monday's entries appear
343on Friday, while on Saturday only that day's entries appear.
344
345@vindex print-diary-entries-hook
346@findex print-diary-entries
347 The variable @code{print-diary-entries-hook} is a normal hook run
348after preparation of a temporary buffer containing just the diary
349entries currently visible in the diary buffer. (The other, irrelevant
350diary entries are really absent from the temporary buffer; in the diary
351buffer, they are merely hidden.) The default value of this hook does
352the printing with the command @code{lpr-buffer}. If you want to use a
353different command to do the printing, just change the value of this
354hook. Other uses might include, for example, rearranging the lines into
355order by day and time.
356
357@vindex diary-date-forms
358 You can customize the form of dates in your diary file, if neither the
359standard American nor European styles suits your needs, by setting the
360variable @code{diary-date-forms}. This variable is a list of patterns
361for recognizing a date. Each date pattern is a list whose elements may
362be regular expressions (@pxref{Regular Expressions,,, elisp, the Emacs
363Lisp Reference Manual}) or the symbols @code{month}, @code{day},
364@code{year}, @code{monthname}, and @code{dayname}. All these elements
365serve as patterns that match certain kinds of text in the diary file.
366In order for the date pattern, as a whole, to match, all of its elements
367must match consecutively.
368
369 A regular expression in a date pattern matches in its usual fashion,
370using the standard syntax table altered so that @samp{*} is a word
371constituent.
372
373 The symbols @code{month}, @code{day}, @code{year}, @code{monthname},
374and @code{dayname} match the month number, day number, year number,
375month name, and day name of the date being considered. The symbols that
376match numbers allow leading zeros; those that match names allow
377three-letter abbreviations and capitalization. All the symbols can
378match @samp{*}; since @samp{*} in a diary entry means ``any day'', ``any
379month'', and so on, it should match regardless of the date being
380considered.
381
382 The default value of @code{diary-date-forms} in the American style is
383this:
384
385@example
386((month "/" day "[^/0-9]")
387 (month "/" day "/" year "[^0-9]")
388 (monthname " *" day "[^,0-9]")
389 (monthname " *" day ", *" year "[^0-9]")
390 (dayname "\\W"))
391@end example
392
393 The date patterns in the list must be @emph{mutually exclusive} and
394must not match any portion of the diary entry itself, just the date and
395one character of whitespace. If, to be mutually exclusive, the pattern
396must match a portion of the diary entry text---beyond the whitespace
397that ends the date---then the first element of the date pattern
398@emph{must} be @code{backup}. This causes the date recognizer to back
399up to the beginning of the current word of the diary entry, after
400finishing the match. Even if you use @code{backup}, the date pattern
401must absolutely not match more than a portion of the first word of the
402diary entry. The default value of @code{diary-date-forms} in the
403European style is this list:
404
405@example
406((day "/" month "[^/0-9]")
407 (day "/" month "/" year "[^0-9]")
408 (backup day " *" monthname "\\W+\\<[^*0-9]")
409 (day " *" monthname " *" year "[^0-9]")
410 (dayname "\\W"))
411@end example
412
413@noindent
414Notice the use of @code{backup} in the third pattern, because it needs
415to match part of a word beyond the date itself to distinguish it from
416the fourth pattern.
417
418@node Hebrew/Islamic Entries
419@subsection Hebrew- and Islamic-Date Diary Entries
420
421 Your diary file can have entries based on Hebrew or Islamic dates, as
422well as entries based on the world-standard Gregorian calendar.
423However, because recognition of such entries is time-consuming and most
424people don't use them, you must explicitly enable their use. If you
425want the diary to recognize Hebrew-date diary entries, for example,
426you must do this:
427
428@vindex nongregorian-diary-listing-hook
429@vindex nongregorian-diary-marking-hook
430@findex list-hebrew-diary-entries
431@findex mark-hebrew-diary-entries
432@smallexample
433(add-hook 'nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
434(add-hook 'nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
435@end smallexample
436
437@noindent
438If you want Islamic-date entries, do this:
439
440@findex list-islamic-diary-entries
441@findex mark-islamic-diary-entries
442@smallexample
443(add-hook 'nongregorian-diary-listing-hook 'list-islamic-diary-entries)
444(add-hook 'nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
445@end smallexample
446
447 Hebrew- and Islamic-date diary entries have the same formats as
448Gregorian-date diary entries, except that @samp{H} precedes a Hebrew
449date and @samp{I} precedes an Islamic date. Moreover, because the
450Hebrew and Islamic month names are not uniquely specified by the first
451three letters, you may not abbreviate them. For example, a diary entry
452for the Hebrew date Heshvan 25 could look like this:
453
454@smallexample
455HHeshvan 25 Happy Hebrew birthday!
456@end smallexample
457
458@noindent
459and would appear in the diary for any date that corresponds to Heshvan 25
460on the Hebrew calendar. And here is an Islamic-date diary entry that matches
461Dhu al-Qada 25:
462
463@smallexample
464IDhu al-Qada 25 Happy Islamic birthday!
465@end smallexample
466
467 As with Gregorian-date diary entries, Hebrew- and Islamic-date entries
468are nonmarking if they are preceded with an ampersand (@samp{&}).
469
470 Here is a table of commands used in the calendar to create diary entries
471that match the selected date and other dates that are similar in the Hebrew
472or Islamic calendar:
473
474@table @kbd
475@item i h d
476Add a diary entry for the Hebrew date corresponding to the selected date
477(@code{insert-hebrew-diary-entry}).
478@item i h m
479Add a diary entry for the day of the Hebrew month corresponding to the
480selected date (@code{insert-monthly-hebrew-diary-entry}). This diary
481entry matches any date that has the same Hebrew day-within-month as the
482selected date.
483@item i h y
484Add a diary entry for the day of the Hebrew year corresponding to the
485selected date (@code{insert-yearly-hebrew-diary-entry}). This diary
486entry matches any date which has the same Hebrew month and day-within-month
487as the selected date.
488@item i i d
489Add a diary entry for the Islamic date corresponding to the selected date
490(@code{insert-islamic-diary-entry}).
491@item i i m
492Add a diary entry for the day of the Islamic month corresponding to the
493selected date (@code{insert-monthly-islamic-diary-entry}).
494@item i i y
495Add a diary entry for the day of the Islamic year corresponding to the
496selected date (@code{insert-yearly-islamic-diary-entry}).
497@end table
498
499@findex insert-hebrew-diary-entry
500@findex insert-monthly-hebrew-diary-entry
501@findex insert-yearly-hebrew-diary-entry
502@findex insert-islamic-diary-entry
503@findex insert-monthly-islamic-diary-entry
504@findex insert-yearly-islamic-diary-entry
505 These commands work much like the corresponding commands for ordinary
506diary entries: they apply to the date that point is on in the calendar
507window, and what they do is insert just the date portion of a diary entry
508at the end of your diary file. You must then insert the rest of the
509diary entry.
510
511@node Fancy Diary Display
512@subsection Fancy Diary Display
513@vindex diary-display-hook
514@findex simple-diary-display
515
516 Diary display works by preparing the diary buffer and then running the
517hook @code{diary-display-hook}. The default value of this hook
518(@code{simple-diary-display}) hides the irrelevant diary entries and
519then displays the buffer. However, if you specify the hook as follows,
520
521@cindex diary buffer
522@findex fancy-diary-display
523@example
524(add-hook 'diary-display-hook 'fancy-diary-display)
525@end example
526
527@noindent
528this enables fancy diary display. It displays diary entries and
529holidays by copying them into a special buffer that exists only for the
530sake of display. Copying to a separate buffer provides an opportunity
531to change the displayed text to make it prettier---for example, to sort
532the entries by the dates they apply to.
533
534 As with simple diary display, you can print a hard copy of the buffer
535with @code{print-diary-entries}. To print a hard copy of a day-by-day
536diary for a week, position point on Sunday of that week, type
537@kbd{7 d}, and then do @kbd{M-x print-diary-entries}. As usual, the
538inclusion of the holidays slows down the display slightly; you can speed
539things up by setting the variable @code{holidays-in-diary-buffer} to
540@code{nil}.
541
542@vindex diary-list-include-blanks
543 Ordinarily, the fancy diary buffer does not show days for which there are
544no diary entries, even if that day is a holiday. If you want such days to be
545shown in the fancy diary buffer, set the variable
546@code{diary-list-include-blanks} to @code{t}.@refill
547
548@cindex sorting diary entries
549 If you use the fancy diary display, you can use the normal hook
550@code{list-diary-entries-hook} to sort each day's diary entries by their
551time of day. Here's how:
552
553@findex sort-diary-entries
554@example
555(add-hook 'list-diary-entries-hook 'sort-diary-entries t)
556@end example
557
558@noindent
559For each day, this sorts diary entries that begin with a recognizable
560time of day according to their times. Diary entries without times come
561first within each day.
562
563 Fancy diary display also has the ability to process included diary
564files. This permits a group of people to share a diary file for events
565that apply to all of them. Lines in the diary file of this form:
566
567@smallexample
568#include "@var{filename}"
569@end smallexample
570
571@noindent
572includes the diary entries from the file @var{filename} in the fancy
573diary buffer. The include mechanism is recursive, so that included files
574can include other files, and so on; you must be careful not to have a
575cycle of inclusions, of course. Here is how to enable the include
576facility:
577
578@vindex list-diary-entries-hook
579@vindex mark-diary-entries-hook
580@findex include-other-diary-files
581@findex mark-included-diary-files
582@smallexample
583(add-hook 'list-diary-entries-hook 'include-other-diary-files)
584(add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
585@end smallexample
586
587The include mechanism works only with the fancy diary display, because
588ordinary diary display shows the entries directly from your diary file.
589
590@node Sexp Diary Entries
591@subsection Sexp Entries and the Fancy Diary Display
592@cindex sexp diary entries
593
594 Sexp diary entries allow you to do more than just have complicated
595conditions under which a diary entry applies. If you use the fancy
596diary display, sexp entries can generate the text of the entry depending
597on the date itself. For example, an anniversary diary entry can insert
598the number of years since the anniversary date into the text of the
599diary entry. Thus the @samp{%d} in this dairy entry:
600
601@findex diary-anniversary
602@smallexample
603%%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old)
604@end smallexample
605
606@noindent
607gets replaced by the age, so on October 31, 1990 the entry appears in
608the fancy diary buffer like this:
609
610@smallexample
611Arthur's birthday (42 years old)
612@end smallexample
613
614@noindent
615If the diary file instead contains this entry:
616
617@smallexample
618%%(diary-anniversary 10 31 1948) Arthur's %d%s birthday
619@end smallexample
620
621@noindent
622the entry in the fancy diary buffer for October 31, 1990 appears like this:
623
624@smallexample
625Arthur's 42nd birthday
626@end smallexample
627
628 Similarly, cyclic diary entries can interpolate the number of repetitions
629that have occurred:
630
631@findex diary-cyclic
632@smallexample
633%%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time)
634@end smallexample
635
636@noindent
637looks like this:
638
639@smallexample
640Renew medication (5th time)
641@end smallexample
642
643@noindent
644in the fancy diary display on September 8, 1990.
645
646 There is an early reminder diary sexp that includes its entry in the
647diary not only on the date of occurrence, but also on earlier dates.
648For example, if you want a reminder a week before your anniversary, you
649can use
650
651@findex diary-remind
652@smallexample
653%%(diary-remind '(diary-anniversary 12 22 1968) 7) Ed's anniversary
654@end smallexample
655
656@noindent
657and the fancy diary will show
658@smallexample
659Ed's anniversary
660@end smallexample
661@noindent
662both on December 15 and on December 22.
663
664@findex diary-date
665 The function @code{diary-date} applies to dates described by a month,
666day, year combination, each of which can be an integer, a list of
667integers, or @code{t}. The value @code{t} means all values. For
668example,
669
670@smallexample
671%%(diary-date '(10 11 12) 22 t) Rake leaves
672@end smallexample
673
674@noindent
675causes the fancy diary to show
676
677@smallexample
678Rake leaves
679@end smallexample
680
681@noindent
682on October 22, November 22, and December 22 of every year.
683
684@findex diary-float
685 The function @code{diary-float} allows you to describe diary entries
686that apply to dates like the third Friday of November, or the last
687Tuesday in April. The parameters are the @var{month}, @var{dayname},
688and an index @var{n}. The entry appears on the @var{n}th @var{dayname}
689of @var{month}, where @var{dayname}=0 means Sunday, 1 means Monday, and
690so on. If @var{n} is negative it counts backward from the end of
691@var{month}. The value of @var{month} can be a list of months, a single
692month, or @code{t} to specify all months. You can also use an optional
693parameter @var{day} to specify the @var{n}th @var{dayname} of
694@var{month} on or after/before @var{day}; the value of @var{day} defaults
695to 1 if @var{n} is positive and to the last day of @var{month} if
696@var{n} is negative. For example,
697
698@smallexample
699%%(diary-float t 1 -1) Pay rent
700@end smallexample
701
702@noindent
703causes the fancy diary to show
704
705@smallexample
706Pay rent
707@end smallexample
708
709@noindent
710on the last Monday of every month.
711
712 The generality of sexp diary entries lets you specify any diary
713entry that you can describe algorithmically. A sexp diary entry
714contains an expression that computes whether the entry applies to any
715given date. If its value is non-@code{nil}, the entry applies to that
716date; otherwise, it does not. The expression can use the variable
717@code{date} to find the date being considered; its value is a list
718(@var{month} @var{day} @var{year}) that refers to the Gregorian
719calendar.
720
721 The sexp diary entry applies to a date when the expression's value
722is non-@code{nil}, but some values have more specific meanings. If
723the value is a string, that string is a description of the event which
724occurs on that date. The value can also have the form
725@code{(@var{mark} . @var{string})}; then @var{mark} specifies how to
726mark the date in the calendar, and @var{string} is the description of
727the event. If @var{mark} is a single-character string, that character
728appears next to the date in the calendar. If @var{mark} is a face
729name, the date is displayed in that face. If @var{mark} is
730@code{nil}, that specifies no particular highlighting for the date.
731
732 Suppose you get paid on the 21st of the month if it is a weekday, and
733on the Friday before if the 21st is on a weekend. Here is how to write
734a sexp diary entry that matches those dates:
735
736@smallexample
737&%%(let ((dayname (calendar-day-of-week date))
738 (day (car (cdr date))))
739 (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
740 (and (memq day '(19 20)) (= dayname 5)))
741 ) Pay check deposited
742@end smallexample
743
744 The following sexp diary entries take advantage of the ability (in the fancy
745diary display) to concoct diary entries whose text varies based on the date:
746
747@findex diary-sunrise-sunset
748@findex diary-phases-of-moon
749@findex diary-day-of-year
750@findex diary-iso-date
751@findex diary-julian-date
752@findex diary-astro-day-number
753@findex diary-hebrew-date
754@findex diary-islamic-date
755@findex diary-french-date
756@findex diary-mayan-date
757@table @code
758@item %%(diary-sunrise-sunset)
759Make a diary entry for the local times of today's sunrise and sunset.
760@item %%(diary-phases-of-moon)
761Make a diary entry for the phases (quarters) of the moon.
762@item %%(diary-day-of-year)
763Make a diary entry with today's day number in the current year and the number
764of days remaining in the current year.
765@item %%(diary-iso-date)
766Make a diary entry with today's equivalent ISO commercial date.
767@item %%(diary-julian-date)
768Make a diary entry with today's equivalent date on the Julian calendar.
769@item %%(diary-astro-day-number)
770Make a diary entry with today's equivalent astronomical (Julian) day number.
771@item %%(diary-hebrew-date)
772Make a diary entry with today's equivalent date on the Hebrew calendar.
773@item %%(diary-islamic-date)
774Make a diary entry with today's equivalent date on the Islamic calendar.
775@item %%(diary-french-date)
776Make a diary entry with today's equivalent date on the French Revolutionary
777calendar.
778@item %%(diary-mayan-date)
779Make a diary entry with today's equivalent date on the Mayan calendar.
780@end table
781
782@noindent
783Thus including the diary entry
784
785@example
786&%%(diary-hebrew-date)
787@end example
788
789@noindent
790causes every day's diary display to contain the equivalent date on the
791Hebrew calendar, if you are using the fancy diary display. (With simple
792diary display, the line @samp{&%%(diary-hebrew-date)} appears in the
793diary for any date, but does nothing particularly useful.)
794
795 These functions can be used to construct sexp diary entries based on
796the Hebrew calendar in certain standard ways:
797
798@cindex rosh hodesh
799@findex diary-rosh-hodesh
800@cindex parasha, weekly
801@findex diary-parasha
802@cindex candle lighting times
803@findex diary-sabbath-candles
804@cindex omer count
805@findex diary-omer
806@cindex yahrzeits
807@findex diary-yahrzeit
808@table @code
809@item %%(diary-rosh-hodesh)
810Make a diary entry that tells the occurrence and ritual announcement of each
811new Hebrew month.
812@item %%(diary-parasha)
813Make a Saturday diary entry that tells the weekly synagogue scripture reading.
814@item %%(diary-sabbath-candles)
815Make a Friday diary entry that tells the @emph{local time} of Sabbath
816candle lighting.
817@item %%(diary-omer)
818Make a diary entry that gives the omer count, when appropriate.
819@item %%(diary-yahrzeit @var{month} @var{day} @var{year}) @var{name}
820Make a diary entry marking the anniversary of a date of death. The date
821is the @emph{Gregorian} (civil) date of death. The diary entry appears
822on the proper Hebrew calendar anniversary and on the day before. (In
823the European style, the order of the parameters is changed to @var{day},
824@var{month}, @var{year}.)
825@end table
826
827 All the functions documented above take an optional argument
828@var{mark} which specifies how to mark the date in the calendar display.
829If one of these functions decides that it applies to a certain date,
830it returns a value that contains @var{mark}.
diff --git a/man/dired-xtra.texi b/man/dired-xtra.texi
new file mode 100644
index 00000000000..9939482dfba
--- /dev/null
+++ b/man/dired-xtra.texi
@@ -0,0 +1,41 @@
1@c This file is included either in emacs-xtra.texi (when producing the
2@c printed version) or in the main Emacs manual (for the on-line version).
3@node Subdir Switches
4@section Subdirectory Switches in Dired
5
6You can insert subdirectories with specified @code{ls} switches in
7Dired buffers, using @kbd{C-u i}. You can change the @code{ls}
8switches of an already inserted subdirectory using @kbd{C-u l}.
9
10In Emacs versions 22.1 and later, Dired remembers the switches, so
11that reverting the buffer will not change them back to the main
12directory's switches. Deleting a subdirectory forgets about its
13switches.
14
15Using @code{dired-undo} (usually bound to @kbd{C-_} and @kbd{C-x u})
16to reinsert or delete subdirectories, that were inserted with explicit
17switches, can bypass Dired's machinery for remembering (or forgetting)
18switches. Deleting a subdirectory using @code{dired-undo} does not
19forget its switches. When later reinserted using @kbd{i}, it will be
20reinserted using its old switches. Using @code{dired-undo} to
21reinsert a subdirectory that was deleted using the regular
22Dired commands (not @code{dired-undo}) will originally insert it with
23its old switches. However, reverting the buffer will relist it using
24the buffer's default switches. If any of this yields problems, you
25can easily correct the situation using @kbd{C-u i} or @kbd{C-u l}.
26
27Dired does not remember the @code{R} switch. Inserting a subdirectory
28with switches that include the @code{R} switch is equivalent with
29inserting each of its subdirectories using all remaining switches.
30For instance, updating or killing a subdirectory that was inserted
31with the @code{R} switch will not update or kill its subdirectories.
32
33The buffer's default switches do not affect subdirectories that were
34inserted using explicitly specified switches. In particular,
35commands such as @kbd{s}, that change the buffer's switches do not
36affect such subdirectories. (They do affect subdirectories without
37explicitly assigned switches, however.)
38
39You can make Dired forget about all subdirectory switches and relist
40all subdirectories with the buffer's default switches using
41@kbd{M-x dired-reset-subdir-switches}. This also reverts the Dired buffer.
diff --git a/man/emerge-xtra.texi b/man/emerge-xtra.texi
new file mode 100644
index 00000000000..d299a6d6041
--- /dev/null
+++ b/man/emerge-xtra.texi
@@ -0,0 +1,390 @@
1@c This file is included either in emacs-xtra.texi (when producing the
2@c printed version) or in the main Emacs manual (for the on-line version).
3@node Emerge
4@section Merging Files with Emerge
5@cindex Emerge
6@cindex merging files
7
8 It's not unusual for programmers to get their signals crossed and
9modify the same program in two different directions. To recover from
10this confusion, you need to merge the two versions. Emerge makes this
11easier. For other ways to compare files, see @ref{Comparing Files,,,
12emacs, the Emacs Manual} and @ref{Top, Ediff,, ediff, The Ediff
13Manual}.
14
15@menu
16* Overview of Emerge:: How to start Emerge. Basic concepts.
17* Submodes of Emerge:: Fast mode vs. Edit mode.
18 Skip Prefers mode and Auto Advance mode.
19* State of Difference:: You do the merge by specifying state A or B
20 for each difference.
21* Merge Commands:: Commands for selecting a difference,
22 changing states of differences, etc.
23* Exiting Emerge:: What to do when you've finished the merge.
24* Combining in Emerge:: How to keep both alternatives for a difference.
25* Fine Points of Emerge:: Misc.
26@end menu
27
28@node Overview of Emerge
29@subsection Overview of Emerge
30
31 To start Emerge, run one of these four commands:
32
33@table @kbd
34@item M-x emerge-files
35@findex emerge-files
36Merge two specified files.
37
38@item M-x emerge-files-with-ancestor
39@findex emerge-files-with-ancestor
40Merge two specified files, with reference to a common ancestor.
41
42@item M-x emerge-buffers
43@findex emerge-buffers
44Merge two buffers.
45
46@item M-x emerge-buffers-with-ancestor
47@findex emerge-buffers-with-ancestor
48Merge two buffers with reference to a common ancestor in a third
49buffer.
50@end table
51
52@cindex merge buffer (Emerge)
53@cindex A and B buffers (Emerge)
54 The Emerge commands compare two files or buffers, and display the
55comparison in three buffers: one for each input text (the @dfn{A buffer}
56and the @dfn{B buffer}), and one (the @dfn{merge buffer}) where merging
57takes place. The merge buffer shows the full merged text, not just the
58differences. Wherever the two input texts differ, you can choose which
59one of them to include in the merge buffer.
60
61 The Emerge commands that take input from existing buffers use only
62the accessible portions of those buffers, if they are narrowed.
63@xref{Narrowing,,, emacs, the Emacs Manual}.
64
65
66 If a common ancestor version is available, from which the two texts to
67be merged were both derived, Emerge can use it to guess which
68alternative is right. Wherever one current version agrees with the
69ancestor, Emerge presumes that the other current version is a deliberate
70change which should be kept in the merged version. Use the
71@samp{with-ancestor} commands if you want to specify a common ancestor
72text. These commands read three file or buffer names---variant A,
73variant B, and the common ancestor.
74
75 After the comparison is done and the buffers are prepared, the
76interactive merging starts. You control the merging by typing special
77@dfn{merge commands} in the merge buffer (@pxref{Merge Commands}).
78For each run of differences between the input texts, you can choose
79which one of them to keep, or edit them both together.
80
81 The merge buffer uses a special major mode, Emerge mode, with commands
82for making these choices. But you can also edit the buffer with
83ordinary Emacs commands.
84
85 At any given time, the attention of Emerge is focused on one
86particular difference, called the @dfn{selected} difference. This
87difference is marked off in the three buffers like this:
88
89@example
90vvvvvvvvvvvvvvvvvvvv
91@var{text that differs}
92^^^^^^^^^^^^^^^^^^^^
93@end example
94
95@noindent
96Emerge numbers all the differences sequentially and the mode
97line always shows the number of the selected difference.
98
99 Normally, the merge buffer starts out with the A version of the text.
100But when the A version of a difference agrees with the common ancestor,
101then the B version is initially preferred for that difference.
102
103 Emerge leaves the merged text in the merge buffer when you exit. At
104that point, you can save it in a file with @kbd{C-x C-w}. If you give a
105numeric argument to @code{emerge-files} or
106@code{emerge-files-with-ancestor}, it reads the name of the output file
107using the minibuffer. (This is the last file name those commands read.)
108Then exiting from Emerge saves the merged text in the output file.
109
110 Normally, Emerge commands save the output buffer in its file when you
111exit. If you abort Emerge with @kbd{C-]}, the Emerge command does not
112save the output buffer, but you can save it yourself if you wish.
113
114@node Submodes of Emerge
115@subsection Submodes of Emerge
116
117 You can choose between two modes for giving merge commands: Fast mode
118and Edit mode. In Fast mode, basic merge commands are single
119characters, but ordinary Emacs commands are disabled. This is
120convenient if you use only merge commands. In Edit mode, all merge
121commands start with the prefix key @kbd{C-c C-c}, and the normal Emacs
122commands are also available. This allows editing the merge buffer, but
123slows down Emerge operations.
124
125 Use @kbd{e} to switch to Edit mode, and @kbd{C-c C-c f} to switch to
126Fast mode. The mode line indicates Edit and Fast modes with @samp{E}
127and @samp{F}.
128
129 Emerge has two additional submodes that affect how particular merge
130commands work: Auto Advance mode and Skip Prefers mode.
131
132 If Auto Advance mode is in effect, the @kbd{a} and @kbd{b} commands
133advance to the next difference. This lets you go through the merge
134faster as long as you simply choose one of the alternatives from the
135input. The mode line indicates Auto Advance mode with @samp{A}.
136
137 If Skip Prefers mode is in effect, the @kbd{n} and @kbd{p} commands
138skip over differences in states prefer-A and prefer-B (@pxref{State of
139Difference}). Thus you see only differences for which neither version
140is presumed ``correct.'' The mode line indicates Skip Prefers mode with
141@samp{S}.
142
143@findex emerge-auto-advance-mode
144@findex emerge-skip-prefers-mode
145 Use the command @kbd{s a} (@code{emerge-auto-advance-mode}) to set or
146clear Auto Advance mode. Use @kbd{s s}
147(@code{emerge-skip-prefers-mode}) to set or clear Skip Prefers mode.
148These commands turn on the mode with a positive argument, turns it off
149with a negative or zero argument, and toggle the mode with no argument.
150
151@node State of Difference
152@subsection State of a Difference
153
154 In the merge buffer, a difference is marked with lines of @samp{v} and
155@samp{^} characters. Each difference has one of these seven states:
156
157@table @asis
158@item A
159The difference is showing the A version. The @kbd{a} command always
160produces this state; the mode line indicates it with @samp{A}.
161
162@item B
163The difference is showing the B version. The @kbd{b} command always
164produces this state; the mode line indicates it with @samp{B}.
165
166@item default-A
167@itemx default-B
168The difference is showing the A or the B state by default, because you
169haven't made a choice. All differences start in the default-A state
170(and thus the merge buffer is a copy of the A buffer), except those for
171which one alternative is ``preferred'' (see below).
172
173When you select a difference, its state changes from default-A or
174default-B to plain A or B. Thus, the selected difference never has
175state default-A or default-B, and these states are never displayed in
176the mode line.
177
178The command @kbd{d a} chooses default-A as the default state, and @kbd{d
179b} chooses default-B. This chosen default applies to all differences
180which you haven't ever selected and for which no alternative is preferred.
181If you are moving through the merge sequentially, the differences you
182haven't selected are those following the selected one. Thus, while
183moving sequentially, you can effectively make the A version the default
184for some sections of the merge buffer and the B version the default for
185others by using @kbd{d a} and @kbd{d b} between sections.
186
187@item prefer-A
188@itemx prefer-B
189The difference is showing the A or B state because it is
190@dfn{preferred}. This means that you haven't made an explicit choice,
191but one alternative seems likely to be right because the other
192alternative agrees with the common ancestor. Thus, where the A buffer
193agrees with the common ancestor, the B version is preferred, because
194chances are it is the one that was actually changed.
195
196These two states are displayed in the mode line as @samp{A*} and @samp{B*}.
197
198@item combined
199The difference is showing a combination of the A and B states, as a
200result of the @kbd{x c} or @kbd{x C} commands.
201
202Once a difference is in this state, the @kbd{a} and @kbd{b} commands
203don't do anything to it unless you give them a numeric argument.
204
205The mode line displays this state as @samp{comb}.
206@end table
207
208@node Merge Commands
209@subsection Merge Commands
210
211 Here are the Merge commands for Fast mode; in Edit mode, precede them
212with @kbd{C-c C-c}:
213
214@table @kbd
215@item p
216Select the previous difference.
217
218@item n
219Select the next difference.
220
221@item a
222Choose the A version of this difference.
223
224@item b
225Choose the B version of this difference.
226
227@item C-u @var{n} j
228Select difference number @var{n}.
229
230@item .
231Select the difference containing point. You can use this command in the
232merge buffer or in the A or B buffer.
233
234@item q
235Quit---finish the merge.
236
237@item C-]
238Abort---exit merging and do not save the output.
239
240@item f
241Go into Fast mode. (In Edit mode, this is actually @kbd{C-c C-c f}.)
242
243@item e
244Go into Edit mode.
245
246@item l
247Recenter (like @kbd{C-l}) all three windows.
248
249@item -
250Specify part of a prefix numeric argument.
251
252@item @var{digit}
253Also specify part of a prefix numeric argument.
254
255@item d a
256Choose the A version as the default from here down in
257the merge buffer.
258
259@item d b
260Choose the B version as the default from here down in
261the merge buffer.
262
263@item c a
264Copy the A version of this difference into the kill ring.
265
266@item c b
267Copy the B version of this difference into the kill ring.
268
269@item i a
270Insert the A version of this difference at point.
271
272@item i b
273Insert the B version of this difference at point.
274
275@item m
276Put point and mark around the difference.
277
278@item ^
279Scroll all three windows down (like @kbd{M-v}).
280
281@item v
282Scroll all three windows up (like @kbd{C-v}).
283
284@item <
285Scroll all three windows left (like @kbd{C-x <}).
286
287@item >
288Scroll all three windows right (like @kbd{C-x >}).
289
290@item |
291Reset horizontal scroll on all three windows.
292
293@item x 1
294Shrink the merge window to one line. (Use @kbd{C-u l} to restore it
295to full size.)
296
297@item x c
298Combine the two versions of this difference (@pxref{Combining in
299Emerge}).
300
301@item x f
302Show the names of the files/buffers Emerge is operating on, in a Help
303window. (Use @kbd{C-u l} to restore windows.)
304
305@item x j
306Join this difference with the following one.
307(@kbd{C-u x j} joins this difference with the previous one.)
308
309@item x s
310Split this difference into two differences. Before you use this
311command, position point in each of the three buffers at the place where
312you want to split the difference.
313
314@item x t
315Trim identical lines off the top and bottom of the difference.
316Such lines occur when the A and B versions are
317identical but differ from the ancestor version.
318@end table
319
320@node Exiting Emerge
321@subsection Exiting Emerge
322
323 The @kbd{q} command (@code{emerge-quit}) finishes the merge, storing
324the results into the output file if you specified one. It restores the
325A and B buffers to their proper contents, or kills them if they were
326created by Emerge and you haven't changed them. It also disables the
327Emerge commands in the merge buffer, since executing them later could
328damage the contents of the various buffers.
329
330 @kbd{C-]} aborts the merge. This means exiting without writing the
331output file. If you didn't specify an output file, then there is no
332real difference between aborting and finishing the merge.
333
334 If the Emerge command was called from another Lisp program, then its
335return value is @code{t} for successful completion, or @code{nil} if you
336abort.
337
338@node Combining in Emerge
339@subsection Combining the Two Versions
340
341 Sometimes you want to keep @emph{both} alternatives for a particular
342difference. To do this, use @kbd{x c}, which edits the merge buffer
343like this:
344
345@example
346@group
347#ifdef NEW
348@var{version from A buffer}
349#else /* not NEW */
350@var{version from B buffer}
351#endif /* not NEW */
352@end group
353@end example
354
355@noindent
356@vindex emerge-combine-versions-template
357While this example shows C preprocessor conditionals delimiting the two
358alternative versions, you can specify the strings to use by setting
359the variable @code{emerge-combine-versions-template} to a string of your
360choice. In the string, @samp{%a} says where to put version A, and
361@samp{%b} says where to put version B. The default setting, which
362produces the results shown above, looks like this:
363
364@example
365@group
366"#ifdef NEW\n%a#else /* not NEW */\n%b#endif /* not NEW */\n"
367@end group
368@end example
369
370@node Fine Points of Emerge
371@subsection Fine Points of Emerge
372
373 During the merge, you mustn't try to edit the A and B buffers yourself.
374Emerge modifies them temporarily, but ultimately puts them back the way
375they were.
376
377 You can have any number of merges going at once---just don't use any one
378buffer as input to more than one merge at once, since the temporary
379changes made in these buffers would get in each other's way.
380
381 Starting Emerge can take a long time because it needs to compare the
382files fully. Emacs can't do anything else until @code{diff} finishes.
383Perhaps in the future someone will change Emerge to do the comparison in
384the background when the input files are large---then you could keep on
385doing other things with Emacs until Emerge is ready to accept
386commands.
387
388@vindex emerge-startup-hook
389 After setting up the merge, Emerge runs the hook
390@code{emerge-startup-hook}. @xref{Hooks,,, emacs, the Emacs Manual}.
diff --git a/man/fortran-xtra.texi b/man/fortran-xtra.texi
new file mode 100644
index 00000000000..2c694cccfbd
--- /dev/null
+++ b/man/fortran-xtra.texi
@@ -0,0 +1,519 @@
1@c This file is included either in emacs-xtra.texi (when producing the
2@c printed version) or in the main Emacs manual (for the on-line version).
3@node Fortran
4@section Fortran Mode
5@cindex Fortran mode
6@cindex mode, Fortran
7
8 Fortran mode provides special motion commands for Fortran statements
9and subprograms, and indentation commands that understand Fortran
10conventions of nesting, line numbers and continuation statements.
11Fortran mode has support for Auto Fill mode that breaks long lines into
12proper Fortran continuation lines.
13
14 Special commands for comments are provided because Fortran comments
15are unlike those of other languages. Built-in abbrevs optionally save
16typing when you insert Fortran keywords.
17
18 Use @kbd{M-x fortran-mode} to switch to this major mode. This
19command runs the hook @code{fortran-mode-hook}. @xref{Hooks,,, emacs,
20the Emacs Manual}.
21
22@cindex Fortran77 and Fortran90
23@findex f90-mode
24@findex fortran-mode
25 Fortran mode is meant for editing Fortran77 ``fixed format'' (and also
26``tab format'') source code. For editing the modern Fortran90 or
27Fortran95 ``free format'' source code, use F90 mode (@code{f90-mode}).
28Emacs normally uses Fortran mode for files with extension @samp{.f},
29@samp{.F} or @samp{.for}, and F90 mode for the extension @samp{.f90} and
30@samp{.f95}. GNU Fortran supports both kinds of format.
31
32@menu
33* Motion: Fortran Motion. Moving point by statements or subprograms.
34* Indent: Fortran Indent. Indentation commands for Fortran.
35* Comments: Fortran Comments. Inserting and aligning comments.
36* Autofill: Fortran Autofill. Auto fill support for Fortran.
37* Columns: Fortran Columns. Measuring columns for valid Fortran.
38* Abbrev: Fortran Abbrev. Built-in abbrevs for Fortran keywords.
39@end menu
40
41@node Fortran Motion
42@subsection Motion Commands
43
44 In addition to the normal commands for moving by and operating on
45``defuns'' (Fortran subprograms---functions and subroutines, as well as
46modules for F90 mode), Fortran mode provides special commands to move by
47statements and other program units.
48
49@table @kbd
50@kindex C-c C-n @r{(Fortran mode)}
51@findex fortran-next-statement
52@findex f90-next-statement
53@item C-c C-n
54Move to the beginning of the next statement
55(@code{fortran-next-statement}/@code{f90-next-statement}).
56
57@kindex C-c C-p @r{(Fortran mode)}
58@findex fortran-previous-statement
59@findex f90-previous-statement
60@item C-c C-p
61Move to the beginning of the previous statement
62(@code{fortran-previous-statement}/@code{f90-previous-statement}).
63If there is no previous statement (i.e. if called from the first
64statement in the buffer), move to the start of the buffer.
65
66@kindex C-c C-e @r{(F90 mode)}
67@findex f90-next-block
68@item C-c C-e
69Move point forward to the start of the next code block
70(@code{f90-next-block}). A code block is a subroutine,
71@code{if}--@code{endif} statement, and so forth. This command exists
72for F90 mode only, not Fortran mode. With a numeric argument, this
73moves forward that many blocks.
74
75@kindex C-c C-a @r{(F90 mode)}
76@findex f90-previous-block
77@item C-c C-a
78Move point backward to the previous code block
79(@code{f90-previous-block}). This is like @code{f90-next-block}, but
80moves backwards.
81
82@kindex C-M-n @r{(Fortran mode)}
83@findex fortran-end-of-block
84@findex f90-end-of-block
85@item C-M-n
86Move to the end of the current code block
87(@code{fortran-end-of-block}/@code{f90-end-of-block}). With a numeric
88agument, move forward that number of blocks. The mark is set before
89moving point. The F90 mode version of this command checks for
90consistency of block types and labels (if present), but it does not
91check the outermost block since that may be incomplete.
92
93@kindex C-M-p @r{(Fortran mode)}
94@findex fortran-beginning-of-block
95@findex f90-beginning-of-block
96@item C-M-p
97Move to the start of the current code block
98(@code{fortran-beginning-of-block}/@code{f90-beginning-of-block}). This
99is like @code{fortran-end-of-block}, but moves backwards.
100@end table
101
102@node Fortran Indent
103@subsection Fortran Indentation
104
105 Special commands and features are needed for indenting Fortran code in
106order to make sure various syntactic entities (line numbers, comment line
107indicators and continuation line flags) appear in the columns that are
108required for standard, fixed (or tab) format Fortran.
109
110@menu
111* Commands: ForIndent Commands. Commands for indenting and filling Fortran.
112* Contline: ForIndent Cont. How continuation lines indent.
113* Numbers: ForIndent Num. How line numbers auto-indent.
114* Conv: ForIndent Conv. Conventions you must obey to avoid trouble.
115* Vars: ForIndent Vars. Variables controlling Fortran indent style.
116@end menu
117
118@node ForIndent Commands
119@subsubsection Fortran Indentation and Filling Commands
120
121@table @kbd
122@item C-M-j
123Break the current line at point and set up a continuation line
124(@code{fortran-split-line}).
125@item M-^
126Join this line to the previous line (@code{fortran-join-line}).
127@item C-M-q
128Indent all the lines of the subprogram point is in
129(@code{fortran-indent-subprogram}).
130@item M-q
131Fill a comment block or statement.
132@end table
133
134@kindex C-M-q @r{(Fortran mode)}
135@findex fortran-indent-subprogram
136 The key @kbd{C-M-q} runs @code{fortran-indent-subprogram}, a command
137to reindent all the lines of the Fortran subprogram (function or
138subroutine) containing point.
139
140@kindex C-M-j @r{(Fortran mode)}
141@findex fortran-split-line
142 The key @kbd{C-M-j} runs @code{fortran-split-line}, which splits
143a line in the appropriate fashion for Fortran. In a non-comment line,
144the second half becomes a continuation line and is indented
145accordingly. In a comment line, both halves become separate comment
146lines.
147
148@kindex M-^ @r{(Fortran mode)}
149@kindex C-c C-d @r{(Fortran mode)}
150@findex fortran-join-line
151 @kbd{M-^} or @kbd{C-c C-d} runs the command @code{fortran-join-line},
152which joins a continuation line back to the previous line, roughly as
153the inverse of @code{fortran-split-line}. The point must be on a
154continuation line when this command is invoked.
155
156@kindex M-q @r{(Fortran mode)}
157@kbd{M-q} in Fortran mode fills the comment block or statement that
158point is in. This removes any excess statement continuations.
159
160@node ForIndent Cont
161@subsubsection Continuation Lines
162@cindex Fortran continuation lines
163
164@vindex fortran-continuation-string
165 Most Fortran77 compilers allow two ways of writing continuation lines.
166If the first non-space character on a line is in column 5, then that
167line is a continuation of the previous line. We call this @dfn{fixed
168format}. (In GNU Emacs we always count columns from 0; but note that
169the Fortran standard counts from 1.) The variable
170@code{fortran-continuation-string} specifies what character to put in
171column 5. A line that starts with a tab character followed by any digit
172except @samp{0} is also a continuation line. We call this style of
173continuation @dfn{tab format}. (Fortran90 introduced ``free format'',
174with another style of continuation lines).
175
176@vindex indent-tabs-mode @r{(Fortran mode)}
177@vindex fortran-analyze-depth
178@vindex fortran-tab-mode-default
179 Fortran mode can use either style of continuation line. When you
180enter Fortran mode, it tries to deduce the proper continuation style
181automatically from the buffer contents. It does this by scanning up to
182@code{fortran-analyze-depth} (default 100) lines from the start of the
183buffer. The first line that begins with either a tab character or six
184spaces determines the choice. If the scan fails (for example, if the
185buffer is new and therefore empty), the value of
186@code{fortran-tab-mode-default} (@code{nil} for fixed format, and
187non-@code{nil} for tab format) is used. @samp{/t} in the mode line
188indicates tab format is selected. Fortran mode sets the value of
189@code{indent-tabs-mode} accordingly.
190
191 If the text on a line starts with the Fortran continuation marker
192@samp{$}, or if it begins with any non-whitespace character in column
1935, Fortran mode treats it as a continuation line. When you indent a
194continuation line with @key{TAB}, it converts the line to the current
195continuation style. When you split a Fortran statement with
196@kbd{C-M-j}, the continuation marker on the newline is created according
197to the continuation style.
198
199 The setting of continuation style affects several other aspects of
200editing in Fortran mode. In fixed format mode, the minimum column
201number for the body of a statement is 6. Lines inside of Fortran
202blocks that are indented to larger column numbers always use only the
203space character for whitespace. In tab format mode, the minimum
204column number for the statement body is 8, and the whitespace before
205column 8 must always consist of one tab character.
206
207@node ForIndent Num
208@subsubsection Line Numbers
209
210 If a number is the first non-whitespace in the line, Fortran
211indentation assumes it is a line number and moves it to columns 0
212through 4. (Columns always count from 0 in GNU Emacs.)
213
214@vindex fortran-line-number-indent
215 Line numbers of four digits or less are normally indented one space.
216The variable @code{fortran-line-number-indent} controls this; it
217specifies the maximum indentation a line number can have. The default
218value of the variable is 1. Fortran mode tries to prevent line number
219digits passing column 4, reducing the indentation below the specified
220maximum if necessary. If @code{fortran-line-number-indent} has the
221value 5, line numbers are right-justified to end in column 4.
222
223@vindex fortran-electric-line-number
224 Simply inserting a line number is enough to indent it according to
225these rules. As each digit is inserted, the indentation is recomputed.
226To turn off this feature, set the variable
227@code{fortran-electric-line-number} to @code{nil}.
228
229
230@node ForIndent Conv
231@subsubsection Syntactic Conventions
232
233 Fortran mode assumes that you follow certain conventions that simplify
234the task of understanding a Fortran program well enough to indent it
235properly:
236
237@itemize @bullet
238@item
239Two nested @samp{do} loops never share a @samp{continue} statement.
240
241@item
242Fortran keywords such as @samp{if}, @samp{else}, @samp{then}, @samp{do}
243and others are written without embedded whitespace or line breaks.
244
245Fortran compilers generally ignore whitespace outside of string
246constants, but Fortran mode does not recognize these keywords if they
247are not contiguous. Constructs such as @samp{else if} or @samp{end do}
248are acceptable, but the second word should be on the same line as the
249first and not on a continuation line.
250@end itemize
251
252@noindent
253If you fail to follow these conventions, the indentation commands may
254indent some lines unaesthetically. However, a correct Fortran program
255retains its meaning when reindented even if the conventions are not
256followed.
257
258@node ForIndent Vars
259@subsubsection Variables for Fortran Indentation
260
261@vindex fortran-do-indent
262@vindex fortran-if-indent
263@vindex fortran-structure-indent
264@vindex fortran-continuation-indent
265@vindex fortran-check-all-num@dots{}
266@vindex fortran-minimum-statement-indent@dots{}
267 Several additional variables control how Fortran indentation works:
268
269@table @code
270@item fortran-do-indent
271Extra indentation within each level of @samp{do} statement (default 3).
272
273@item fortran-if-indent
274Extra indentation within each level of @samp{if}, @samp{select case}, or
275@samp{where} statements (default 3).
276
277@item fortran-structure-indent
278Extra indentation within each level of @samp{structure}, @samp{union},
279@samp{map}, or @samp{interface} statements (default 3).
280
281@item fortran-continuation-indent
282Extra indentation for bodies of continuation lines (default 5).
283
284@item fortran-check-all-num-for-matching-do
285In Fortran77, a numbered @samp{do} statement is ended by any statement
286with a matching line number. It is common (but not compulsory) to use a
287@samp{continue} statement for this purpose. If this variable has a
288non-@code{nil} value, indenting any numbered statement must check for a
289@samp{do} that ends there. If you always end @samp{do} statements with
290a @samp{continue} line (or if you use the more modern @samp{enddo}),
291then you can speed up indentation by setting this variable to
292@code{nil}. The default is @code{nil}.
293
294@item fortran-blink-matching-if
295If this is @code{t}, indenting an @samp{endif} (or @samp{enddo}
296statement moves the cursor momentarily to the matching @samp{if} (or
297@samp{do}) statement to show where it is. The default is @code{nil}.
298
299@item fortran-minimum-statement-indent-fixed
300Minimum indentation for Fortran statements when using fixed format
301continuation line style. Statement bodies are never indented less than
302this much. The default is 6.
303
304@item fortran-minimum-statement-indent-tab
305Minimum indentation for Fortran statements for tab format continuation line
306style. Statement bodies are never indented less than this much. The
307default is 8.
308@end table
309
310The variables controlling the indentation of comments are described in
311the following section.
312
313@node Fortran Comments
314@subsection Fortran Comments
315
316 The usual Emacs comment commands assume that a comment can follow a
317line of code. In Fortran77, the standard comment syntax requires an
318entire line to be just a comment. Therefore, Fortran mode replaces the
319standard Emacs comment commands and defines some new variables.
320
321@vindex fortran-comment-line-start
322 Fortran mode can also handle the Fortran90 comment syntax where comments
323start with @samp{!} and can follow other text. Because only some Fortran77
324compilers accept this syntax, Fortran mode will not insert such comments
325unless you have said in advance to do so. To do this, set the variable
326@code{fortran-comment-line-start} to @samp{"!"}.
327
328@table @kbd
329@item M-;
330Align comment or insert new comment (@code{fortran-indent-comment}).
331
332@item C-x ;
333Applies to nonstandard @samp{!} comments only.
334
335@item C-c ;
336Turn all lines of the region into comments, or (with argument) turn them back
337into real code (@code{fortran-comment-region}).
338@end table
339
340@findex fortran-indent-comment
341 @kbd{M-;} in Fortran mode is redefined as the command
342@code{fortran-indent-comment}. Like the usual @kbd{M-;} command, this
343recognizes any kind of existing comment and aligns its text appropriately;
344if there is no existing comment, a comment is inserted and aligned. But
345inserting and aligning comments are not the same in Fortran mode as in
346other modes.
347
348 When a new comment must be inserted, if the current line is blank, a
349full-line comment is inserted. On a non-blank line, a nonstandard @samp{!}
350comment is inserted if you have said you want to use them. Otherwise a
351full-line comment is inserted on a new line before the current line.
352
353 Nonstandard @samp{!} comments are aligned like comments in other
354languages, but full-line comments are different. In a standard full-line
355comment, the comment delimiter itself must always appear in column zero.
356What can be aligned is the text within the comment. You can choose from
357three styles of alignment by setting the variable
358@code{fortran-comment-indent-style} to one of these values:
359
360@vindex fortran-comment-indent-style
361@vindex fortran-comment-line-extra-indent
362@table @code
363@item fixed
364Align the text at a fixed column, which is the sum of
365@code{fortran-comment-line-extra-indent} and the minimum statement
366indentation. This is the default.
367
368The minimum statement indentation is
369@code{fortran-minimum-statement-indent-fixed} for fixed format
370continuation line style and @code{fortran-minimum-statement-indent-tab}
371for tab format style.
372
373@item relative
374Align the text as if it were a line of code, but with an additional
375@code{fortran-comment-line-extra-indent} columns of indentation.
376
377@item nil
378Don't move text in full-line comments automatically.
379@end table
380
381@vindex fortran-comment-indent-char
382 In addition, you can specify the character to be used to indent within
383full-line comments by setting the variable
384@code{fortran-comment-indent-char} to the single-character string you want
385to use.
386
387@vindex fortran-directive-re
388 Compiler directive lines, or preprocessor lines, have much the same
389appearance as comment lines. It is important, though, that such lines
390never be indented at all, no matter what the value of
391@code{fortran-comment-indent-style}. The variable
392@code{fortran-directive-re} is a regular expression that specifies which
393lines are directives. Matching lines are never indented, and receive
394distinctive font-locking.
395
396 The normal Emacs comment command @kbd{C-x ;} has not been redefined. If
397you use @samp{!} comments, this command can be used with them. Otherwise
398it is useless in Fortran mode.
399
400@kindex C-c ; @r{(Fortran mode)}
401@findex fortran-comment-region
402@vindex fortran-comment-region
403 The command @kbd{C-c ;} (@code{fortran-comment-region}) turns all the
404lines of the region into comments by inserting the string @samp{C$$$} at
405the front of each one. With a numeric argument, it turns the region
406back into live code by deleting @samp{C$$$} from the front of each line
407in it. The string used for these comments can be controlled by setting
408the variable @code{fortran-comment-region}. Note that here we have an
409example of a command and a variable with the same name; these two uses
410of the name never conflict because in Lisp and in Emacs it is always
411clear from the context which one is meant.
412
413@node Fortran Autofill
414@subsection Auto Fill in Fortran Mode
415
416 Fortran mode has specialized support for Auto Fill mode, which is a
417minor mode that automatically splits statements as you insert them
418when they become too wide. Splitting a statement involves making
419continuation lines using @code{fortran-continuation-string}
420(@pxref{ForIndent Cont}). This splitting happens when you type
421@key{SPC}, @key{RET}, or @key{TAB}, and also in the Fortran
422indentation commands. You activate Auto Fill in Fortran mode in the
423normal way. @xref{Auto Fill,,, emacs, the Emacs Manual}.
424
425@vindex fortran-break-before-delimiters
426 Auto Fill breaks lines at spaces or delimiters when the lines get
427longer than the desired width (the value of @code{fill-column}). The
428delimiters (besides whitespace) that Auto Fill can break at are
429@samp{+}, @samp{-}, @samp{/}, @samp{*}, @samp{=}, @samp{<}, @samp{>},
430and @samp{,}. The line break comes after the delimiter if the
431variable @code{fortran-break-before-delimiters} is @code{nil}.
432Otherwise (and by default), the break comes before the delimiter.
433
434 To enable Auto Fill in all Fortran buffers, add
435@code{turn-on-auto-fill} to @code{fortran-mode-hook}. @xref{Hooks,,,
436emacs, the Emacs Manual}.
437
438@node Fortran Columns
439@subsection Checking Columns in Fortran
440
441@table @kbd
442@item C-c C-r
443Display a ``column ruler'' momentarily above the current line
444(@code{fortran-column-ruler}).
445@item C-c C-w
446Split the current window horizontally temporarily so that it is 72
447columns wide (@code{fortran-window-create-momentarily}). This may
448help you avoid making lines longer than the 72-character limit that
449some Fortran compilers impose.
450@item C-u C-c C-w
451Split the current window horizontally so that it is 72 columns wide
452(@code{fortran-window-create}). You can then continue editing.
453@item M-x fortran-strip-sequence-nos
454Delete all text in column 72 and beyond.
455@end table
456
457@kindex C-c C-r @r{(Fortran mode)}
458@findex fortran-column-ruler
459 The command @kbd{C-c C-r} (@code{fortran-column-ruler}) shows a column
460ruler momentarily above the current line. The comment ruler is two lines
461of text that show you the locations of columns with special significance in
462Fortran programs. Square brackets show the limits of the columns for line
463numbers, and curly brackets show the limits of the columns for the
464statement body. Column numbers appear above them.
465
466 Note that the column numbers count from zero, as always in GNU Emacs.
467As a result, the numbers may be one less than those you are familiar
468with; but the positions they indicate in the line are standard for
469Fortran.
470
471@vindex fortran-column-ruler-fixed
472@vindex fortran-column-ruler-tabs
473 The text used to display the column ruler depends on the value of the
474variable @code{indent-tabs-mode}. If @code{indent-tabs-mode} is
475@code{nil}, then the value of the variable
476@code{fortran-column-ruler-fixed} is used as the column ruler.
477Otherwise, the value of the variable @code{fortran-column-ruler-tab} is
478displayed. By changing these variables, you can change the column ruler
479display.
480
481@kindex C-c C-w @r{(Fortran mode)}
482@findex fortran-window-create-momentarily
483 @kbd{C-c C-w} (@code{fortran-window-create-momentarily}) temporarily
484splits the current window horizontally, making a window 72 columns
485wide, so you can see any lines that are too long. Type a space to
486restore the normal width.
487
488@kindex C-u C-c C-w @r{(Fortran mode)}
489@findex fortran-window-create
490 You can also split the window horizontally and continue editing with
491the split in place. To do this, use @kbd{C-u C-c C-w} (@code{M-x
492fortran-window-create}). By editing in this window you can
493immediately see when you make a line too wide to be correct Fortran.
494
495@findex fortran-strip-sequence-nos
496 The command @kbd{M-x fortran-strip-sequence-nos} deletes all text in
497column 72 and beyond, on all lines in the current buffer. This is the
498easiest way to get rid of old sequence numbers.
499
500@node Fortran Abbrev
501@subsection Fortran Keyword Abbrevs
502
503 Fortran mode provides many built-in abbrevs for common keywords and
504declarations. These are the same sort of abbrev that you can define
505yourself. To use them, you must turn on Abbrev mode.
506@xref{Abbrevs,,, emacs, the Emacs Manual}.
507
508 The built-in abbrevs are unusual in one way: they all start with a
509semicolon. You cannot normally use semicolon in an abbrev, but Fortran
510mode makes this possible by changing the syntax of semicolon to ``word
511constituent.''
512
513 For example, one built-in Fortran abbrev is @samp{;c} for
514@samp{continue}. If you insert @samp{;c} and then insert a punctuation
515character such as a space or a newline, the @samp{;c} expands automatically
516to @samp{continue}, provided Abbrev mode is enabled.@refill
517
518 Type @samp{;?} or @samp{;C-h} to display a list of all the built-in
519Fortran abbrevs and what they stand for.
diff --git a/man/msdog-xtra.texi b/man/msdog-xtra.texi
new file mode 100644
index 00000000000..a21e53ac0af
--- /dev/null
+++ b/man/msdog-xtra.texi
@@ -0,0 +1,550 @@
1@c This file is included either in emacs-xtra.texi (when producing the
2@c printed version) or in the main Emacs manual (for the on-line version).
3@node MS-DOS
4@section Emacs and MS-DOS
5@cindex MS-DOG
6@cindex MS-DOS peculiarities
7
8 This section briefly describes the peculiarities of using Emacs on
9the MS-DOS ``operating system'' (also known as ``MS-DOG'').
10Information about Emacs and Microsoft's current operating system
11Windows (also known as ``Losedows) is in the main Emacs manual
12(@pxref{Microsoft Systems,,, emacs, the Emacs Manual}).
13
14 If you build Emacs for MS-DOS, the binary will also run on Windows
153.X, Windows NT, Windows 9X/ME, Windows 2000, or OS/2 as a DOS
16application; all of this chapter applies for all of those systems, if
17you use an Emacs that was built for MS-DOS.
18
19 @xref{Text and Binary,,,emacs, the Emacs Manual}, for information
20about Emacs' special handling of text files under MS-DOS (and
21Windows).
22
23@menu
24* Keyboard: MS-DOS Keyboard. Keyboard conventions on MS-DOS.
25* Mouse: MS-DOS Mouse. Mouse conventions on MS-DOS.
26* Display: MS-DOS Display. Fonts, frames and display size on MS-DOS.
27* Files: MS-DOS File Names. File name conventions on MS-DOS.
28* Printing: MS-DOS Printing. Printing specifics on MS-DOS.
29* I18N: MS-DOS and MULE. Support for internationalization on MS-DOS.
30* Processes: MS-DOS Processes. Running subprocesses on MS-DOS.
31@end menu
32
33@node MS-DOS Keyboard
34@subsection Keyboard Usage on MS-DOS
35
36@kindex DEL @r{(MS-DOS)}
37@kindex BS @r{(MS-DOS)}
38 The key that is called @key{DEL} in Emacs (because that's how it is
39designated on most workstations) is known as @key{BS} (backspace) on a
40PC. That is why the PC-specific terminal initialization remaps the
41@key{BS} key to act as @key{DEL}; the @key{DELETE} key is remapped to act
42as @kbd{C-d} for the same reasons.
43
44@kindex C-g @r{(MS-DOS)}
45@kindex C-BREAK @r{(MS-DOS)}
46@cindex quitting on MS-DOS
47 Emacs built for MS-DOS recognizes @kbd{C-@key{BREAK}} as a quit
48character, just like @kbd{C-g}. This is because Emacs cannot detect
49that you have typed @kbd{C-g} until it is ready for more input. As a
50consequence, you cannot use @kbd{C-g} to stop a running command
51(@pxref{Quitting,,,emacs, the Emacs Manual}). By contrast,
52@kbd{C-@key{BREAK}} @emph{is} detected as soon as you type it (as
53@kbd{C-g} is on other systems), so it can be used to stop a running
54command and for emergency escape (@pxref{Emergency Escape,,,emacs, the
55Emacs Manual}).
56
57@cindex Meta (under MS-DOS)
58@cindex Hyper (under MS-DOS)
59@cindex Super (under MS-DOS)
60@vindex dos-super-key
61@vindex dos-hyper-key
62 The PC keyboard maps use the left @key{ALT} key as the @key{META} key.
63You have two choices for emulating the @key{SUPER} and @key{HYPER} keys:
64choose either the right @key{CTRL} key or the right @key{ALT} key by
65setting the variables @code{dos-hyper-key} and @code{dos-super-key} to 1
66or 2 respectively. If neither @code{dos-super-key} nor
67@code{dos-hyper-key} is 1, then by default the right @key{ALT} key is
68also mapped to the @key{META} key. However, if the MS-DOS international
69keyboard support program @file{KEYB.COM} is installed, Emacs will
70@emph{not} map the right @key{ALT} to @key{META}, since it is used for
71accessing characters like @kbd{~} and @kbd{@@} on non-US keyboard
72layouts; in this case, you may only use the left @key{ALT} as @key{META}
73key.
74
75@kindex C-j @r{(MS-DOS)}
76@vindex dos-keypad-mode
77 The variable @code{dos-keypad-mode} is a flag variable that controls
78what key codes are returned by keys in the numeric keypad. You can also
79define the keypad @key{ENTER} key to act like @kbd{C-j}, by putting the
80following line into your @file{_emacs} file:
81
82@smallexample
83;; @r{Make the @key{ENTER} key from the numeric keypad act as @kbd{C-j}.}
84(define-key function-key-map [kp-enter] [?\C-j])
85@end smallexample
86
87@node MS-DOS Mouse
88@subsection Mouse Usage on MS-DOS
89
90@cindex mouse support under MS-DOS
91 Emacs on MS-DOS supports a mouse (on the default terminal only).
92The mouse commands work as documented, including those that use menus
93and the menu bar (@pxref{Menu Bar,,,emacs, the Emacs Manual}). Scroll
94bars don't work in MS-DOS Emacs. PC mice usually have only two
95buttons; these act as @kbd{Mouse-1} and @kbd{Mouse-2}, but if you
96press both of them together, that has the effect of @kbd{Mouse-3}. If
97the mouse does have 3 buttons, Emacs detects that at startup, and all
98the 3 buttons function normally, as on X.
99
100 Help strings for menu-bar and pop-up menus are displayed in the echo
101area when the mouse pointer moves across the menu items. Highlighting
102of mouse-sensitive text (@pxref{Mouse References,,,emacs, the Emacs
103Manual}) is also supported.
104
105@cindex mouse, set number of buttons
106@findex msdos-set-mouse-buttons
107 Some versions of mouse drivers don't report the number of mouse
108buttons correctly. For example, mice with a wheel report that they
109have 3 buttons, but only 2 of them are passed to Emacs; the clicks on
110the wheel, which serves as the middle button, are not passed. In
111these cases, you can use the @kbd{M-x msdos-set-mouse-buttons} command
112to tell Emacs how many mouse buttons to expect. You could make such a
113setting permanent by adding this fragment to your @file{_emacs} init
114file:
115
116@example
117;; @r{Treat the mouse like a 2-button mouse.}
118(msdos-set-mouse-buttons 2)
119@end example
120
121@cindex Windows clipboard support
122 Emacs built for MS-DOS supports clipboard operations when it runs on
123Windows. Commands that put text on the kill ring, or yank text from
124the ring, check the Windows clipboard first, just as Emacs does on the
125X Window System (@pxref{Mouse Commands,,,emacs, the Emacs Manual}).
126Only the primary selection and the cut buffer are supported by MS-DOS
127Emacs on Windows; the secondary selection always appears as empty.
128
129 Due to the way clipboard access is implemented by Windows, the
130length of text you can put into the clipboard is limited by the amount
131of free DOS memory that is available to Emacs. Usually, up to 620KB of
132text can be put into the clipboard, but this limit depends on the system
133configuration and is lower if you run Emacs as a subprocess of
134another program. If the killed text does not fit, Emacs outputs a
135message saying so, and does not put the text into the clipboard.
136
137 Null characters also cannot be put into the Windows clipboard. If the
138killed text includes null characters, Emacs does not put such text into
139the clipboard, and displays in the echo area a message to that effect.
140
141@vindex dos-display-scancodes
142 The variable @code{dos-display-scancodes}, when non-@code{nil},
143directs Emacs to display the @acronym{ASCII} value and the keyboard scan code of
144each keystroke; this feature serves as a complement to the
145@code{view-lossage} command, for debugging.
146
147@node MS-DOS Display
148@subsection Display on MS-DOS
149@cindex faces under MS-DOS
150@cindex fonts, emulating under MS-DOS
151
152 Display on MS-DOS cannot use font variants, like bold or italic, but
153it does support multiple faces, each of which can specify a foreground
154and a background color. Therefore, you can get the full functionality
155of Emacs packages that use fonts (such as @code{font-lock}, Enriched
156Text mode, and others) by defining the relevant faces to use different
157colors. Use the @code{list-colors-display} command (@pxref{Frame
158Parameters,,,emacs, the Emacs Manual}) and the
159@code{list-faces-display} command (@pxref{Faces,,,emacs, the Emacs
160Manual}) to see what colors and faces are available and what they look
161like.
162
163 @xref{MS-DOS and MULE}, later in this chapter, for information on
164how Emacs displays glyphs and characters that aren't supported by the
165native font built into the DOS display.
166
167@cindex cursor shape on MS-DOS
168 When Emacs starts, it changes the cursor shape to a solid box. This
169is for compatibility with other systems, where the box cursor is the
170default in Emacs. This default shape can be changed to a bar by
171specifying the @code{cursor-type} parameter in the variable
172@code{default-frame-alist} (@pxref{Creating Frames,,,emacs, the Emacs
173Manual}). The MS-DOS terminal doesn't support a vertical-bar cursor,
174so the bar cursor is horizontal, and the @code{@var{width}} parameter,
175if specified by the frame parameters, actually determines its height.
176For this reason, the @code{bar} and @code{hbar} cursor types produce
177the same effect on MS-DOS. As an extension, the bar cursor
178specification can include the starting scan line of the cursor as well
179as its width, like this:
180
181@example
182 '(cursor-type bar @var{width} . @var{start})
183@end example
184
185@noindent
186In addition, if the @var{width} parameter is negative, the cursor bar
187begins at the top of the character cell.
188
189@cindex frames on MS-DOS
190 The MS-DOS terminal can only display a single frame at a time. The
191Emacs frame facilities work on MS-DOS much as they do on text-only
192terminals (@pxref{Frames,,,emacs, the Emacs Manual}). When you run
193Emacs from a DOS window on MS-Windows, you can make the visible frame
194smaller than the full screen, but Emacs still cannot display more than
195a single frame at a time.
196
197@cindex frame size under MS-DOS
198@findex mode4350
199@findex mode25
200 The @code{mode4350} command switches the display to 43 or 50
201lines, depending on your hardware; the @code{mode25} command switches
202to the default 80x25 screen size.
203
204 By default, Emacs only knows how to set screen sizes of 80 columns by
20525, 28, 35, 40, 43 or 50 rows. However, if your video adapter has
206special video modes that will switch the display to other sizes, you can
207have Emacs support those too. When you ask Emacs to switch the frame to
208@var{n} rows by @var{m} columns dimensions, it checks if there is a
209variable called @code{screen-dimensions-@var{n}x@var{m}}, and if so,
210uses its value (which must be an integer) as the video mode to switch
211to. (Emacs switches to that video mode by calling the BIOS @code{Set
212Video Mode} function with the value of
213@code{screen-dimensions-@var{n}x@var{m}} in the @code{AL} register.)
214For example, suppose your adapter will switch to 66x80 dimensions when
215put into video mode 85. Then you can make Emacs support this screen
216size by putting the following into your @file{_emacs} file:
217
218@example
219(setq screen-dimensions-66x80 85)
220@end example
221
222 Since Emacs on MS-DOS can only set the frame size to specific
223supported dimensions, it cannot honor every possible frame resizing
224request. When an unsupported size is requested, Emacs chooses the next
225larger supported size beyond the specified size. For example, if you
226ask for 36x80 frame, you will get 40x80 instead.
227
228 The variables @code{screen-dimensions-@var{n}x@var{m}} are used only
229when they exactly match the specified size; the search for the next
230larger supported size ignores them. In the above example, even if your
231VGA supports 38x80 dimensions and you define a variable
232@code{screen-dimensions-38x80} with a suitable value, you will still get
23340x80 screen when you ask for a 36x80 frame. If you want to get the
23438x80 size in this case, you can do it by setting the variable named
235@code{screen-dimensions-36x80} with the same video mode value as
236@code{screen-dimensions-38x80}.
237
238 Changing frame dimensions on MS-DOS has the effect of changing all the
239other frames to the new dimensions.
240
241@node MS-DOS File Names
242@subsection File Names on MS-DOS
243@cindex file names under MS-DOS
244@cindex init file, default name under MS-DOS
245
246 On MS-DOS, file names are case-insensitive and limited to eight
247characters, plus optionally a period and three more characters. Emacs
248knows enough about these limitations to handle file names that were
249meant for other operating systems. For instance, leading dots
250@samp{.} in file names are invalid in MS-DOS, so Emacs transparently
251converts them to underscores @samp{_}; thus your default init file
252(@pxref{Init File,,,emacs, the Emacs Manual}) is called @file{_emacs}
253on MS-DOS. Excess characters before or after the period are generally
254ignored by MS-DOS itself; thus, if you visit the file
255@file{LongFileName.EvenLongerExtension}, you will silently get
256@file{longfile.eve}, but Emacs will still display the long file name
257on the mode line. Other than that, it's up to you to specify file
258names which are valid under MS-DOS; the transparent conversion as
259described above only works on file names built into Emacs.
260
261@cindex backup file names on MS-DOS
262 The above restrictions on the file names on MS-DOS make it almost
263impossible to construct the name of a backup file (@pxref{Backup
264Names,,,emacs, the Emacs Manual}) without losing some of the original
265file name characters. For example, the name of a backup file for
266@file{docs.txt} is @file{docs.tx~} even if single backup is used.
267
268@cindex file names under Windows 95/NT
269@cindex long file names in DOS box under Windows 95/NT
270 If you run Emacs as a DOS application under Windows 9X, Windows ME, or
271Windows 2000, you can turn on support for long file names. If you do
272that, Emacs doesn't truncate file names or convert them to lower case;
273instead, it uses the file names that you specify, verbatim. To enable
274long file name support, set the environment variable @env{LFN} to
275@samp{y} before starting Emacs. Unfortunately, Windows NT doesn't allow
276DOS programs to access long file names, so Emacs built for MS-DOS will
277only see their short 8+3 aliases.
278
279@cindex @env{HOME} directory under MS-DOS
280 MS-DOS has no notion of home directory, so Emacs on MS-DOS pretends
281that the directory where it is installed is the value of the @env{HOME}
282environment variable. That is, if your Emacs binary,
283@file{emacs.exe}, is in the directory @file{c:/utils/emacs/bin}, then
284Emacs acts as if @env{HOME} were set to @samp{c:/utils/emacs}. In
285particular, that is where Emacs looks for the init file @file{_emacs}.
286With this in mind, you can use @samp{~} in file names as an alias for
287the home directory, as you would on GNU or Unix. You can also set
288@env{HOME} variable in the environment before starting Emacs; its
289value will then override the above default behavior.
290
291 Emacs on MS-DOS handles the directory name @file{/dev} specially,
292because of a feature in the emulator libraries of DJGPP that pretends
293I/O devices have names in that directory. We recommend that you avoid
294using an actual directory named @file{/dev} on any disk.
295
296@node MS-DOS Printing
297@subsection Printing and MS-DOS
298
299 Printing commands, such as @code{lpr-buffer}
300(@pxref{Printing,,,emacs, the Emacs Manual}) and
301@code{ps-print-buffer} (@pxref{PostScript,,,emacs, the Emacs Manual})
302can work on MS-DOS by sending the output to one of the printer ports,
303if a Posix-style @code{lpr} program is unavailable. The same Emacs
304variables control printing on all systems, but in some cases they have
305different default values on MS-DOS.
306
307@xref{MS-Windows Printing,,,emacs, the Emacs Manual}, for details.
308
309 Some printers expect DOS codepage encoding of non-@acronym{ASCII} text, even
310though they are connected to a Windows machine which uses a different
311encoding for the same locale. For example, in the Latin-1 locale, DOS
312uses codepage 850 whereas Windows uses codepage 1252. @xref{MS-DOS and
313MULE}. When you print to such printers from Windows, you can use the
314@kbd{C-x RET c} (@code{universal-coding-system-argument}) command before
315@kbd{M-x lpr-buffer}; Emacs will then convert the text to the DOS
316codepage that you specify. For example, @kbd{C-x RET c cp850-dos RET
317M-x lpr-region RET} will print the region while converting it to the
318codepage 850 encoding. You may need to create the @code{cp@var{nnn}}
319coding system with @kbd{M-x codepage-setup}.
320
321@vindex dos-printer
322@vindex dos-ps-printer
323 For backwards compatibility, the value of @code{dos-printer}
324(@code{dos-ps-printer}), if it has a value, overrides the value of
325@code{printer-name} (@code{ps-printer-name}), on MS-DOS.
326
327
328@node MS-DOS and MULE
329@subsection International Support on MS-DOS
330@cindex international support @r{(MS-DOS)}
331
332 Emacs on MS-DOS supports the same international character sets as it
333does on GNU, Unix and other platforms (@pxref{International,,,emacs,
334the Emacs Manual}), including coding systems for converting between
335the different character sets. However, due to incompatibilities
336between MS-DOS/MS-Windows and other systems, there are several
337DOS-specific aspects of this support that you should be aware of.
338This section describes these aspects.
339
340 The description below is largely specific to the MS-DOS port of
341Emacs, especially where it talks about practical implications for
342Emacs users. For other operating systems, see the @file{code-pages.el}
343package, which implements support for MS-DOS- and MS-Windows-specific
344encodings for all platforms other than MS-DOS.
345
346@table @kbd
347@item M-x dos-codepage-setup
348Set up Emacs display and coding systems as appropriate for the current
349DOS codepage.
350
351@item M-x codepage-setup
352Create a coding system for a certain DOS codepage.
353@end table
354
355@cindex codepage, MS-DOS
356@cindex DOS codepages
357 MS-DOS is designed to support one character set of 256 characters at
358any given time, but gives you a variety of character sets to choose
359from. The alternative character sets are known as @dfn{DOS codepages}.
360Each codepage includes all 128 @acronym{ASCII} characters, but the other 128
361characters (codes 128 through 255) vary from one codepage to another.
362Each DOS codepage is identified by a 3-digit number, such as 850, 862,
363etc.
364
365 In contrast to X, which lets you use several fonts at the same time,
366MS-DOS normally doesn't allow use of several codepages in a single
367session. MS-DOS was designed to load a single codepage at system
368startup, and require you to reboot in order to change
369it@footnote{Normally, one particular codepage is burnt into the
370display memory, while other codepages can be installed by modifying
371system configuration files, such as @file{CONFIG.SYS}, and rebooting.
372While there is third-party software that allows changing the codepage
373without rebooting, we describe here how a stock MS-DOS system
374behaves.}. Much the same limitation applies when you run DOS
375executables on other systems such as MS-Windows.
376
377@cindex unibyte operation @r{(MS-DOS)}
378 If you invoke Emacs on MS-DOS with the @samp{--unibyte} option
379(@pxref{Initial Options,,,emacs, the Emacs Manual}), Emacs does not
380perform any conversion of non-@acronym{ASCII} characters. Instead, it
381reads and writes any non-@acronym{ASCII} characters verbatim, and
382sends their 8-bit codes to the display verbatim. Thus, unibyte Emacs
383on MS-DOS supports the current codepage, whatever it may be, but
384cannot even represent any other characters.
385
386@vindex dos-codepage
387 For multibyte operation on MS-DOS, Emacs needs to know which
388characters the chosen DOS codepage can display. So it queries the
389system shortly after startup to get the chosen codepage number, and
390stores the number in the variable @code{dos-codepage}. Some systems
391return the default value 437 for the current codepage, even though the
392actual codepage is different. (This typically happens when you use the
393codepage built into the display hardware.) You can specify a different
394codepage for Emacs to use by setting the variable @code{dos-codepage} in
395your init file.
396
397@cindex language environment, automatic selection on @r{MS-DOS}
398 Multibyte Emacs supports only certain DOS codepages: those which can
399display Far-Eastern scripts, like the Japanese codepage 932, and those
400that encode a single ISO 8859 character set.
401
402 The Far-Eastern codepages can directly display one of the MULE
403character sets for these countries, so Emacs simply sets up to use the
404appropriate terminal coding system that is supported by the codepage.
405The special features described in the rest of this section mostly
406pertain to codepages that encode ISO 8859 character sets.
407
408 For the codepages which correspond to one of the ISO character sets,
409Emacs knows the character set name based on the codepage number. Emacs
410automatically creates a coding system to support reading and writing
411files that use the current codepage, and uses this coding system by
412default. The name of this coding system is @code{cp@var{nnn}}, where
413@var{nnn} is the codepage number.@footnote{The standard Emacs coding
414systems for ISO 8859 are not quite right for the purpose, because
415typically the DOS codepage does not match the standard ISO character
416codes. For example, the letter @samp{@,{c}} (@samp{c} with cedilla) has
417code 231 in the standard Latin-1 character set, but the corresponding
418DOS codepage 850 uses code 135 for this glyph.}
419
420@cindex mode line @r{(MS-DOS)}
421 All the @code{cp@var{nnn}} coding systems use the letter @samp{D}
422(for ``DOS'') as their mode-line mnemonic. Since both the terminal
423coding system and the default coding system for file I/O are set to
424the proper @code{cp@var{nnn}} coding system at startup, it is normal
425for the mode line on MS-DOS to begin with @samp{-DD\-}. @xref{Mode
426Line,,,emacs, the Emacs Manual}. Far-Eastern DOS terminals do not use
427the @code{cp@var{nnn}} coding systems, and thus their initial mode
428line looks like the Emacs default.
429
430 Since the codepage number also indicates which script you are using,
431Emacs automatically runs @code{set-language-environment} to select the
432language environment for that script (@pxref{Language
433Environments,,,emacs, the Emacs Manual}).
434
435 If a buffer contains a character belonging to some other ISO 8859
436character set, not the one that the chosen DOS codepage supports, Emacs
437displays it using a sequence of @acronym{ASCII} characters. For example, if the
438current codepage doesn't have a glyph for the letter @samp{@`o} (small
439@samp{o} with a grave accent), it is displayed as @samp{@{`o@}}, where
440the braces serve as a visual indication that this is a single character.
441(This may look awkward for some non-Latin characters, such as those from
442Greek or Hebrew alphabets, but it is still readable by a person who
443knows the language.) Even though the character may occupy several
444columns on the screen, it is really still just a single character, and
445all Emacs commands treat it as one.
446
447@cindex IBM graphics characters (MS-DOS)
448@cindex box-drawing characters (MS-DOS)
449@cindex line-drawing characters (MS-DOS)
450 Not all characters in DOS codepages correspond to ISO 8859
451characters---some are used for other purposes, such as box-drawing
452characters and other graphics. Emacs maps these characters to two
453special character sets called @code{eight-bit-control} and
454@code{eight-bit-graphic}, and displays them as their IBM glyphs.
455However, you should be aware that other systems might display these
456characters differently, so you should avoid them in text that might be
457copied to a different operating system, or even to another DOS machine
458that uses a different codepage.
459
460@vindex dos-unsupported-character-glyph
461 Emacs supports many other characters sets aside from ISO 8859, but it
462cannot display them on MS-DOS. So if one of these multibyte characters
463appears in a buffer, Emacs on MS-DOS displays them as specified by the
464@code{dos-unsupported-character-glyph} variable; by default, this glyph
465is an empty triangle. Use the @kbd{C-u C-x =} command to display the
466actual code and character set of such characters. @xref{Position
467Info,,,emacs, the Emacs Manual}.
468
469@findex codepage-setup
470 By default, Emacs defines a coding system to support the current
471codepage. To define a coding system for some other codepage (e.g., to
472visit a file written on a DOS machine in another country), use the
473@kbd{M-x codepage-setup} command. It prompts for the 3-digit code of
474the codepage, with completion, then creates the coding system for the
475specified codepage. You can then use the new coding system to read and
476write files, but you must specify it explicitly for the file command
477when you want to use it (@pxref{Text Coding,,,emacs, the Emacs Manual}).
478
479 These coding systems are also useful for visiting a file encoded using
480a DOS codepage, using Emacs running on some other operating system.
481
482@cindex MS-Windows codepages
483 MS-Windows provides its own codepages, which are different from the
484DOS codepages for the same locale. For example, DOS codepage 850
485supports the same character set as Windows codepage 1252; DOS codepage
486855 supports the same character set as Windows codepage 1251, etc.
487The MS-Windows version of Emacs uses the current codepage for display
488when invoked with the @samp{-nw} option. Support for codepages in the
489Windows port of Emacs is part of the @file{code-pages.el} package.
490
491@node MS-DOS Processes
492@subsection Subprocesses on MS-DOS
493
494@cindex compilation under MS-DOS
495@cindex inferior processes under MS-DOS
496@findex compile @r{(MS-DOS)}
497@findex grep @r{(MS-DOS)}
498 Because MS-DOS is a single-process ``operating system,''
499asynchronous subprocesses are not available. In particular, Shell
500mode and its variants do not work. Most Emacs features that use
501asynchronous subprocesses also don't work on MS-DOS, including
502Shell mode and GUD. When in doubt, try and see; commands that
503don't work output an error message saying that asynchronous processes
504aren't supported.
505
506 Compilation under Emacs with @kbd{M-x compile}, searching files with
507@kbd{M-x grep} and displaying differences between files with @kbd{M-x
508diff} do work, by running the inferior processes synchronously. This
509means you cannot do any more editing until the inferior process
510finishes.
511
512 Spell checking also works, by means of special support for synchronous
513invocation of the @code{ispell} program. This is slower than the
514asynchronous invocation on other platforms
515
516 Instead of the Shell mode, which doesn't work on MS-DOS, you can use
517the @kbd{M-x eshell} command. This invokes the Eshell package that
518implements a Posix-like shell entirely in Emacs Lisp.
519
520 By contrast, Emacs compiled as a native Windows application
521@strong{does} support asynchronous subprocesses. @xref{Windows
522Processes,,,emacs, the Emacs Manual}.
523
524@cindex printing under MS-DOS
525 Printing commands, such as @code{lpr-buffer}
526(@pxref{Printing,,,emacs, the Emacs Manual}) and
527@code{ps-print-buffer} (@pxref{PostScript,,,emacs, the Emacs Manual}),
528work in MS-DOS by sending the output to one of the printer ports.
529@xref{MS-DOS Printing,,,emacs, the Emacs Manual}.
530
531 When you run a subprocess synchronously on MS-DOS, make sure the
532program terminates and does not try to read keyboard input. If the
533program does not terminate on its own, you will be unable to terminate
534it, because MS-DOS provides no general way to terminate a process.
535Pressing @kbd{C-c} or @kbd{C-@key{BREAK}} might sometimes help in these
536cases.
537
538 Accessing files on other machines is not supported on MS-DOS. Other
539network-oriented commands such as sending mail, Web browsing, remote
540login, etc., don't work either, unless network access is built into
541MS-DOS with some network redirector.
542
543@cindex directory listing on MS-DOS
544@vindex dired-listing-switches @r{(MS-DOS)}
545 Dired on MS-DOS uses the @code{ls-lisp} package where other
546platforms use the system @code{ls} command. Therefore, Dired on
547MS-DOS supports only some of the possible options you can mention in
548the @code{dired-listing-switches} variable. The options that work are
549@samp{-A}, @samp{-a}, @samp{-c}, @samp{-i}, @samp{-r}, @samp{-S},
550@samp{-s}, @samp{-t}, and @samp{-u}.
diff --git a/man/picture-xtra.texi b/man/picture-xtra.texi
new file mode 100644
index 00000000000..0977a62035b
--- /dev/null
+++ b/man/picture-xtra.texi
@@ -0,0 +1,273 @@
1@c This file is included either in emacs-xtra.texi (when producing the
2@c printed version) or in the main Emacs manual (for the on-line version).
3@node Picture Mode
4@chapter Editing Pictures
5@cindex pictures
6@cindex making pictures out of text characters
7@findex edit-picture
8
9 To edit a picture made out of text characters (for example, a picture
10of the division of a register into fields, as a comment in a program),
11use the command @kbd{M-x edit-picture} to enter Picture mode.
12
13 In Picture mode, editing is based on the @dfn{quarter-plane} model of
14text, according to which the text characters lie studded on an area that
15stretches infinitely far to the right and downward. The concept of the end
16of a line does not exist in this model; the most you can say is where the
17last nonblank character on the line is found.
18
19 Of course, Emacs really always considers text as a sequence of
20characters, and lines really do have ends. But Picture mode replaces
21the most frequently-used commands with variants that simulate the
22quarter-plane model of text. They do this by inserting spaces or by
23converting tabs to spaces.
24
25 Most of the basic editing commands of Emacs are redefined by Picture mode
26to do essentially the same thing but in a quarter-plane way. In addition,
27Picture mode defines various keys starting with the @kbd{C-c} prefix to
28run special picture editing commands.
29
30 One of these keys, @kbd{C-c C-c}, is particularly important. Often a
31picture is part of a larger file that is usually edited in some other
32major mode. @kbd{M-x edit-picture} records the name of the previous
33major mode so you can use the @kbd{C-c C-c} command
34(@code{picture-mode-exit}) later to go back to that mode. @kbd{C-c C-c}
35also deletes spaces from the ends of lines, unless given a numeric
36argument.
37
38 The special commands of Picture mode all work in other modes (provided
39the @file{picture} library is loaded), but are not bound to keys except
40in Picture mode. The descriptions below talk of moving ``one column''
41and so on, but all the picture mode commands handle numeric arguments as
42their normal equivalents do.
43
44@vindex picture-mode-hook
45 Turning on Picture mode runs the hook @code{picture-mode-hook}.
46Additional extensions to Picture mode can be found in
47@file{artist.el}.
48
49@menu
50* Basic Picture:: Basic concepts and simple commands of Picture Mode.
51* Insert in Picture:: Controlling direction of cursor motion
52 after "self-inserting" characters.
53* Tabs in Picture:: Various features for tab stops and indentation.
54* Rectangles in Picture:: Clearing and superimposing rectangles.
55@end menu
56
57@node Basic Picture
58@section Basic Editing in Picture Mode
59
60@findex picture-forward-column
61@findex picture-backward-column
62@findex picture-move-down
63@findex picture-move-up
64@cindex editing in Picture mode
65
66 Most keys do the same thing in Picture mode that they usually do, but
67do it in a quarter-plane style. For example, @kbd{C-f} is rebound to
68run @code{picture-forward-column}, a command which moves point one
69column to the right, inserting a space if necessary so that the actual
70end of the line makes no difference. @kbd{C-b} is rebound to run
71@code{picture-backward-column}, which always moves point left one
72column, converting a tab to multiple spaces if necessary. @kbd{C-n} and
73@kbd{C-p} are rebound to run @code{picture-move-down} and
74@code{picture-move-up}, which can either insert spaces or convert tabs
75as necessary to make sure that point stays in exactly the same column.
76@kbd{C-e} runs @code{picture-end-of-line}, which moves to after the last
77nonblank character on the line. There is no need to change @kbd{C-a},
78as the choice of screen model does not affect beginnings of
79lines.
80
81@findex picture-newline
82 Insertion of text is adapted to the quarter-plane screen model
83through the use of Overwrite mode (@pxref{Minor Modes,,, emacs, the
84Emacs Manual}.) Self-inserting characters replace existing text,
85column by column, rather than pushing existing text to the right.
86@key{RET} runs @code{picture-newline}, which just moves to the
87beginning of the following line so that new text will replace that
88line.
89
90@findex picture-backward-clear-column
91@findex picture-clear-column
92@findex picture-clear-line
93 In Picture mode, the commands that normally delete or kill text,
94instead erase text (replacing it with spaces). @key{DEL}
95(@code{picture-backward-clear-column}) replaces the preceding
96character with a space rather than removing it; this moves point
97backwards. @kbd{C-d} (@code{picture-clear-column}) replaces the next
98character or characters with spaces, but does not move point. (If you
99want to clear characters to spaces and move forward over them, use
100@key{SPC}.) @kbd{C-k} (@code{picture-clear-line}) really kills the
101contents of lines, but does not delete the newlines from the buffer.
102
103@findex picture-open-line
104 To do actual insertion, you must use special commands. @kbd{C-o}
105(@code{picture-open-line}) creates a blank line after the current
106line; it never splits a line. @kbd{C-M-o} (@code{split-line}) makes
107sense in Picture mode, so it is not changed. @kbd{C-j}
108(@code{picture-duplicate-line}) inserts another line with the same
109contents below the current line.
110
111@kindex C-c C-d @r{(Picture mode)}
112 To do actual deletion in Picture mode, use @kbd{C-w}, @kbd{C-c C-d}
113(which is defined as @code{delete-char}, as @kbd{C-d} is in other
114modes), or one of the picture rectangle commands (@pxref{Rectangles in
115Picture}).
116
117@node Insert in Picture
118@section Controlling Motion after Insert
119
120@findex picture-movement-up
121@findex picture-movement-down
122@findex picture-movement-left
123@findex picture-movement-right
124@findex picture-movement-nw
125@findex picture-movement-ne
126@findex picture-movement-sw
127@findex picture-movement-se
128@kindex C-c < @r{(Picture mode)}
129@kindex C-c > @r{(Picture mode)}
130@kindex C-c ^ @r{(Picture mode)}
131@kindex C-c . @r{(Picture mode)}
132@kindex C-c ` @r{(Picture mode)}
133@kindex C-c ' @r{(Picture mode)}
134@kindex C-c / @r{(Picture mode)}
135@kindex C-c \ @r{(Picture mode)}
136 Since ``self-inserting'' characters in Picture mode overwrite and move
137point, there is no essential restriction on how point should be moved.
138Normally point moves right, but you can specify any of the eight
139orthogonal or diagonal directions for motion after a ``self-inserting''
140character. This is useful for drawing lines in the buffer.
141
142@table @kbd
143@item C-c <
144@itemx C-c @key{LEFT}
145Move left after insertion (@code{picture-movement-left}).
146@item C-c >
147@itemx C-c @key{RIGHT}
148Move right after insertion (@code{picture-movement-right}).
149@item C-c ^
150@itemx C-c @key{UP}
151Move up after insertion (@code{picture-movement-up}).
152@item C-c .
153@itemx C-c @key{DOWN}
154Move down after insertion (@code{picture-movement-down}).
155@item C-c `
156@itemx C-c @key{HOME}
157Move up and left (``northwest'') after insertion (@code{picture-movement-nw}).
158@item C-c '
159@itemx C-c @key{PAGEUP}
160Move up and right (``northeast'') after insertion
161(@code{picture-movement-ne}).
162@item C-c /
163@itemx C-c @key{END}
164Move down and left (``southwest'') after insertion
165@*(@code{picture-movement-sw}).
166@item C-c \
167@itemx C-c @key{PAGEDOWN}
168Move down and right (``southeast'') after insertion
169@*(@code{picture-movement-se}).
170@end table
171
172@kindex C-c C-f @r{(Picture mode)}
173@kindex C-c C-b @r{(Picture mode)}
174@findex picture-motion
175@findex picture-motion-reverse
176 Two motion commands move based on the current Picture insertion
177direction. The command @kbd{C-c C-f} (@code{picture-motion}) moves in the
178same direction as motion after ``insertion'' currently does, while @kbd{C-c
179C-b} (@code{picture-motion-reverse}) moves in the opposite direction.
180
181@node Tabs in Picture
182@section Picture Mode Tabs
183
184@kindex M-TAB @r{(Picture mode)}
185@findex picture-tab-search
186@vindex picture-tab-chars
187 Two kinds of tab-like action are provided in Picture mode. Use
188@kbd{M-@key{TAB}} (@code{picture-tab-search}) for context-based tabbing.
189With no argument, it moves to a point underneath the next
190``interesting'' character that follows whitespace in the previous
191nonblank line. ``Next'' here means ``appearing at a horizontal position
192greater than the one point starts out at.'' With an argument, as in
193@kbd{C-u M-@key{TAB}}, this command moves to the next such interesting
194character in the current line. @kbd{M-@key{TAB}} does not change the
195text; it only moves point. ``Interesting'' characters are defined by
196the variable @code{picture-tab-chars}, which should define a set of
197characters. The syntax for this variable is like the syntax used inside
198of @samp{[@dots{}]} in a regular expression---but without the @samp{[}
199and the @samp{]}. Its default value is @code{"!-~"}.
200
201@findex picture-tab
202 @key{TAB} itself runs @code{picture-tab}, which operates based on the
203current tab stop settings; it is the Picture mode equivalent of
204@code{tab-to-tab-stop}. Normally it just moves point, but with a numeric
205argument it clears the text that it moves over.
206
207@kindex C-c TAB @r{(Picture mode)}
208@findex picture-set-tab-stops
209 The context-based and tab-stop-based forms of tabbing are brought
210together by the command @kbd{C-c @key{TAB}} (@code{picture-set-tab-stops}).
211This command sets the tab stops to the positions which @kbd{M-@key{TAB}}
212would consider significant in the current line. The use of this command,
213together with @key{TAB}, can get the effect of context-based tabbing. But
214@kbd{M-@key{TAB}} is more convenient in the cases where it is sufficient.
215
216 It may be convenient to prevent use of actual tab characters in
217pictures. For example, this prevents @kbd{C-x @key{TAB}} from messing
218up the picture. You can do this by setting the variable
219@code{indent-tabs-mode} to @code{nil}.
220
221@node Rectangles in Picture
222@section Picture Mode Rectangle Commands
223@cindex rectangles and Picture mode
224@cindex Picture mode and rectangles
225
226 Picture mode defines commands for working on rectangular pieces of
227the text in ways that fit with the quarter-plane model. The standard
228rectangle commands may also be useful. @xref{Rectangles,,, emacs, the
229Emacs Manual}.
230
231@table @kbd
232@item C-c C-k
233Clear out the region-rectangle with spaces
234(@code{picture-clear-rectangle}). With argument, delete the text.
235@item C-c C-w @var{r}
236Similar, but save rectangle contents in register @var{r} first
237(@code{picture-clear-rectangle-to-register}).
238@item C-c C-y
239Copy last killed rectangle into the buffer by overwriting, with upper
240left corner at point (@code{picture-yank-rectangle}). With argument,
241insert instead.
242@item C-c C-x @var{r}
243Similar, but use the rectangle in register @var{r}
244(@code{picture-yank-rectangle-from-register}).
245@end table
246
247@kindex C-c C-k @r{(Picture mode)}
248@kindex C-c C-w @r{(Picture mode)}
249@findex picture-clear-rectangle
250@findex picture-clear-rectangle-to-register
251 The picture rectangle commands @kbd{C-c C-k}
252(@code{picture-clear-rectangle}) and @kbd{C-c C-w}
253(@code{picture-clear-rectangle-to-register}) differ from the standard
254rectangle commands in that they normally clear the rectangle instead of
255deleting it; this is analogous with the way @kbd{C-d} is changed in Picture
256mode.
257
258 However, deletion of rectangles can be useful in Picture mode, so
259these commands delete the rectangle if given a numeric argument.
260@kbd{C-c C-k} either with or without a numeric argument saves the
261rectangle for @kbd{C-c C-y}.
262
263@kindex C-c C-y @r{(Picture mode)}
264@kindex C-c C-x @r{(Picture mode)}
265@findex picture-yank-rectangle
266@findex picture-yank-rectangle-from-register
267 The Picture mode commands for yanking rectangles differ from the
268standard ones in that they overwrite instead of inserting. This is
269the same way that Picture mode insertion of other text differs from
270other modes. @kbd{C-c C-y} (@code{picture-yank-rectangle}) inserts
271(by overwriting) the rectangle that was most recently killed, while
272@kbd{C-c C-x} (@code{picture-yank-rectangle-from-register}) does
273likewise for the rectangle found in a specified register.
diff --git a/man/vc-xtra.texi b/man/vc-xtra.texi
new file mode 100644
index 00000000000..0423054f610
--- /dev/null
+++ b/man/vc-xtra.texi
@@ -0,0 +1,24 @@
1@c This file is included in emacs-xtra.texi when producing the printed
2@c version.
3@iftex
4@node Advanced VC Usage
5@section Advanced VC Usage
6
7 Commonly used features of Emacs' version control (VC) support are
8described in the main Emacs manual (@pxref{Version Control,,,emacs,
9the Emacs Manual}). This chapter describes more advanced VC usage.
10
11@menu
12* VC Dired Mode:: Listing files managed by version control.
13* VC Dired Commands:: Commands to use in a VC Dired buffer.
14* Remote Repositories:: Efficient access to remote CVS servers.
15* Snapshots:: Sets of file versions treated as a unit.
16* Miscellaneous VC:: Various other commands and features of VC.
17* Customizing VC:: Variables that change VC's behavior.
18@end menu
19@end iftex
20
21@iftex
22@include vc1-xtra.texi
23@include vc2-xtra.texi
24@end iftex
diff --git a/man/vc1-xtra.texi b/man/vc1-xtra.texi
new file mode 100644
index 00000000000..822ecc543ef
--- /dev/null
+++ b/man/vc1-xtra.texi
@@ -0,0 +1,137 @@
1@c This file is included either in vc-xtra.texi (when producing the
2@c printed version) or in the main Emacs manual (for the on-line version).
3@node VC Dired Mode
4@subsection Dired under VC
5
6@cindex PCL-CVS
7@pindex cvs
8@cindex CVS Dired Mode
9 The VC Dired Mode described here works with all the version control
10systems that VC supports. Another more powerful facility, designed
11specifically for CVS, is called PCL-CVS. @xref{Top, , About PCL-CVS,
12pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.
13
14@kindex C-x v d
15@findex vc-directory
16 When you are working on a large program, it is often useful to find
17out which files have changed within an entire directory tree, or to view
18the status of all files under version control at once, and to perform
19version control operations on collections of files. You can use the
20command @kbd{C-x v d} (@code{vc-directory}) to make a directory listing
21that includes only files relevant for version control.
22
23@vindex vc-dired-terse-display
24 @kbd{C-x v d} creates a buffer which uses VC Dired Mode. This looks
25much like an ordinary Dired buffer (@pxref{Dired,,,emacs, the
26Emacs Manual}); however, normally it shows only the noteworthy files
27(those locked or not up-to-date). This is called @dfn{terse display}.
28If you set the variable @code{vc-dired-terse-display} to @code{nil},
29then VC Dired shows all relevant files---those managed under version
30control, plus all subdirectories (@dfn{full display}). The command
31@kbd{v t} in a VC Dired buffer toggles between terse display and full
32display (@pxref{VC Dired Commands}).
33
34@vindex vc-dired-recurse
35 By default, VC Dired produces a recursive listing of noteworthy or
36relevant files at or below the given directory. You can change this by
37setting the variable @code{vc-dired-recurse} to @code{nil}; then VC
38Dired shows only the files in the given directory.
39
40 The line for an individual file shows the version control state in the
41place of the hard link count, owner, group, and size of the file. If
42the file is unmodified, in sync with the master file, the version
43control state shown is blank. Otherwise it consists of text in
44parentheses. Under RCS and SCCS, the name of the user locking the file
45is shown; under CVS, an abbreviated version of the @samp{cvs status}
46output is used. Here is an example using RCS:
47
48@smallexample
49@group
50 /home/jim/project:
51
52 -rw-r--r-- (jim) Apr 2 23:39 file1
53 -r--r--r-- Apr 5 20:21 file2
54@end group
55@end smallexample
56
57@noindent
58The files @samp{file1} and @samp{file2} are under version control,
59@samp{file1} is locked by user jim, and @samp{file2} is unlocked.
60
61 Here is an example using CVS:
62
63@smallexample
64@group
65 /home/joe/develop:
66
67 -rw-r--r-- (modified) Aug 2 1997 file1.c
68 -rw-r--r-- Apr 4 20:09 file2.c
69 -rw-r--r-- (merge) Sep 13 1996 file3.c
70@end group
71@end smallexample
72
73 Here @samp{file1.c} is modified with respect to the repository, and
74@samp{file2.c} is not. @samp{file3.c} is modified, but other changes
75have also been checked in to the repository---you need to merge them
76with the work file before you can check it in.
77
78@vindex vc-stay-local
79@vindex vc-cvs-stay-local
80 In the above, if the repository were on a remote machine, VC would
81only contact it when the variable @code{vc-stay-local} (or
82@code{vc-cvs-stay-local}) is nil (@pxref{CVS Options}). This is
83because access to the repository may be slow, or you may be working
84offline and not have access to the repository at all. As a
85consequence, VC would not be able to tell you that @samp{file3.c} is
86in the ``merge'' state; you would learn that only when you try to
87check-in your modified copy of the file, or use a command such as
88@kbd{C-x v m}.
89
90 In practice, this is not a problem because CVS handles this case
91consistently whenever it arises. In VC, you'll simply get prompted to
92merge the remote changes into your work file first. The benefits of
93less network communication usually outweigh the disadvantage of not
94seeing remote changes immediately.
95
96@vindex vc-directory-exclusion-list
97 When VC Dired displays subdirectories (in the ``full'' display mode),
98it omits some that should never contain any files under version control.
99By default, this includes Version Control subdirectories such as
100@samp{RCS} and @samp{CVS}; you can customize this by setting the
101variable @code{vc-directory-exclusion-list}.
102
103 You can fine-tune VC Dired's format by typing @kbd{C-u C-x v d}---as in
104ordinary Dired, that allows you to specify additional switches for the
105@samp{ls} command.
106
107@node VC Dired Commands
108@subsection VC Dired Commands
109
110 All the usual Dired commands work normally in VC Dired mode, except
111for @kbd{v}, which is redefined as the version control prefix. You can
112invoke VC commands such as @code{vc-diff} and @code{vc-print-log} by
113typing @kbd{v =}, or @kbd{v l}, and so on. Most of these commands apply
114to the file name on the current line.
115
116 The command @kbd{v v} (@code{vc-next-action}) operates on all the
117marked files, so that you can lock or check in several files at once.
118If it operates on more than one file, it handles each file according to
119its current state; thus, it might lock one file, but check in another
120file. This could be confusing; it is up to you to avoid confusing
121behavior by marking a set of files that are in a similar state. If no
122files are marked, @kbd{v v} operates on the file in the current line.
123
124 If any files call for check-in, @kbd{v v} reads a single log entry,
125then uses it for all the files being checked in. This is convenient for
126registering or checking in several files at once, as part of the same
127change.
128
129@findex vc-dired-toggle-terse-mode
130@findex vc-dired-mark-locked
131 You can toggle between terse display (only locked files, or files not
132up-to-date) and full display at any time by typing @kbd{v t}
133(@code{vc-dired-toggle-terse-mode}). There is also a special command
134@kbd{* l} (@code{vc-dired-mark-locked}), which marks all files currently
135locked (or, with CVS, all files not up-to-date). Thus, typing @kbd{* l
136t k} is another way to delete from the buffer all files except those
137currently locked.
diff --git a/man/vc2-xtra.texi b/man/vc2-xtra.texi
new file mode 100644
index 00000000000..c800d9d912c
--- /dev/null
+++ b/man/vc2-xtra.texi
@@ -0,0 +1,729 @@
1@c This file is included either in vc-xtra.texi (when producing the
2@c printed version) or in the main Emacs manual (for the on-line version).
3@node Remote Repositories
4@subsection Remote Repositories
5@cindex remote repositories (CVS)
6
7 A common way of using CVS is to set up a central CVS repository on
8some Internet host, then have each developer check out a personal
9working copy of the files on his local machine. Committing changes to
10the repository, and picking up changes from other users into one's own
11working area, then works by direct interactions with the CVS server.
12
13 One difficulty is that access to the CVS server is often slow, and
14that developers might need to work off-line as well. VC is designed
15to reduce the amount of network interaction necessary.
16
17@menu
18* Version Backups:: Keeping local copies of repository versions.
19* Local Version Control:: Using another version system for local editing.
20@end menu
21
22@node Version Backups
23@subsubsection Version Backups
24@cindex version backups
25
26@cindex automatic version backups
27 When VC sees that the CVS repository for a file is on a remote
28machine, it automatically makes local backups of unmodified versions
29of the file---@dfn{automatic version backups}. This means that you
30can compare the file to the repository version (@kbd{C-x v =}), or
31revert to that version (@kbd{C-x v u}), without any network
32interactions.
33
34 The local copy of the unmodified file is called a @dfn{version
35backup} to indicate that it corresponds exactly to a version that is
36stored in the repository. Note that version backups are not the same
37as ordinary Emacs backup files (@pxref{Backup,,,emacs, the Emacs
38Manual}). But they follow a similar naming convention.
39
40 For a file that comes from a remote CVS repository, VC makes a
41version backup whenever you save the first changes to the file, and
42removes it after you have committed your modified version to the
43repository. You can disable the making of automatic version backups by
44setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
45
46@cindex manual version backups
47 The name of the automatic version backup for version @var{version}
48of file @var{file} is @code{@var{file}.~@var{version}.~}. This is
49almost the same as the name used by @kbd{C-x v ~} (@pxref{Old
50Versions,,,emacs, the Emacs Manual}), the only difference being
51the additional dot (@samp{.}) after the version number. This
52similarity is intentional, because both kinds of files store the same
53kind of information. The file made by @kbd{C-x v ~} acts as a
54@dfn{manual version backup}.
55
56 All the VC commands that operate on old versions of a file can use
57both kinds of version backups. For instance, @kbd{C-x v ~} uses
58either an automatic or a manual version backup, if possible, to get
59the contents of the version you request. Likewise, @kbd{C-x v =} and
60@kbd{C-x v u} use either an automatic or a manual version backup, if
61one of them exists, to get the contents of a version to compare or
62revert to. If you changed a file outside of Emacs, so that no
63automatic version backup was created for the previous text, you can
64create a manual backup of that version using @kbd{C-x v ~}, and thus
65obtain the benefit of the local copy for Emacs commands.
66
67 The only difference in Emacs's handling of manual and automatic
68version backups, once they exist, is that Emacs deletes automatic
69version backups when you commit to the repository. By contrast,
70manual version backups remain until you delete them.
71
72@node Local Version Control
73@subsubsection Local Version Control
74@cindex local version control
75@cindex local back end (version control)
76
77When you make many changes to a file that comes from a remote
78repository, it can be convenient to have version control on your local
79machine as well. You can then record intermediate versions, revert to
80a previous state, etc., before you actually commit your changes to the
81remote server.
82
83VC lets you do this by putting a file under a second, local version
84control system, so that the file is effectively registered in two
85systems at the same time. For the description here, we will assume
86that the remote system is CVS, and you use RCS locally, although the
87mechanism works with any combination of version control systems
88(@dfn{back ends}).
89
90To make it work with other back ends, you must make sure that the
91``more local'' back end comes before the ``more remote'' back end in
92the setting of @code{vc-handled-backends} (@pxref{Customizing VC}). By
93default, this variable is set up so that you can use remote CVS and
94local RCS as described here.
95
96To start using local RCS for a file that comes from a remote CVS
97server, you must @emph{register the file in RCS}, by typing @kbd{C-u
98C-x v v rcs @key{RET}}. (In other words, use @code{vc-next-action} with a
99prefix argument, and specify RCS as the back end.)
100
101You can do this at any time; it does not matter whether you have
102already modified the file with respect to the version in the CVS
103repository. If possible, VC tries to make the RCS master start with
104the unmodified repository version, then checks in any local changes
105as a new version. This works if you have not made any changes yet, or
106if the unmodified repository version exists locally as a version
107backup (@pxref{Version Backups}). If the unmodified version is not
108available locally, the RCS master starts with the modified version;
109the only drawback to this is that you cannot compare your changes
110locally to what is stored in the repository.
111
112The version number of the RCS master is derived from the current CVS
113version, starting a branch from it. For example, if the current CVS
114version is 1.23, the local RCS branch will be 1.23.1. Version 1.23 in
115the RCS master will be identical to version 1.23 under CVS; your first
116changes are checked in as 1.23.1.1. (If the unmodified file is not
117available locally, VC will check in the modified file twice, both as
1181.23 and 1.23.1.1, to make the revision numbers consistent.)
119
120If you do not use locking under CVS (the default), locking is also
121disabled for RCS, so that editing under RCS works exactly as under
122CVS.
123
124When you are done with local editing, you can commit the final version
125back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
126This initializes the log entry buffer (@pxref{Log Buffer,,,emacs, the
127Emacs Manual}) to contain all the log entries you have recorded in the
128RCS master; you can edit them as you wish, and then commit in CVS by
129typing @kbd{C-c C-c}. If the commit is successful, VC removes the RCS
130master, so that the file is once again registered under CVS only.
131(The RCS master is not actually deleted, just renamed by appending
132@samp{~} to the name, so that you can refer to it later if you wish.)
133
134While using local RCS, you can pick up recent changes from the CVS
135repository into your local file, or commit some of your changes back
136to CVS, without terminating local RCS version control. To do this,
137switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
138
139@table @kbd
140@item C-x v b
141Switch to another back end that the current file is registered
142under (@code{vc-switch-backend}).
143
144@item C-u C-x v b @var{backend} @key{RET}
145Switch to @var{backend} for the current file.
146@end table
147
148@kindex C-x v b
149@findex vc-switch-backend
150@kbd{C-x v b} does not change the buffer contents, or any files; it
151only changes VC's perspective on how to handle the file. Any
152subsequent VC commands for that file will operate on the back end that
153is currently selected.
154
155If the current file is registered in more than one back end, typing
156@kbd{C-x v b} ``cycles'' through all of these back ends. With a
157prefix argument, it asks for the back end to use in the minibuffer.
158
159Thus, if you are using local RCS, and you want to pick up some recent
160changes in the file from remote CVS, first visit the file, then type
161@kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
162@key{RET}} to merge the news (@pxref{Merging,,,emacs, the Emacs
163Manual}). You can then switch back to RCS by typing @kbd{C-x v b}
164again, and continue to edit locally.
165
166But if you do this, the revision numbers in the RCS master no longer
167correspond to those of CVS. Technically, this is not a problem, but
168it can become difficult to keep track of what is in the CVS repository
169and what is not. So we suggest that you return from time to time to
170CVS-only operation, by committing your local changes back to the
171repository using @kbd{C-u C-x v v cvs @key{RET}}.
172
173@node Snapshots
174@subsection Snapshots
175@cindex snapshots and version control
176
177 A @dfn{snapshot} is a named set of file versions (one for each
178registered file) that you can treat as a unit. One important kind of
179snapshot is a @dfn{release}, a (theoretically) stable version of the
180system that is ready for distribution to users.
181
182@menu
183* Making Snapshots:: The snapshot facilities.
184* Snapshot Caveats:: Things to be careful of when using snapshots.
185@end menu
186
187@node Making Snapshots
188@subsubsection Making and Using Snapshots
189
190 There are two basic commands for snapshots; one makes a
191snapshot with a given name, the other retrieves a named snapshot.
192
193@table @code
194@kindex C-x v s
195@findex vc-create-snapshot
196@item C-x v s @var{name} @key{RET}
197Define the last saved versions of every registered file in or under the
198current directory as a snapshot named @var{name}
199(@code{vc-create-snapshot}).
200
201@kindex C-x v r
202@findex vc-retrieve-snapshot
203@item C-x v r @var{name} @key{RET}
204For all registered files at or below the current directory level, select
205whatever versions correspond to the snapshot @var{name}
206(@code{vc-retrieve-snapshot}).
207
208This command reports an error if any files are locked at or below the
209current directory, without changing anything; this is to avoid
210overwriting work in progress.
211@end table
212
213 A snapshot uses a very small amount of resources---just enough to record
214the list of file names and which version belongs to the snapshot. Thus,
215you need not hesitate to create snapshots whenever they are useful.
216
217 You can give a snapshot name as an argument to @kbd{C-x v =} or
218@kbd{C-x v ~} (@pxref{Old Versions,,,emacs, the Emacs Manual}).
219Thus, you can use it to compare a snapshot against the current files,
220or two snapshots against each other, or a snapshot against a named
221version.
222
223@node Snapshot Caveats
224@subsubsection Snapshot Caveats
225
226@cindex named configurations (RCS)
227 VC's snapshot facilities are modeled on RCS's named-configuration
228support. They use RCS's native facilities for this, so
229snapshots made using RCS through VC are visible even when you bypass VC.
230
231 With CVS, Meta-CVS, and Subversion, VC also uses the native
232mechanism provided by that back end to make snapshots and retrieve them
233(@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
234
235@c worded verbosely to avoid overfull hbox.
236 For SCCS, VC implements snapshots itself. The files it uses contain
237name/file/version-number triples. These snapshots are visible only
238through VC.
239
240 There is no support for VC snapshots using GNU Arch yet.
241
242 A snapshot is a set of checked-in versions. So make sure that all the
243files are checked in and not locked when you make a snapshot.
244
245 File renaming and deletion can create some difficulties with snapshots.
246This is not a VC-specific problem, but a general design issue in version
247control systems that no one has solved very well yet.
248
249 If you rename a registered file, you need to rename its master along
250with it (the command @code{vc-rename-file} does this automatically). If
251you are using SCCS, you must also update the records of the snapshot, to
252mention the file by its new name (@code{vc-rename-file} does this,
253too). An old snapshot that refers to a master file that no longer
254exists under the recorded name is invalid; VC can no longer retrieve
255it. It would be beyond the scope of this manual to explain enough about
256RCS and SCCS to explain how to update the snapshots by hand.
257
258 Using @code{vc-rename-file} makes the snapshot remain valid for
259retrieval, but it does not solve all problems. For example, some of the
260files in your program probably refer to others by name. At the very
261least, the makefile probably mentions the file that you renamed. If you
262retrieve an old snapshot, the renamed file is retrieved under its new
263name, which is not the name that the makefile expects. So the program
264won't really work as retrieved.
265
266@node Miscellaneous VC
267@subsection Miscellaneous Commands and Features of VC
268
269 This section explains the less-frequently-used features of VC.
270
271@menu
272* Change Logs and VC:: Generating a change log file from log entries.
273* Renaming and VC:: A command to rename both the source and master
274 file correctly.
275* Version Headers:: Inserting version control headers into working files.
276@end menu
277
278@node Change Logs and VC
279@subsubsection Change Logs and VC
280
281 If you use RCS or CVS for a program and also maintain a change log
282file for it (@pxref{Change Log,,,emacs, the Emacs Manual}), you
283can generate change log entries automatically from the version control
284log entries:
285
286@table @kbd
287@item C-x v a
288@kindex C-x v a
289@findex vc-update-change-log
290Visit the current directory's change log file and, for registered files
291in that directory, create new entries for versions checked in since the
292most recent entry in the change log file.
293(@code{vc-update-change-log}).
294
295This command works with RCS or CVS only, not with any of the other
296back ends.
297
298@item C-u C-x v a
299As above, but only find entries for the current buffer's file.
300
301@item M-1 C-x v a
302As above, but find entries for all the currently visited files that are
303maintained with version control. This works only with RCS, and it puts
304all entries in the log for the default directory, which may not be
305appropriate.
306@end table
307
308 For example, suppose the first line of @file{ChangeLog} is dated
3091999-04-10, and that the only check-in since then was by Nathaniel
310Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
311messages that start with `#'.}. Then @kbd{C-x v a} visits
312@file{ChangeLog} and inserts text like this:
313
314@iftex
315@medbreak
316@end iftex
317@smallexample
318@group
3191999-05-22 Nathaniel Bowditch <nat@@apn.org>
320
321 * rcs2log: Ignore log messages that start with `#'.
322@end group
323@end smallexample
324@iftex
325@medbreak
326@end iftex
327
328@noindent
329You can then edit the new change log entry further as you wish.
330
331 Some of the new change log entries may duplicate what's already in
332ChangeLog. You will have to remove these duplicates by hand.
333
334 Normally, the log entry for file @file{foo} is displayed as @samp{*
335foo: @var{text of log entry}}. The @samp{:} after @file{foo} is omitted
336if the text of the log entry starts with @w{@samp{(@var{functionname}):
337}}. For example, if the log entry for @file{vc.el} is
338@samp{(vc-do-command): Check call-process status.}, then the text in
339@file{ChangeLog} looks like this:
340
341@iftex
342@medbreak
343@end iftex
344@smallexample
345@group
3461999-05-06 Nathaniel Bowditch <nat@@apn.org>
347
348 * vc.el (vc-do-command): Check call-process status.
349@end group
350@end smallexample
351@iftex
352@medbreak
353@end iftex
354
355 When @kbd{C-x v a} adds several change log entries at once, it groups
356related log entries together if they all are checked in by the same
357author at nearly the same time. If the log entries for several such
358files all have the same text, it coalesces them into a single entry.
359For example, suppose the most recent check-ins have the following log
360entries:
361
362@flushleft
363@bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
364@bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
365@bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
366@end flushleft
367
368@noindent
369They appear like this in @file{ChangeLog}:
370
371@iftex
372@medbreak
373@end iftex
374@smallexample
375@group
3761999-04-01 Nathaniel Bowditch <nat@@apn.org>
377
378 * vc.texinfo: Fix expansion typos.
379
380 * vc.el, vc-hooks.el: Don't call expand-file-name.
381@end group
382@end smallexample
383@iftex
384@medbreak
385@end iftex
386
387 Normally, @kbd{C-x v a} separates log entries by a blank line, but you
388can mark several related log entries to be clumped together (without an
389intervening blank line) by starting the text of each related log entry
390with a label of the form @w{@samp{@{@var{clumpname}@} }}. The label
391itself is not copied to @file{ChangeLog}. For example, suppose the log
392entries are:
393
394@flushleft
395@bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
396@bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
397@bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
398@end flushleft
399
400@noindent
401Then the text in @file{ChangeLog} looks like this:
402
403@iftex
404@medbreak
405@end iftex
406@smallexample
407@group
4081999-04-01 Nathaniel Bowditch <nat@@apn.org>
409
410 * vc.texinfo: Fix expansion typos.
411 * vc.el, vc-hooks.el: Don't call expand-file-name.
412@end group
413@end smallexample
414@iftex
415@medbreak
416@end iftex
417
418 A log entry whose text begins with @samp{#} is not copied to
419@file{ChangeLog}. For example, if you merely fix some misspellings in
420comments, you can log the change with an entry beginning with @samp{#}
421to avoid putting such trivia into @file{ChangeLog}.
422
423@node Renaming and VC
424@subsubsection Renaming VC Work Files and Master Files
425
426@findex vc-rename-file
427 When you rename a registered file, you must also rename its master
428file correspondingly to get proper results. Use @code{vc-rename-file}
429to rename the source file as you specify, and rename its master file
430accordingly. It also updates any snapshots (@pxref{Snapshots}) that
431mention the file, so that they use the new name; despite this, the
432snapshot thus modified may not completely work (@pxref{Snapshot
433Caveats}).
434
435 Some back ends do not provide an explicit rename operation to their
436repositories. After issuing @code{vc-rename-file}, use @kbd{C-x v v}
437on the original and renamed buffers and provide the necessary edit
438log.
439
440 You cannot use @code{vc-rename-file} on a file that is locked by
441someone else.
442
443@node Version Headers
444@subsubsection Inserting Version Control Headers
445
446 Sometimes it is convenient to put version identification strings
447directly into working files. Certain special strings called
448@dfn{version headers} are replaced in each successive version by the
449number of that version, the name of the user who created it, and other
450relevant information. All of the back ends that VC supports have such
451a mechanism, except GNU Arch.
452
453 VC does not normally use the information contained in these headers.
454The exception is RCS---with RCS, version headers are sometimes more
455reliable than the master file to determine which version of the file
456you are editing. Note that in a multi-branch environment, version
457headers are necessary to make VC behave correctly (@pxref{Multi-User
458Branching,,,emacs, the Emacs Manual}).
459
460 Searching for RCS version headers is controlled by the variable
461@code{vc-consult-headers}. If it is non-@code{nil} (the default),
462Emacs searches for headers to determine the version number you are
463editing. Setting it to @code{nil} disables this feature.
464
465 Note that although CVS uses the same kind of version headers as RCS
466does, VC never searches for these headers if you are using CVS,
467regardless of the above setting.
468
469@kindex C-x v h
470@findex vc-insert-headers
471 You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
472insert a suitable header string.
473
474@table @kbd
475@item C-x v h
476Insert headers in a file for use with your version-control system.
477@end table
478
479@vindex vc-@var{backend}-header
480 The default header string is @samp{@w{$}Id$} for RCS and
481@samp{@w{%}W%} for SCCS. You can specify other headers to insert by
482setting the variables @code{vc-@var{backend}-header} where
483@var{backend} is @code{rcs} or @code{sccs}.
484
485 Instead of a single string, you can specify a list of strings; then
486each string in the list is inserted as a separate header on a line of
487its own.
488
489 It may be necessary to use apparently-superfluous backslashes when
490writing the strings that you put in this variable. For instance, you
491might write @code{"$Id\$"} rather than @code{"$Id@w{$}"}. The extra
492backslash prevents the string constant from being interpreted as a
493header, if the Emacs Lisp file containing it is maintained with
494version control.
495
496@vindex vc-comment-alist
497 Each header is inserted surrounded by tabs, inside comment delimiters,
498on a new line at point. Normally the ordinary comment
499start and comment end strings of the current mode are used, but for
500certain modes, there are special comment delimiters for this purpose;
501the variable @code{vc-comment-alist} specifies them. Each element of
502this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
503
504@vindex vc-static-header-alist
505 The variable @code{vc-static-header-alist} specifies further strings
506to add based on the name of the buffer. Its value should be a list of
507elements of the form @code{(@var{regexp} . @var{format})}. Whenever
508@var{regexp} matches the buffer name, @var{format} is inserted as part
509of the header. A header line is inserted for each element that matches
510the buffer name, and for each string specified by
511@code{vc-@var{backend}-header}. The header line is made by processing the
512string from @code{vc-@var{backend}-header} with the format taken from the
513element. The default value for @code{vc-static-header-alist} is as follows:
514
515@example
516@group
517(("\\.c$" .
518 "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
519#endif /* lint */\n"))
520@end group
521@end example
522
523@noindent
524It specifies insertion of text of this form:
525
526@example
527@group
528
529#ifndef lint
530static char vcid[] = "@var{string}";
531#endif /* lint */
532@end group
533@end example
534
535@noindent
536Note that the text above starts with a blank line.
537
538 If you use more than one version header in a file, put them close
539together in the file. The mechanism in @code{revert-buffer} that
540preserves markers may not handle markers positioned between two version
541headers.
542
543@node Customizing VC
544@subsection Customizing VC
545
546@vindex vc-handled-backends
547The variable @code{vc-handled-backends} determines which version
548control systems VC should handle. The default value is @code{(RCS CVS
549SVN SCCS Arch MCVS)}, so it contains all six version systems that are
550currently supported. If you want VC to ignore one or more of these
551systems, exclude its name from the list. To disable VC entirely, set
552this variable to @code{nil}.
553
554The order of systems in the list is significant: when you visit a file
555registered in more than one system (@pxref{Local Version Control}), VC
556uses the system that comes first in @code{vc-handled-backends} by
557default. The order is also significant when you register a file for
558the first time, @pxref{Registering,,,emacs, the Emacs Manual} for
559details.
560
561@menu
562* General VC Options:: Options that apply to multiple back ends.
563* RCS and SCCS:: Options for RCS and SCCS.
564* CVS Options:: Options for CVS.
565@end menu
566
567@node General VC Options
568@subsubsection General Options
569
570@vindex vc-make-backup-files
571 Emacs normally does not save backup files for source files that are
572maintained with version control. If you want to make backup files even
573for files that use version control, set the variable
574@code{vc-make-backup-files} to a non-@code{nil} value.
575
576@vindex vc-keep-workfiles
577 Normally the work file exists all the time, whether it is locked or
578not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking
579in a new version with @kbd{C-x v v} deletes the work file; but any
580attempt to visit the file with Emacs creates it again. (With CVS, work
581files are always kept.)
582
583@vindex vc-follow-symlinks
584 Editing a version-controlled file through a symbolic link can be
585dangerous. It bypasses the version control system---you can edit the
586file without locking it, and fail to check your changes in. Also,
587your changes might overwrite those of another user. To protect against
588this, VC checks each symbolic link that you visit, to see if it points
589to a file under version control.
590
591 The variable @code{vc-follow-symlinks} controls what to do when a
592symbolic link points to a version-controlled file. If it is @code{nil},
593VC only displays a warning message. If it is @code{t}, VC automatically
594follows the link, and visits the real file instead, telling you about
595this in the echo area. If the value is @code{ask} (the default), VC
596asks you each time whether to follow the link.
597
598@vindex vc-suppress-confirm
599 If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
600and @kbd{C-x v i} can save the current buffer without asking, and
601@kbd{C-x v u} also operates without asking for confirmation. (This
602variable does not affect @kbd{C-x v c}; that operation is so drastic
603that it should always ask for confirmation.)
604
605@vindex vc-command-messages
606 VC mode does much of its work by running the shell commands for RCS,
607CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
608displays messages to indicate which shell commands it runs, and
609additional messages when the commands finish.
610
611@vindex vc-path
612 You can specify additional directories to search for version control
613programs by setting the variable @code{vc-path}. These directories
614are searched before the usual search path. It is rarely necessary to
615set this variable, because VC normally finds the proper files
616automatically.
617
618@node RCS and SCCS
619@subsubsection Options for RCS and SCCS
620
621@cindex non-strict locking (RCS)
622@cindex locking, non-strict (RCS)
623 By default, RCS uses locking to coordinate the activities of several
624users, but there is a mode called @dfn{non-strict locking} in which
625you can check-in changes without locking the file first. Use
626@samp{rcs -U} to switch to non-strict locking for a particular file,
627see the @code{rcs} manual page for details.
628
629 When deducing the version control state of an RCS file, VC first
630looks for an RCS version header string in the file (@pxref{Version
631Headers}). If there is no header string, VC normally looks at the
632file permissions of the work file; this is fast. But there might be
633situations when the file permissions cannot be trusted. In this case
634the master file has to be consulted, which is rather expensive. Also
635the master file can only tell you @emph{if} there's any lock on the
636file, but not whether your work file really contains that locked
637version.
638
639@vindex vc-consult-headers
640 You can tell VC not to use version headers to determine the file
641status by setting @code{vc-consult-headers} to @code{nil}. VC then
642always uses the file permissions (if it is supposed to trust them), or
643else checks the master file.
644
645@vindex vc-mistrust-permissions
646 You can specify the criterion for whether to trust the file
647permissions by setting the variable @code{vc-mistrust-permissions}.
648Its value can be @code{t} (always mistrust the file permissions and
649check the master file), @code{nil} (always trust the file
650permissions), or a function of one argument which makes the decision.
651The argument is the directory name of the @file{RCS} subdirectory. A
652non-@code{nil} value from the function says to mistrust the file
653permissions. If you find that the file permissions of work files are
654changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
655Then VC always checks the master file to determine the file's status.
656
657 VC determines the version control state of files under SCCS much as
658with RCS. It does not consider SCCS version headers, though. Thus,
659the variable @code{vc-mistrust-permissions} affects SCCS use, but
660@code{vc-consult-headers} does not.
661
662@node CVS Options
663@subsubsection Options specific for CVS
664
665@cindex locking (CVS)
666 By default, CVS does not use locking to coordinate the activities of
667several users; anyone can change a work file at any time. However,
668there are ways to restrict this, resulting in behavior that resembles
669locking.
670
671@cindex CVSREAD environment variable (CVS)
672 For one thing, you can set the @env{CVSREAD} environment variable
673(the value you use makes no difference). If this variable is defined,
674CVS makes your work files read-only by default. In Emacs, you must
675type @kbd{C-x v v} to make the file writable, so that editing works
676in fact similar as if locking was used. Note however, that no actual
677locking is performed, so several users can make their files writable
678at the same time. When setting @env{CVSREAD} for the first time, make
679sure to check out all your modules anew, so that the file protections
680are set correctly.
681
682@cindex cvs watch feature
683@cindex watching files (CVS)
684 Another way to achieve something similar to locking is to use the
685@dfn{watch} feature of CVS. If a file is being watched, CVS makes it
686read-only by default, and you must also use @kbd{C-x v v} in Emacs to
687make it writable. VC calls @code{cvs edit} to make the file writable,
688and CVS takes care to notify other developers of the fact that you
689intend to change the file. See the CVS documentation for details on
690using the watch feature.
691
692@vindex vc-stay-local
693@vindex vc-cvs-stay-local
694@cindex remote repositories (CVS)
695 When a file's repository is on a remote machine, VC tries to keep
696network interactions to a minimum. This is controlled by the variable
697@code{vc-cvs-stay-local}. There is another variable,
698@code{vc-stay-local}, which enables the feature also for other back
699ends that support it, including CVS. In the following, we will talk
700only about @code{vc-cvs-stay-local}, but everything applies to
701@code{vc-stay-local} as well.
702
703If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses
704only the entry in the local CVS subdirectory to determine the file's
705state (and possibly information returned by previous CVS commands).
706One consequence of this is that when you have modified a file, and
707somebody else has already checked in other changes to the file, you
708are not notified of it until you actually try to commit. (But you can
709try to pick up any recent changes from the repository first, using
710@kbd{C-x v m @key{RET}}, @pxref{Merging,,,emacs, the Emacs Manual}).
711
712 When @code{vc-cvs-stay-local} is @code{t}, VC also makes local
713version backups, so that simple diff and revert operations are
714completely local (@pxref{Version Backups}).
715
716 On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil},
717then VC queries the remote repository @emph{before} it decides what to
718do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
719repositories. It also does not make any version backups.
720
721 You can also set @code{vc-cvs-stay-local} to a regular expression
722that is matched against the repository host name; VC then stays local
723only for repositories from hosts that match the pattern.
724
725@vindex vc-cvs-global-switches
726 You can specify additional command line options to pass to all CVS
727operations in the variable @code{vc-cvs-global-switches}. These
728switches are inserted immediately after the @code{cvs} command, before
729the name of the operation to invoke.