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