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