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