101
edits
No edit summary |
(A. basic techniques for editing ascii diagrams in Emacs) |
||
Line 1: | Line 1: | ||
Out of curiousity how did you generate that flow chart? Did you do the ascii chart by hand? | <dl> | ||
<dt>Q. Out of curiousity how did you generate that flow chart? Did you do the ascii chart by hand?</dt> | |||
<dd> | |||
Some simple Emacs techniques eased some of the work. | |||
[Emacs command syntax: | |||
* C-x means Ctrl-x. C-x is a prefix key for eXtended commands. | |||
* M-x means Meta-x [Alt-x on windows keyboards]. Meta-x allows you to type the name of an extended command. | |||
* C-c means Ctrl-c. C-c is a prefix key for special modes like picture-mode. (type carefully: x is next to c, and C-x C-c saves buffers and exits emacs). | |||
* M-Sh-> means hold both meta (alt) and shift key while typing > key. | |||
] | |||
1. Emacs picture-mode can be useful: it is like overwrite-mode, but you can pick what direction the cursor moves after typing each visible character so it is easier to type lines. | |||
M-x picture-mode | |||
Once in picture mode, do | |||
C-h m | |||
for mode help. | |||
Note: some commands have (parenthesized variant behavior) if given numeric argument: | |||
C-u command | |||
2. In picture mode, you can save/yank rectangles of text to kill ring: | |||
C-space to set mark at one corner. | |||
Navigate to opposite corner. | |||
C-c C-k. | |||
Yank it back from kill ring overwriting with C-c C-y. | |||
Yang it back from kill ring inserting with C-u C-c C-y | |||
(C-u adds a numeric arg 4). | |||
3. Also, can use temporary macros to insert or delete columns of text (exit picture-mode first: C-c C-c). | |||
Example: to insert two spaces and |, backup 3 characters, next line: | |||
define macro: C-x ( <space> <space> | C-b C-b C-b C-n C-x ) | |||
execute macro: C-x e [release control key before typing e] | |||
use numeric prefix to execute macro multiple times: | |||
execute macro 10 times: C-1 C-0 C-x e | |||
execute macro 16 times: C-u C-u c-x e | |||
4. To replace all tabs with spaces: | |||
navigate to top of buffer: M-Sh-< | |||
set mark: c-space | |||
navigate to bottom of buffer: M-Sh-> | |||
untabify region: M-x untabify | |||
</dd> | |||
</dl> |
edits