Switch to recommended form of GPLv3 permissions notice.
[bpt/emacs.git] / etc / refcards / dired-ref.tex
1 % Reference Card for Dired
2 % Copyright (C) 2000, 2001, 2002, 2003, 2004,
3 % 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4
5 % This file is part of GNU Emacs.
6
7 % GNU Emacs is free software: you can redistribute it and/or modify
8 % it under the terms of the GNU General Public License as published by
9 % the Free Software Foundation, either version 3 of the License, or
10 % (at your option) any later version.
11
12 % GNU Emacs is distributed in the hope that it will be useful,
13 % but WITHOUT ANY WARRANTY; without even the implied warranty of
14 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 % GNU General Public License for more details.
16
17 % You should have received a copy of the GNU General Public License
18 % along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19
20 % This file can be printed with 1, 2, or 3 columns per page (see below).
21 % Specify how many you want here.
22 %**start of header
23
24 \newcount\columnsperpage
25
26 \columnsperpage=2
27
28 % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for
29 % a landscape layout.
30
31 \input pdflayout.sty
32 \pdflayout=(0)
33
34 % Nothing else needs to be changed.
35 % This file is intended to be processed by plain TeX (TeX82).
36 % The reference card looks OK with 2 columns per page, portrait mode.
37 % I haven't tried it with 3 columns per page.
38
39 % This is a bit of a dirty hack on the GNU Emacs reference card
40 % to produce a Dired reference card instead.
41
42 % I (Evgeny Roubinchtein, eroubinc@u.washington.edu) put this together
43 % because I wanted a Dired reference card,
44 % but couldn't find anything on the 'net.
45 % Based mostly off Dired's describe-mode.
46
47
48 \def\versionnumber{0.1}
49 \def\year{2008} % latest copyright year
50 \def\version{May 2006\ v\versionnumber}
51
52 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
53 \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
54 Permissions on back. v\versionnumber}}
55
56 \def\copyrightnotice{
57 \vskip 1ex plus 2 fill\begingroup\small
58 \centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
59 \centerline{designed by Stephen Gildea, \version}
60 \centerline{for GNU Emacs version 19 on Unix systems}
61 \centerline{Updated for Dired in May 2000 by Evgeny Roubinchtein}
62
63 Permission is granted to make and distribute copies of
64 this card provided the copyright notice and this permission notice
65 are preserved on all copies.
66
67 For copies of the GNU Emacs manual, write to the Free Software
68 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
69 MA 02110-1301, USA.
70
71 \endgroup}
72
73 % make \bye not \outer so that the \def\bye in the \else clause below
74 % can be scanned without complaint.
75 \def\bye{\par\vfill\supereject\end}
76
77 \newdimen\intercolumnskip %horizontal space between columns
78 \newbox\columna %boxes to hold columns already built
79 \newbox\columnb
80
81 \def\ncolumns{\the\columnsperpage}
82
83 \message{[\ncolumns\space
84 column\if 1\ncolumns\else s\fi\space per page]}
85
86 \def\scaledmag#1{ scaled \magstep #1}
87
88 % This multi-way format was designed by Stephen Gildea October 1986.
89 % Note that the 1-column format is fontfamily-independent.
90 \if 1\ncolumns %one-column format uses normal size
91 \hsize 4in
92 \vsize 10in
93 \voffset -.7in
94 \font\titlefont=\fontname\tenbf \scaledmag3
95 \font\headingfont=\fontname\tenbf \scaledmag2
96 \font\smallfont=\fontname\sevenrm
97 \font\smallsy=\fontname\sevensy
98
99 \footline{\hss\folio}
100 \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
101 \else %2 or 3 columns uses prereduced size
102 \hsize 3.4in
103 \vsize 9.2in
104 \hoffset -.75in
105 \voffset -.745in
106 \font\titlefont=cmbx10 \scaledmag2
107 \font\headingfont=cmbx10 \scaledmag1
108 \font\smallfont=cmr6
109 \font\smallsy=cmsy6
110 \font\eightrm=cmr8
111 \font\eightbf=cmbx8
112 \font\eightit=cmti8
113 \font\eighttt=cmtt8
114 \font\eightmi=cmmi8
115 \font\eightsy=cmsy8
116 \textfont0=\eightrm
117 \textfont1=\eightmi
118 \textfont2=\eightsy
119 \def\rm{\eightrm}
120 \def\bf{\eightbf}
121 \def\it{\eightit}
122 \def\tt{\eighttt}
123 \normalbaselineskip=.8\normalbaselineskip
124 \normallineskip=.8\normallineskip
125 \normallineskiplimit=.8\normallineskiplimit
126 \normalbaselines\rm %make definitions take effect
127
128 \if 2\ncolumns
129 \let\maxcolumn=b
130 \footline{\hss\rm\folio\hss}
131 \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
132 \else \if 3\ncolumns
133 \let\maxcolumn=c
134 \nopagenumbers
135 \else
136 \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
137 \errmessage{Illegal number of columns per page}
138 \fi\fi
139
140 \intercolumnskip=.46in
141 \def\abc{a}
142 \output={% %see The TeXbook page 257
143 % This next line is useful when designing the layout.
144 %\immediate\write16{Column \folio\abc\space starts with \firstmark}
145 \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
146 \else\if a\abc
147 \global\setbox\columna\columnbox \global\def\abc{b}
148 %% in case we never use \columnb (two-column mode)
149 \global\setbox\columnb\hbox to -\intercolumnskip{}
150 \else
151 \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
152 \def\multicolumnformat{\shipout\vbox{\makeheadline
153 \hbox{\box\columna\hskip\intercolumnskip
154 \box\columnb\hskip\intercolumnskip\columnbox}
155 \makefootline}\advancepageno}
156 \def\columnbox{\leftline{\pagebody}}
157
158 \def\bye{\par\vfill\supereject
159 \if a\abc \else\null\vfill\eject\fi
160 \if a\abc \else\null\vfill\eject\fi
161 \end}
162 \fi
163
164 % we won't be using math mode much, so redefine some of the characters
165 % we might want to talk about
166 \catcode`\^=12
167 \catcode`\_=12
168
169 \chardef\\=`\\
170 \chardef\{=`\{
171 \chardef\}=`\}
172
173 \hyphenation{mini-buf-fer}
174 \hyphenation{de-le-tion}
175
176 \parindent 0pt
177 \parskip 1ex plus .5ex minus .5ex
178
179 \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
180
181 % newcolumn - force a new column. Use sparingly, probably only for
182 % the first column of a page, which should have a title anyway.
183 \outer\def\newcolumn{\vfill\eject}
184
185 % title - page title. Argument is title text.
186 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
187
188 % section - new major section. Argument is section name.
189 \outer\def\section#1{\par\filbreak
190 \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
191 \vskip 2ex plus 1ex minus 1.5ex}
192
193 \newdimen\keyindent
194
195 % beginindentedkeys...endindentedkeys - key definitions will be
196 % indented, but running text, typically used as headings to group
197 % definitions, will not.
198 \def\beginindentedkeys{\keyindent=1em}
199 \def\endindentedkeys{\keyindent=0em}
200 \endindentedkeys
201
202 % paralign - begin paragraph containing an alignment.
203 % If an \halign is entered while in vertical mode, a parskip is never
204 % inserted. Using \paralign instead of \halign solves this problem.
205 \def\paralign{\vskip\parskip\halign}
206
207 % \<...> - surrounds a variable name in a code example
208 \def\<#1>{{\it #1\/}}
209
210 % kbd - argument is characters typed literally. Like the Texinfo command.
211 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
212
213 % beginexample...endexample - surrounds literal text, such a code example.
214 % typeset in a typewriter font with line breaks preserved
215 \def\beginexample{\par\leavevmode\begingroup
216 \obeylines\obeyspaces\parskip0pt\tt}
217 {\obeyspaces\global\let =\ }
218 \def\endexample{\endgroup}
219
220 % key - definition of a key.
221 % \key{description of key}{key-name}
222 % prints the description left-justified, and the key-name in a \kbd
223 % form near the right margin.
224 \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
225 {\hsize=.75\hsize\rightskip=1em
226 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
227
228 \newbox\metaxbox
229 \setbox\metaxbox\hbox{\kbd{M-x }}
230 \newdimen\metaxwidth
231 \metaxwidth=\wd\metaxbox
232
233 % metax - definition of a M-x command.
234 % \metax{description of command}{M-x command-name}
235 % Tries to justify the beginning of the command name at the same place
236 % as \key starts the key name. (The "M-x " sticks out to the left.)
237 \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
238 {\hskip\keyindent\relax#1\hfil}%
239 \hskip -\metaxwidth minus 1fil
240 \kbd{#2}\hfil}}
241
242 % threecol - like "key" but with two key names.
243 % for example, one for doing the action backward, and one for forward.
244 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\hfil\quad
245 &\kbd{#3}\hfil\quad\cr}
246
247 % I cannot figure out how to make all dired-x
248 % commands fit on a page in two-column format
249 \def\dx{{\bf (DX)}}
250
251 \nopagenumbers
252
253 %**end of header
254 \f
255
256 \title{Dired Reference Card}
257
258 \centerline{(based on Dired in GNU Emacs 22)}
259 \centerline{Commands marked with \dx{} require dired-x}
260
261 % trim this down to fit everything on one page
262 % \section{General}
263 % In dired, you can edit a list of the files in a directory (and optionally
264 % its subdirectories in the `ls -lR' format).
265
266 % Editing a directory means that you can visit, rename, copy, compress,
267 % load, byte-compile files. You can change files' attributes, run shell
268 % commands on files, or insert subdirectories into the edit buffer. You can
269 % "flag" files for deletion or "mark" files for later commands, either one
270 % file at a time or by all files matching certain criteria (e.g., files that
271 % match a certain regexp).
272
273 % You move throughout the buffer using the usual cursor motion commands.
274 % Letters no longer insert themselves, but execute commands instead. The
275 % digits (0-9) are prefix arguments.
276
277 % Most commands operate either on all marked files or on the current file if
278 % no files are marked. Use a numeric prefix argument to operate on the next
279 % ARG files (or previous ARG if ARG $<$ 0). Use the prefix argument `1' to
280 % operate on the current file only. Prefix arguments override marks. Commands
281 % which run a sub-process on a group of files will display a list of files
282 % for which the sub-process failed. Typing y will try to tell
283 % you what went wrong.
284
285 % When editing several directories in one buffer, each directory acts as a
286 % page, so C-x [ and C-x ] can be used to move between directories.
287
288 \section{Entering and Exiting Dired}
289
290 \key{run dired}{C-x d}
291 \key{dired the directory of the file you are editing}{C-x C-j \dx}
292 \key{quit dired}{q}
293
294 \section{Motion Commands}
295
296 \key{move up to previous line}{p}
297 \key{move down to next line}{n}
298 \key{move up to previous directory line}{<}
299 \key{move down to next directory line}{>}
300 \key{move to next marked file}{M-\}}
301 \key{move to previous marked file}{M-\{}
302 \key{move up to previous subdirectory}{M-C-p}
303 \key{move down to next subdirectory}{M-C-n}
304 \key{move to parent directory}{^}
305 \key{move to first child subdirectory}{M-C-d}
306
307 \section{Mouse Commands}
308 \metax{visit file}{Mouse_Button_2}
309 \metax{popup menu}{Control-Mouse_Button_3}
310
311 \section{Immediate Actions on Files}
312
313 \key{visit current file}{f}
314 \key{view current file}{v}
315 \key{visit current file in other window}{o}
316 \key{visit current file in other frame}{w}
317 \key{display current file}{C-u o}
318 \key{create a new subdirectory}{+}
319 \key{compare file at point with the one at mark}{=}
320
321 \section{Marking and Unmarking Files}
322
323 \key{mark a file or subdirectory for later commands}{m}
324 \key{unmark a file or all files of a subdirectory}{u}
325 \key{unmark all marked files in a buffer}{M-delete}
326 \key{mark files with a given extension}{* .}
327 \key{mark all directories}{* /}
328 \key{mark all symlinks}{* @}
329 \key{mark all executables}{* *}
330 \key{invert marking}{* t}
331 \key{mark all files in the current subdir}{* s}
332 \key{mark file names matching a regular expression}{* \%}
333 \key{change the marks to a different character}{* c}
334 \key{mark files for which Elisp expression returns t}{* ( \dx}
335
336 \section{Modifying the Dired Buffer}
337
338 \key{insert a subdirectory into this buffer}{i}
339 \key{remove marked files from the listing}{k}
340 \key{remove a subdir listing}{C-u k}
341 \key{re-read all directories (retains all marks)}{g}
342 \key{toggle sorting of current subdir by name/date}{s}
343 \key{edit ls switches}{C-u s}
344 \key{recover marks, hidden lines, and such}{C-_}
345 \key{hide all subdirectories}{M-\$}
346 \key{hide or unhide subdirectory}{\$}
347
348 \section{Commands on Files Marked or Specified by the Prefix}
349
350 \key{copy file(s)}{C}
351 \key{rename a file or move files to another directory}{R}
352 \key{change ownership of file(s)}{O}
353 \key{change the group of the file(s)}{G}
354 \key{change mode of file(s)}{M}
355 \key{print file(s)}{P}
356 \key{convert filename(s) to lower case}{\% l}
357 \key{convert filename(s) to upper case}{\% u}
358 \key{delete marked (as opposed to flagged) files}{X}
359 \key{uuencode or uudecode file(s)}{U}
360 \key{compress or uncompress file(s)}{Z}
361 \key{run info on file}{I \dx}
362 \key{make symbolic link(s)}{S}
363 \key{make relative symbolic links}{Y}
364 \key{make hard link(s)}{H}
365 \key{search files for a regular expression}{A}
366 \key{query replace regular expression}{Q}
367 \key{byte-compile files}{B}
368 \key{load files}{L}
369 \key{shell command on file(s)}{!}
370
371 \section{Flagging Files for Deletion}
372 \leftline{\bf Unmark commands remove delete flags}
373 \key{flag file for deletion}{d}
374 \key{backup and remove deletion flag}{delete}
375 \key{flag all backup files (file names ending in \~{})}{\~{}}
376 \key{flag all auto-save files}{\#}
377 \key{flag various intermediate files}{\&}
378 \key{flag numeric backups (ending in .\~{}1\~{}, .\~{}2\~{}, etc.)}{.}
379 \key{execute the deletions requested (flagged files)}{x}
380 \key{flag files matching a regular expression}{\% d}
381
382 \section{Regular Expression Commands}
383
384 \key{mark filenames matching a regular expression}{\% m}
385 \key{copy marked files by regexp}{\% C}
386 \key{rename marked files by regexp}{\% R}
387 \key{hardlink}{\% H}
388 \key{symlink}{\% S}
389 \key{symlink, with relative paths}{\% Y}
390 \key{mark for deletion}{\% d}
391
392 \section{Dired and Find}
393 \metax{dired file(s) whose name matches a pattern}{M-x find-name-dired}
394 \metax{dired file(s) that contain pattern}{M-x find-grep-dired}
395 \metax{dired file(s) based on \kbd{find} output}{M-x find-dired}
396
397 \section{Getting Help}
398
399 \key{dired help}{h}
400 \key{dired summary (short help) and error log}{?}
401
402 \copyrightnotice
403
404 \bye
405
406 % arch-tag: 483e7bb4-4576-4733-9fca-0eae1c861484