annotate man/emacs-xtra.texi @ 56119:23a626038a46

New file.
author Luc Teirlinck <teirllm@auburn.edu>
date Tue, 15 Jun 2004 20:55:24 +0000
parents
children cf2e292bf084
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56119
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
1 \input texinfo @c -*-texinfo-*-
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
2 @comment %**start of header
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
3 @setfilename ../info/emacs-xtra
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
4 @settitle Specialized Emacs Features
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
5 @syncodeindex fn cp
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
6 @syncodeindex vr cp
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
7 @syncodeindex ky cp
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
8 @comment %**end of header
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
9
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
10 @copying
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
11 This file describes specialized features of Emacs.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
12
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
13 Copyright (C) 2004
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
14 Free Software Foundation, Inc.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
15
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
16 @quotation
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
17 Permission is granted to copy, distribute and/or modify this document
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
18 under the terms of the GNU Free Documentation License, Version 1.1 or
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
19 any later version published by the Free Software Foundation; with no
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
20 Invariant Sections, with the Front-Cover texts being ``A GNU
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
21 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
22 license is included in the section entitled ``GNU Free Documentation
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
23 License'' in the Emacs manual.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
24
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
25 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
26 this GNU Manual, like GNU software. Copies published by the Free
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
27 Software Foundation raise funds for GNU development.''
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
28
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
29 This document is part of a collection distributed under the GNU Free
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
30 Documentation License. If you want to distribute this document
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
31 separately from the collection, you can do so by adding a copy of the
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
32 license to the document, as described in section 6 of the license.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
33 @end quotation
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
34 @end copying
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
35
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
36 @dircategory Emacs
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
37 @direntry
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
38 * Emacs-Xtra: (emacs-xtra). Specialized Emacs features.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
39 @end direntry
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
40
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
41 @titlepage
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
42 @title Specialized Emacs Features
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
43 @page
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
44 @vskip 0pt plus 1filll
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
45 @insertcopying
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
46 @end titlepage
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
47
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
48 @contents
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
49
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
50 @ifnottex
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
51 @node Top
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
52 @top Specialized Emacs Features
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
53
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
54 @insertcopying
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
55
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
56 @end ifnottex
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
57
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
58 @menu
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
59 * Introduction:: What documentation belongs here?
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
60 * Autorevert:: Auto Reverting non-file buffers.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
61 * Subdir switches:: Subdirectory switches in Dired.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
62 * Index::
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
63 @end menu
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
64
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
65 @node Introduction
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
66 @unnumbered Introduction
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
67
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
68 This manual contains detailed information about various features that
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
69 are too specialized to be included in the Emacs manual. It is
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
70 intended to be readable by anyone having a basic knowledge of Emacs.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
71 However, certain sections may be intended for a more specialized
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
72 audience, such as Elisp authors. This should be clearly pointed out
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
73 at the beginning of these sections.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
74
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
75 This manual is intended as a complement, rather than an alternative,
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
76 to other ways to gain a more detailed knowledge of Emacs than the
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
77 Emacs manual can provide, such as browsing packages using @kbd{C-h p},
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
78 accessing mode documentation using @kbd{C-h m} and browsing user
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
79 options using Custom. Also, certain packages, or collections of
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
80 related features, have their own manuals. The present manual is
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
81 mainly intended to be a collection of smaller specialized features,
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
82 too small to get their own manual.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
83
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
84 Sections intended specifically for Elisp programmers can follow the
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
85 style of the Elisp manual. Other sections should follow the style of
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
86 the Emacs manual.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
87
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
88 @node Autorevert
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
89 @chapter Auto Reverting non-file Buffers
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
90
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
91 Normally Global Auto Revert Mode only reverts file buffers. There are
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
92 two ways to auto-revert certain non-file buffers: enabling Auto Revert
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
93 Mode in those buffers (using @kbd{M-x auto-revert-mode}) and setting
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
94 @code{global-auto-revert-non-file-buffers} to @code{t}. The latter
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
95 enables Auto Reverting for all types of buffers for which it is
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
96 implemented, that is, for the types of buffers listed in the menu
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
97 below.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
98
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
99 Like file buffers, non-file buffers should normally not revert while
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
100 you are working on them, or while they contain information that might
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
101 get lost after reverting. Therefore, they do not revert if they are
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
102 ``modified''. This can get tricky, because deciding when a non-file
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
103 buffer should be marked modified is usually more difficult than for
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
104 file buffers.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
105
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
106 Another tricky detail is that, for efficiency reasons, Auto Revert
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
107 often does not try to detect all possible changes in the buffer, only
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
108 changes that are ``major'' or easy to detect. Hence, enabling
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
109 auto-reverting for a non-file buffer does not always guarantee that
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
110 all information in the buffer is up to date and does not necessarily
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
111 make manual reverts useless.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
112
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
113 The details depend on the particular types of buffers and are
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
114 explained in the corresponding sections.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
115
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
116 @menu
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
117 * Auto Reverting the Buffer Menu::
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
118 * Auto Reverting Dired::
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
119 * Supporting additional buffers::
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
120 @end menu
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
121
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
122 @node Auto Reverting the Buffer Menu
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
123 @section Auto Reverting the Buffer Menu
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
124
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
125 If auto-reverting of non-file buffers is enabled, the Buffer Menu
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
126 automatically reverts every @code{auto-revert-interval} seconds,
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
127 whether there is a need for it or not. (It would probably take longer
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
128 to check whether there is a need than to actually revert.)
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
129
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
130 If the Buffer Menu inappropriately gets marked modified, just revert
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
131 it manually using @kbd{g} and auto-reverting will resume. However, if
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
132 you marked certain buffers to get deleted or to be displayed, you have
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
133 to be careful, because reverting erases all marks. The fact that
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
134 adding marks sets the buffer's modified flag prevents Auto Revert from
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
135 automatically erasing the marks.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
136
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
137 @node Auto Reverting Dired
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
138 @section Auto Reverting Dired buffers
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
139
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
140 Auto-reverting Dired buffers currently only works satisfactorily on
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
141 GNU/Linux and Unix style operating systems.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
142
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
143 Dired buffers only auto-revert when the file list of the buffer's main
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
144 directory changes. They do not auto-revert when information about a
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
145 particular file changes or when inserted subdirectories change. To be
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
146 sure that @emph{all} listed information is up to date, you have to
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
147 manually revert using @kbd{g}, @emph{even} if auto-reverting is
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
148 enabled in the Dired buffer. Sometimes, you might get the impression
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
149 that modifying or saving files listed in the main directory actually
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
150 does cause auto-reverting. This is because making changes to a file,
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
151 or saving it, very often causes changes in the directory itself, for
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
152 instance, through backup files or auto-save files. However, this is
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
153 not guaranteed.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
154
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
155 If the Dired buffer is marked modified and there are no changes you
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
156 want to protect, then most of the time you can make auto-reverting
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
157 resume by manually reverting the buffer using @kbd{g}. There is one
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
158 exception. If you flag or mark files, then, unlike for the Buffer
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
159 Menu, you can safely revert the buffer. This will not erase the flags
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
160 or marks (unless the marked file has been deleted, of course).
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
161 However, the buffer will stay modified, even after reverting, and
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
162 auto-reverting will not resume. This is because, if you flag or mark
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
163 files, you may be working on the buffer and you might not want the
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
164 buffer to change without warning. If you want auto-reverting to
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
165 resume in the presence of marks and flags, mark the buffer
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
166 non-modified using @kbd{M-~}. However, adding, deleting or changing
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
167 marks or flags will mark it modified again.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
168
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
169 Remote Dired buffers are not auto-reverted. Neither are Dired buffers
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
170 for which you used shell wildcards or file arguments to list only some
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
171 of the files. @samp{*Find*} and @samp{*Locate*} buffers do not
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
172 auto-revert either.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
173
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
174 @node Supporting additional buffers
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
175 @section Adding Support for Auto-Reverting additional Buffers.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
176
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
177 This section is intended for Elisp programmers who would like to add
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
178 support for auto-reverting new types of buffers.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
179
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
180 To support auto-reverting the buffer must first of all have a
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
181 @code{revert-buffer-function}. @xref{Definition of
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
182 revert-buffer-function,, Reverting, elisp, the Emacs Lisp Reference Manual}.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
183
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
184 In addition, it @emph{must} have a @code{buffer-stale-function}.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
185
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
186 @defvar buffer-stale-function
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
187 The value of this variable is a function to check whether a non-file
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
188 buffer needs reverting. This should be a function with one optional
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
189 argument @var{noconfirm}. The function should return non-@code{nil}
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
190 if the buffer should be reverted. The buffer is current when this
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
191 function is called.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
192
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
193 While this function is mainly intended for use in auto-reverting, it
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
194 could be used for other purposes as well. For instance, if
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
195 auto-reverting is not enabled, it could be used to warn the user that
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
196 the buffer needs reverting. The idea behind the @var{noconfirm}
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
197 argument is that it should be @code{t} if the buffer is going to be
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
198 reverted without asking the user and @code{nil} if the function is
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
199 just going to be used to warn the user that the buffer is out of date.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
200 In particular, for use in auto-reverting, @var{noconfirm} is @code{t}.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
201 If the function is only going to be used for auto-reverting, you can
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
202 ignore the @var{noconfirm} argument.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
203
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
204 If you just want to automatically auto-revert every
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
205 @code{auto-revert-interval} seconds, use:
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
206
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
207 @example
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
208 (set (make-local-variable 'buffer-stale-function)
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
209 #'(lambda (&optional noconfirm) 'fast))
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
210 @end example
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
211
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
212 @noindent
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
213 in the buffer's mode function.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
214
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
215 The special return value @samp{fast} tells the caller that the need for
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
216 reverting was not checked, but that reverting the buffer is fast.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
217 This information could be useful if the function is consulted for
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
218 purposes other than auto-reverting.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
219 @end defvar
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
220
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
221 Once the buffer has a @code{revert-buffer-function} and a
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
222 @code{buffer-stale-function}, several problems usually remain.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
223
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
224 The buffer will only auto-revert if it is marked unmodified. Hence,
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
225 you will have to make sure that various functions mark the buffer
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
226 modified if and only if either the buffer contains information that
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
227 might be lost by reverting or there is reason to believe that the user
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
228 might be inconvenienced by auto-reverting, because he is actively
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
229 working on the buffer. The user can always override this by manually
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
230 adjusting the modified status of the buffer. To support this, calling
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
231 the @code{revert-buffer-function} on a buffer that is marked
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
232 unmodified should always keep the buffer marked unmodified.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
233
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
234 It is important to assure that point does not continuously jump around
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
235 as a consequence of auto-reverting. Of course, moving point might be
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
236 inevitable if the buffer radically changes.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
237
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
238 You should make sure that the @code{revert-buffer-function} does not
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
239 print messages that unnecessarily duplicate Auto Revert's own messages
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
240 if @code{auto-revert-verbose} is @code{t} and effectively override a
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
241 @code{nil} value for @code{auto-revert-verbose}. Hence, adapting a
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
242 mode for auto-reverting often involves getting rid of such messages.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
243
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
244 @ifinfo
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
245 Finally, you should add a node to this chapter's menu. This node
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
246 @end ifinfo
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
247 @ifnotinfo
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
248 Finally, you should add a section to this chapter. This section
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
249 @end ifnotinfo
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
250 should at the very least make clear whether enabling auto-reverting
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
251 for the buffer reliably assures that all information in the buffer is
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
252 completely up to date (or will be after @code{auto-revert-interval}
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
253 seconds).
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
254
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
255 @node Subdir switches
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
256 @chapter Subdirectory Switches in Dired
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
257
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
258 You can insert subdirectories with specified @code{ls} switches in
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
259 Dired buffers, using @kbd{C-u i}. You can change the @code{ls}
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
260 switches of an already inserted subdirectory using @kbd{C-u l}.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
261
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
262 In Emacs versions 21.4 and later, Dired remembers the switches, so
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
263 that reverting the buffer will not change them back to the main
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
264 directory's switches. Deleting a subdirectory forgets about its
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
265 switches.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
266
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
267 Using @code{dired-undo} (usually bound to @kbd{C-_} and @kbd{C-x u})
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
268 to reinsert or delete subdirectories, that were inserted with explicit
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
269 switches, can bypass Dired's machinery for remembering (or forgetting)
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
270 switches. Deleting a subdirectory using @code{dired-undo} does not
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
271 forget its switches. When later reinserted using @kbd{i}, it will be
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
272 reinserted using its old switches. Using @code{dired-undo} to
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
273 reinsert a subdirectory that was deleted using the regular
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
274 Dired commands (not @code{dired-undo}) will originally insert it with
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
275 its old switches. However, reverting the buffer will relist it using
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
276 the buffer's default switches. If any of this yields problems, you
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
277 can easily correct the situation using @kbd{C-u i} or @kbd{C-u l}.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
278
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
279 The buffer's default switches do not affect subdirectories that were
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
280 inserted using explicitly specified switches. In particular,
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
281 commands such as @kbd{s}, that change the buffer's switches do not
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
282 affect such subdirectories. (They do affect subdirectories without
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
283 explicitly assigned switches, however.)
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
284
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
285 You can make Dired forget about all subdirectory switches and relist
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
286 all subdirectories with the buffer's default switches using
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
287 @kbd{M-x dired-reset-subdir-switches}. This also reverts the Dired buffer.
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
288
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
289 @node Index
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
290 @unnumbered Index
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
291
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
292 @printindex cp
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
293
23a626038a46 New file.
Luc Teirlinck <teirllm@auburn.edu>
parents:
diff changeset
294 @bye