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