cmake: supernova - missing include_directories() for Jack
[supercollider.git] / Help / Linux / EmacsEditor.html
blob80b1a43f35b7f24be3cd685f6037976f7c300746
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
4 <head>
5 <title>Emacs Editor</title>
6 <meta name="GENERATOR" content="Quanta Plus">
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
8 </head>
9 <body>
11 <h1>The Emacs Editor</h1>
13 Here is a more extensive and elaborate overview of useful shortcuts in the Emacs Editor.
14 For a general reference to Emacs shortcut, check out this <A href="http://lpn.rnbhq.org/tools/xemacs/emacs_ref.html">Emacs reference</A>.
16 <TABLE>
17 <tbody valign="top">
18 <tr><td>C-g</td><td>Abort current action</td></tr>
19 <tr><td>C-h</td><td>General help on emacs</td></tr>
20 <tr><td colspan="2" align="center"><strong>Interpreting code</strong></td></tr>
21 <tr><td>C-c C-d<br>(C-c C-c)</td><td>Interpret Selection <br>(only if transient-mark-mode is on)</td></tr>
22 <tr><td>C-c C-c</td><td>Interpret current line</td></tr>
23 <tr><td>C-c C-e</td><td>Evaluate expression (in minibuffer)</td></tr>
24 <tr><td>C-M-x</td><td>Interpret defun</td></tr>
25 <tr><td>C-c C-f</td><td>Interpret current document</td></tr>
27 <tr><td colspan="2" align="center"><strong>Control the interpreter</strong></td></tr>
28 <tr><td>C-c C-s</td><td>Stop (CmdPeriod) / Main.stop</td></tr>
29 <tr><td>C-c C-r</td><td>Main.run</td></tr>
30 <tr><td>C-c C-l</td><td>Recompile library</td></tr>
31 <tr><td>M-x sclang-stop</td><td>Stop interpreter</td></tr>
32 <tr><td>C-c C-p p</td><td>Show server panels</td></tr>
34 <tr><td colspan="2" align="center"><strong>Postbuffer and workspace</strong></td></tr>
35 <tr><td>C-c C-w</td><td>Switch to workspace</td></tr>
36 <tr><td>C-c &lt;</td><td>Clear postbuffer</td></tr>
37 <tr><td>C-c &gt;</td><td>Show postbuffer</td></tr>
39 <tr><td colspan="2" align="center"><strong>Help files</strong></td></tr>
40 <tr><td>C-M-h</td><td>Show help browser</td></tr>
41 <tr><td>C-c C-h</td><td>Open help file. You do not need to select a word before using the shortcut. It will suggest the word at the current cursor position, or lets you type a word in the minibuffer. There is autocompletion by typing &lt;TAB&gt;.</td></tr>
42 <tr><td>E</td><td>(in the help browser) open the help file as plain text (in sclang-mode), so it can be edited.</td></tr>
43 <tr><td>C-c C-v</td><td>(in the help browser) edit the help file as html code.</td></tr>
45 <tr><td colspan="2" align="center"><strong>Finding things in class source files</strong></td></tr>
46 <tr><td>C-c :</td><td>Find definitions (method or class). Again, you can type the word you want to look for in the minibuffer and it suggests the word at the current cursor position.</td></tr>
47 <tr><td>C-c ;</td><td>Find references to (method or class). (ditto)</td></tr>
48 <tr><td>C-c C-k</td><td>Open current file at the svn development path location. You need to have set the devpath variable in Platform for this to work properly, e.g.<br>
49 thisProcess.platform.devpath = "~/svn/SuperCollider3".standardizePath;
50 </td></tr>
52 <tr><td colspan="2" align="center"><strong>Current code completion and interface</strong></td></tr>
53 <tr><td>C-c [</td><td>Dump interface</td></tr>
54 <tr><td>C-c {</td><td>Dump full interface</td></tr>
55 <tr><td>C-c C-m / C-c RET</td><td>Show method arguments (in minibuffer)</td></tr>
56 <tr><td>C-c C-n / M-TAB</td><td>Autocomplete keyword (either puts in the one possible completion, or pops up a buffer with possibilities from which you can choose one)</td></tr>
59 <tr><td colspan="2" align="center"><strong>Files and buffers</strong></td></tr>
60 <tr><td>C-x C-f</td><td>Open file or new file</td></tr>
61 <tr><td>C-x C-s</td><td>Save file</td></tr>
62 <tr><td>C-x C-w</td><td>Save file as</td></tr>
63 <tr><td>C-x C-v</td><td>Open another file in this buffer</td></tr>
64 <tr><td>C-x i</td><td>Insert a file at cursor position</td></tr>
65 <tr><td>C-x b</td><td>Create/switch buffers</td></tr>
66 <tr><td>C-x C-b</td><td>Show buffer list</td></tr>
67 <tr><td>C-x k</td><td>Kill buffer</td></tr>
68 <tr><td>C-z</td><td>Suspend emacs</td></tr>
69 <tr><td>C-x C-c</td><td>Close down emacs</td></tr>
71 <tr><td colspan="2" align="center"><strong>Undo and recovery</strong></td></tr>
72 <tr><td>C-x u / C-_</td><td>Undo</td></tr>
73 <tr><td>C-x u / C-_</td><td>Redo</td></tr>
74 <tr><td>M-x revert-buffer RETURN</td><td>undo all changes since last save</td></tr>
75 <tr><td>M-x recover-file RETURN</td><td>Recover text from an autosave-file</td></tr>
76 <tr><td>M-x recover-session RETURN</td><td>Recover text from an autosave-files if you edited several files</td></tr>
79 <tr><td colspan="2" align="center"><strong>Editing</strong></td></tr>
80 <tr><td>M-w</td><td>Copy</td></tr>
81 <tr><td>C-y</td><td>Paste</td></tr>
82 <tr><td>C-w</td><td>Cut</td></tr>
83 <tr><td>C-x C-o</td><td>Delete blank lines</td></tr>
85 <tr><td colspan="2" align="center"><strong>Search and replace</strong></td></tr>
86 <tr><td>C-s</td><td>Search / find. This allows you to set a string in the mini-buffer. The occurences in the text will be highlighted and you can press C-s again and again to jump to next occurences</td></tr>
87 <tr><td>C-r</td><td>Search / find backwards.</td></tr>
88 <tr><td>M-%</td><td>Replace and find next</td></tr>
89 <tr><td>M-,</td><td>Replace</td></tr>
91 <tr><td colspan="2" align="center"><strong>Navigating and selecting</strong></td></tr>
92 <tr><td>M-g g</td><td>Goto line ...</td></tr>
93 <tr><td>C-x a</td><td>Select all</td></tr>
95 <tr><TD>C-M-f</TD>
96 <TD>zips you forward to matching parenthesis, so if you hover over the opening bracket, hit <br>
97 C-&lt;space&gt;, C-M-f, C-c C-c you can quickly execute a block.
98 </TD></TR>
100 <tr><TD>C-M-b</TD>
101 <TD>zips you backward to matching parenthesis. If you are just to the right of
102 closing brackets this is handier if you've just finished some code.
103 </TD></TR>
105 <tr><td>
106 C-f</td><td> Move forward a character
107 </td></tr>
108 <tr><td>
109 C-b</td><td>Move backward a character
110 </td></tr>
111 <tr><td>
112 M-f</td><td>Move forward a word
113 </td></tr>
114 <tr><td>
115 M-b</td><td>Move backward a word
116 </td></tr>
117 <tr><td>
118 C-n</td><td>Move to next line
119 </td></tr>
120 <tr><td>
121 C-p</td><td>Move to previous line
122 </td></tr>
123 <tr><td>
124 C-a</td><td>Move to beginning of line
125 </td></tr>
126 <tr><td>
127 C-e</td><td>Move to end of line
128 </td></tr>
129 <tr><td>
130 M-a</td><td>Move back to beginning of sentence
131 </td></tr>
132 <tr><td>
133 M-e</td><td>Move forward to end of sentence
134 </td></tr>
135 <tr><td>
138 <tr><td colspan="2" align="center"><strong>Formatting</strong></td></tr>
139 <tr><td> M-x show-paren-mode</td><td>Paren match highlighting. Can also be set from the options menu.</td></tr>
140 <tr><td>M-;</td><td>Add comment. If you have a text selected, then that text will become a comment. It will remove the commenting // when you have selected a commented text.</td></tr>
141 <tr><td>C-M-j</td><td>Continue the comment on the next line.</td></tr>
142 <tr><td>C-u M-;</td><td>Remove comment. This removes the whole comment, so also the text!</td></tr>
143 <tr><td>M-x comment-region</td><td>Comments the selected region</td></tr>
144 <tr><td>M-x uncomment-region</td><td>Uncomments the selected region</td></tr>
145 <tr><td>TAB</td><td>Auto-aligns tabs according to code.</td></tr>
146 </tbody>
147 </TABLE>
149 <h2>Marks</h2>
150 (info from EmacsWiki)
152 <p><strong>set-mark-command (`C-SPC')</strong><br>
154 A nice feature that not all know about is what happens if you feed it with a universal argument: ‘C-u C-SPC’. It’s an easy way to navigate back to your previous editing spots by jumping to the positions stored in the buffer’s local mark ring. Repeated calls will cycle through the ring of marks.
155 </p><p>
156 If you use TransientMarkMode and you want to set the mark but don’t want to subsequently see the region highlighting, you can use ‘C-SPC C-g’ to set the mark and then deactivate it.
157 </p>
158 <p><strong>pop-global-mark (`C-x C-SPC')</strong><br>
160 In addition to the ordinary mark ring that belongs to each buffer, Emacs has a single global mark ring. It records a sequence of buffers in which you have recently set the mark, so you can go back to those buffers.</p>
162 Setting the mark always makes an entry on the current buffer’s mark ring. If you have switched buffers since the previous mark setting, the new mark position makes an entry on the global mark ring also. The result is that the global mark ring records a sequence of buffers that you have been in, and, for each buffer, a place where you set the mark.
163 </p><p>
164 ‘C-x C-SPC’ (‘pop-global-mark’) jumps to the buffer and position of the latest entry in the global mark ring. It also rotates the ring, so that successive uses of ‘C-x C-SPC’ take you to earlier and earlier buffers.
165 </p>
166 <h2>Customsing Emacs' behaviour</h2>
168 You can customize the behaviour of Emacs, by putting things in the startup file of emacs. This file is <code>~/.emacs</code>.
170 You can define options there, for example:
171 </p>
172 <pre>
173 (custom-set-variables
174 '(case-fold-search t)
175 '(global-font-lock-mode t nil (font-lock))
176 '(sclang-runtime-directory "~/SuperCollider/")
177 '(show-paren-mode t nil (paren))
178 '(transient-mark-mode t)
180 </pre>
182 <code>nil</code> means that an option is turned off, <code>t</code> or <code>1</code> means that it is turned on.
184 <TABLE>
185 <tr><td><code>'(sclang-eval-line-forward nil)</code></td><td>Configure the text cursor NOT to move after hitting C-c C-c</td></tr>
186 </TABLE>
188 <h3>Customize w3m</h3>
190 Normally w3m uses the arrow keys to jump between hyperlinks. For browsing SC help files this is not very useful.
192 <pre>
193 (eval-after-load "w3m"
194 '(progn
195 (define-key w3m-mode-map [left] 'backward-char)
196 (define-key w3m-mode-map [right] 'forward-char)
197 (define-key w3m-mode-map [up] 'previous-line)
198 (define-key w3m-mode-map [down] 'next-line)
199 (setq w3m-auto-show 1)
201 </pre>
203 <h3>Automatically complete brackets and parentheses</h3>
204 <pre>
205 (setq skeleton-pair t)
206 (global-set-key (kbd "(") 'skeleton-pair-insert-maybe)
207 (global-set-key (kbd "{") 'skeleton-pair-insert-maybe)
208 (global-set-key (kbd "[") 'skeleton-pair-insert-maybe)
209 (global-set-key (kbd "\"") 'skeleton-pair-insert-maybe)
210 (global-set-key (kbd "'") 'skeleton-pair-insert-maybe)
211 </pre>
213 <h3>Scrollwheel support</h3>
214 <pre>
215 ;;; scrollwheel support
216 (defun scroll-up-half ()
217 "Scroll up half a page."
218 (interactive)
219 (scroll-up (/ (window-height) 2))
222 (defun scroll-down-half ()
223 "Scroll down half a page."
224 (interactive)
225 (scroll-down (/ (window-height) 2))
227 (global-set-key [(mouse-5)] 'scroll-up-half)
228 (global-set-key [(mouse-4)] 'scroll-down-half)
229 </pre>
232 <h3>Recent files menu</h3>
234 Recentf is a minor mode that builds a list of recently opened files. This list is is automatically saved across Emacs sessions. You can then access this list through a menu.
235 Put this in your `~/.emacs’:</p>
236 <pre>
237 (require 'recentf)
238 (recentf-mode 1)
239 </pre>
243 For adding a shortcut (C-x C-r) to open a recent file add this code as well:
244 </p>
245 <pre>
246 (defun recentf-open-files-compl ()
247 (interactive)
248 (let* ((all-files recentf-list)
249 (tocpl (mapcar (function
250 (lambda (x) (cons (file-name-nondirectory x) x))) all-files))
251 (prompt (append '("File name: ") tocpl))
252 (fname (completing-read (car prompt) (cdr prompt) nil nil)))
253 (find-file (cdr (assoc-ignore-representation fname tocpl)))))
255 (global-set-key "\C-x\C-r" 'recentf-open-files-compl)
256 </pre>
259 <h2>More info on Emacs</h2>
260 <A href="http://www.emacswiki.org/cgi-bin/wiki">Emacs Wiki</A>
261 </body>
262 </html>