Mercurial > hg > xemacs-beta
comparison man/vhdl-mode.texi @ 10:49a24b4fd526 r19-15b6
Import from CVS: tag r19-15b6
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:47:52 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:6f2bbbbbe05a | 10:49a24b4fd526 |
---|---|
1 \input texinfo @c -*- texinfo -*- | |
2 | |
3 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
4 @comment %**start of header (This is for running Texinfo on a region) | |
5 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
6 | |
7 @setfilename vhdl-mode.info | |
8 @settitle VHDL-MODE Version 2 Documentation | |
9 @footnotestyle end | |
10 | |
11 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
12 @comment @setchapternewpage odd !! we don't want blank pages !! | |
13 @comment %**end of header (This is for running Texinfo on a region) | |
14 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
15 | |
16 | |
17 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
18 @comment | |
19 @comment texinfo manual for @file{vhdl-mode.el} version 2 | |
20 @comment manual version: 2.1 | |
21 @comment adapted from the cc-mode texinfo manual by Barry A. Warsaw | |
22 @comment <bwarsaw@cnri.reston.va.us> | |
23 @comment | |
24 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
25 | |
26 | |
27 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
28 @comment The following line inserts the copyright notice | |
29 @comment into the Info file. | |
30 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
31 | |
32 @ifinfo | |
33 Copyright @copyright{} 1995 Rodney J. Whitby | |
34 @end ifinfo | |
35 | |
36 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
37 @comment !!!The titlepage section does not appear in the Info file.!!! | |
38 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
39 | |
40 @titlepage | |
41 @sp 10 | |
42 | |
43 | |
44 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
45 @comment The title is printed in a large font. | |
46 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
47 | |
48 @center @titlefont{VHDL-MODE Version 2} | |
49 @sp 2 | |
50 @center A GNU Emacs mode for editing VHDL code. | |
51 @center (manual revision: 2.1) | |
52 @sp 2 | |
53 @center Rod Whitby | |
54 @center @code{rwhitby@@asc.corp.mot.com} | |
55 | |
56 | |
57 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
58 @comment The following two commands start the copyright page | |
59 @comment for the printed manual. This will not appear in the Info file. | |
60 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
61 | |
62 @page | |
63 @vskip 0pt plus 1filll | |
64 Copyright @copyright{} 1995 Rodney J. Whitby | |
65 @end titlepage | |
66 | |
67 | |
68 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
69 @comment The Top node contains the master menu for the Info file. | |
70 @comment This appears only in the Info file, not the printed manual. | |
71 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
72 | |
73 @node Top, Introduction, (dir), (dir) | |
74 @comment node-name, next, previous, up | |
75 | |
76 | |
77 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
78 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
79 | |
80 @menu | |
81 * Introduction:: | |
82 * Getting Connected:: | |
83 * New Indentation Engine:: | |
84 * Customizing Indentation:: | |
85 * Syntactic Symbols:: | |
86 * Indentation Commands:: | |
87 * Frequently Asked Questions:: | |
88 * Getting the latest vhdl-mode release:: | |
89 * Sample .emacs File:: | |
90 * Requirements:: | |
91 * Limitations and Known Bugs:: | |
92 * Mailing Lists and Submitting Bug Reports:: | |
93 * Concept Index:: | |
94 * Command Index:: Command Index | |
95 * Key Index:: Key Index | |
96 * Variable Index:: Variable Index | |
97 @end menu | |
98 | |
99 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
100 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
101 | |
102 @node Introduction, Getting Connected, Top, Top | |
103 @comment node-name, next, previous, up | |
104 @chapter Introduction | |
105 @cindex Introduction | |
106 | |
107 Welcome to @code{vhdl-mode}, version 2. This is a GNU Emacs mode for | |
108 editing files containing VHDL code. | |
109 | |
110 This manual will describe the following: | |
111 | |
112 @itemize @bullet | |
113 @item | |
114 How to get started using @code{vhdl-mode}. | |
115 | |
116 @item | |
117 How the new indentation engine works. | |
118 | |
119 @item | |
120 How to customize the new indentation engine. | |
121 | |
122 @end itemize | |
123 | |
124 @findex vhdl-version | |
125 The major version number was incremented to 2 with the addition of the | |
126 new indentation engine. To find the minor revision number of this | |
127 release, use @kbd{M-x vhdl-version RET}. | |
128 | |
129 A special word of thanks goes to Barry Warsaw, who wrote the | |
130 @code{cc-mode} indentation engine that formed the basis of the | |
131 @code{vhdl-mode} indentation engine. This manual is also based upon the | |
132 manual for @code{cc-mode}. | |
133 | |
134 | |
135 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
136 | |
137 @node Getting Connected, New Indentation Engine, Introduction, Top | |
138 @comment node-name, next, previous, up | |
139 @chapter Getting Connected | |
140 @cindex Getting Connected | |
141 | |
142 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
143 | |
144 @file{vhdl-mode.el} works well with the 3 main branches of Emacs 19: | |
145 XEmacs, Win-Emacs (which has the same heritage as XEmacs) and the Emacs | |
146 19 maintained by the FSF. FSF's Emacs 19 users will want to use Emacs | |
147 version 19.21 or better, Win-Emacs users will want 1.35 or better, and | |
148 XEmacs users will want 19.6 or better. Earlier versions of these | |
149 Emacsen have deficiencies and/or bugs which will adversely affect the | |
150 performance and usability of @code{vhdl-mode}. | |
151 | |
152 @cindex .emacs file | |
153 The first thing you will want to do is put @file{vhdl-mode.el} somewhere | |
154 on your @code{load-path} so Emacs can find it. Do a @kbd{C-h v | |
155 load-path RET} to see all the directories Emacs looks at when loading a | |
156 file. If none of these directories are appropriate, create a new | |
157 directory and add it to your @code{load-path}: | |
158 | |
159 @noindent | |
160 @emph{[in the shell]} | |
161 @example | |
162 @group | |
163 | |
164 % cd | |
165 % mkdir mylisp | |
166 % mv vhdl-mode.el mylisp | |
167 % cd mylisp | |
168 | |
169 @end group | |
170 @end example | |
171 | |
172 @noindent | |
173 @emph{[in your .emacs file add]} | |
174 @example | |
175 | |
176 (setq load-path (cons "~/mylisp" load-path)) | |
177 | |
178 @end example | |
179 | |
180 @cindex byte compile | |
181 Next you want to @dfn{byte compile} @file{vhdl-mode.el}. The mode uses a | |
182 lot of macros so if you don't byte compile it, things will be unbearably | |
183 slow. @emph{You can ignore all byte-compiler warnings!} They are the | |
184 result of the supporting different versions of Emacs, and none of the | |
185 warnings have any effect on operation. Let me say this again: | |
186 @strong{You really can ignore all byte-compiler warnings!} | |
187 | |
188 Here's what to do to byte-compile the file [in emacs]: | |
189 @example | |
190 | |
191 M-x byte-compile-file RET ~/mylisp/vhdl-mode.el RET | |
192 | |
193 @end example | |
194 | |
195 Now add the following autoloads to your @file{.emacs} file so that | |
196 @code{vhdl-mode} gets loaded at the right time: | |
197 @example | |
198 | |
199 (autoload 'vhdl-mode "vhdl-mode" "VHDL Editing Mode" t) | |
200 | |
201 @end example | |
202 | |
203 Alternatively, if you want to make sure @code{vhdl-mode} is loaded when | |
204 Emacs starts up, you could use this line instead of the autoload above: | |
205 @example | |
206 | |
207 (require 'vhdl-mode) | |
208 | |
209 @end example | |
210 | |
211 Next, you will want to set up Emacs so that it edits VHDL files in | |
212 @code{vhdl-mode}. All users should add the following to their | |
213 @file{.emacs} file. Note that this assumes you'll be editing @code{.vhd} | |
214 and files as VHDL. YMMV: | |
215 @example | |
216 @group | |
217 | |
218 (setq auto-mode-alist | |
219 (append | |
220 '(("\\.vhd$" . vhdl-mode) | |
221 ) auto-mode-alist)) | |
222 | |
223 @end group | |
224 @end example | |
225 | |
226 That's all you need -- I know, I know, it sounds like a lot @code{:-)}, | |
227 but after you've done all this, you should only need to quit and restart | |
228 Emacs. The next time you visit a VHDL file you should be using | |
229 @code{vhdl-mode}. You can check this easily by hitting @kbd{M-x | |
230 vhdl-version RET} in the @code{vhdl-mode} buffer. You should see this | |
231 message in the echo area: | |
232 @example | |
233 | |
234 Using @code{vhdl-mode} version 2.@var{XXX} | |
235 | |
236 @end example | |
237 | |
238 @noindent | |
239 where @var{XXX} will be some minor revision number. | |
240 | |
241 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
242 | |
243 @node New Indentation Engine, Indentation Commands, Getting Connected, Top | |
244 @comment node-name, next, previous,up | |
245 | |
246 @chapter New Indentation Engine | |
247 @cindex New Indentation Engine | |
248 | |
249 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
250 | |
251 @code{vhdl-mode} has a new indentation engine, providing a simplified, yet | |
252 flexible and general mechanism for customizing indentation. It breaks | |
253 indentation calculation into two steps. First for the line of code being | |
254 indented, @code{vhdl-mode} analyzes what kind of language construct it's | |
255 looking at, then it applies user defined offsets to the current line | |
256 based on this analysis. | |
257 | |
258 This section will briefly cover how indentation is calculated in | |
259 @code{vhdl-mode}. It is important to understand the indentation model | |
260 being used so that you will know how to customize @code{vhdl-mode} for | |
261 your personal coding style. | |
262 | |
263 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
264 @menu | |
265 * Syntactic Analysis:: Step 1 -- Syntactic Analysis | |
266 * Indentation Calculation:: Step 2 -- Indentation Calculation | |
267 @end menu | |
268 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
269 | |
270 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
271 @node Syntactic Analysis, Indentation Calculation, , New Indentation Engine | |
272 @comment node-name, next, previous,up | |
273 @section Syntactic Analysis | |
274 @cindex Syntactic Analysis | |
275 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
276 | |
277 @vindex vhdl-offsets-alist | |
278 @vindex offsets-alist (vhdl-) | |
279 @cindex relative buffer position | |
280 @cindex syntactic symbol | |
281 @cindex syntactic component | |
282 @cindex syntactic component list | |
283 @cindex relative buffer position | |
284 The first thing @code{vhdl-mode} does when indenting a line of code, is | |
285 to analyze the line, determining the @dfn{syntactic component list} of | |
286 the construct on that line. A @dfn{syntactic component} consists of a | |
287 pair of information (in lisp parlance, a @emph{cons cell}), where the | |
288 first part is a @dfn{syntactic symbol}, and the second part is a | |
289 @dfn{relative buffer position}. Syntactic symbols describe elements of | |
290 VHDL code, e.g. @code{statement}, @code{comment}, @code{block-open}, | |
291 @code{block-close}, etc. @xref{Syntactic Symbols}, for a complete list | |
292 of currently recognized syntactic symbols and their semantics. Also, | |
293 the variable @code{vhdl-offsets-alist} contains the list of currently | |
294 supported syntactic symbols. | |
295 | |
296 Conceptually, a line of VHDL code is always indented relative to the | |
297 indentation of some line higher up in the buffer. This is represented | |
298 by the relative buffer position in the syntactic component. | |
299 | |
300 It might help to see an example. Suppose we had the following code as | |
301 the only thing in a @code{vhdl-mode} buffer @footnote{The line numbers | |
302 in this and future examples don't actually appear in the buffer.}: | |
303 @example | |
304 @group | |
305 | |
306 1: inverter : process | |
307 2: begin | |
308 3: q <= not d; | |
309 4: wait on d; | |
310 5: end inverter; | |
311 | |
312 @end group | |
313 @end example | |
314 | |
315 @kindex C-c C-s | |
316 @findex vhdl-show-syntactic-information | |
317 @findex show-syntactic-information (vhdl-) | |
318 We can use the command @kbd{C-c C-s} | |
319 (@code{vhdl-show-syntactic-information}) to simply report what the | |
320 syntactic analysis is for the current line. Running this command on | |
321 line 4 of example 1, we'd see in the echo area: | |
322 @example | |
323 | |
324 ((statement . 28)) | |
325 | |
326 @end example | |
327 | |
328 This tells us that the line is a statement and it is indented relative | |
329 to buffer position 28, which happens to be the @samp{q} on line 3. If | |
330 you were to move point to line 3 and hit @kbd{C-c C-s}, you would see: | |
331 @example | |
332 | |
333 ((statement-block-intro . 20)) | |
334 | |
335 @end example | |
336 | |
337 This indicates that line 3 is the first statement in a block, and is | |
338 indented relative to buffer position 20, which is the @samp{b} in the | |
339 @code{begin} keyword on line 2. | |
340 | |
341 @cindex comment only line | |
342 Syntactic component lists can contain more than one component, and | |
343 individual syntactic compenents need not have relative buffer positions. | |
344 The most common example of this is a line that contains a @dfn{comment | |
345 only line}. | |
346 @example | |
347 @group | |
348 | |
349 %%% TBD %%% | |
350 | |
351 @end group | |
352 @end example | |
353 | |
354 @noindent | |
355 Hitting @kbd{C-c C-s} on line 3 of the example gives us: | |
356 @example | |
357 | |
358 ((comment-intro) (block-intro . 46)) | |
359 | |
360 @end example | |
361 | |
362 @noindent | |
363 so you can see that the syntactic component list contains two syntactic | |
364 components. Also notice that the first component, | |
365 @samp{(comment-intro)} has no relative buffer position. | |
366 | |
367 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
368 @node Indentation Calculation, , Syntactic Analysis, New Indentation Engine | |
369 @comment node-name, next, previous,up | |
370 @section Indentation Calculation | |
371 @cindex Indentation Calculation | |
372 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
373 | |
374 @vindex vhdl-offsets-alist | |
375 @vindex offsets-alist (vhdl-) | |
376 Indentation for the current line is calculated using the syntactic | |
377 component list derived in step 1 above (see @ref{Syntactic | |
378 Analysis}). Each component contributes to the final total indentation | |
379 of the line in two ways. | |
380 | |
381 First, the syntactic symbols are looked up in the @code{vhdl-offsets-alist} | |
382 variable, which is an association list of syntactic symbols and the | |
383 offsets to apply for those symbols. These offsets are added to the | |
384 running total. | |
385 | |
386 Second, if the component has a relative buffer position, @code{vhdl-mode} | |
387 adds the column number of that position to the running total. By adding | |
388 up the offsets and columns for every syntactic component on the list, | |
389 the final total indentation for the current line is computed. | |
390 | |
391 Let's use our code example above to see how this works. Here is our | |
392 example again. | |
393 @example | |
394 @group | |
395 | |
396 1: inverter : process | |
397 2: begin | |
398 3: q <= not d; | |
399 4: wait on d; | |
400 5: end inverter; | |
401 | |
402 @end group | |
403 @end example | |
404 | |
405 @kindex TAB | |
406 Let's say point is on line 3 and we hit the @key{TAB} key to re-indent | |
407 the line. Remember that the syntactic component list for that | |
408 line is: | |
409 @example | |
410 | |
411 ((statement-block-intro . 20)) | |
412 | |
413 @end example | |
414 | |
415 @noindent | |
416 @code{vhdl-mode} looks up @code{statement-block-intro} in the | |
417 @code{vhdl-offsets-alist} variable. Let's say it finds the value @samp{2}; | |
418 it adds this to the running total (initialized to zero), yielding a | |
419 running total indentation of 2 spaces. | |
420 | |
421 Next @code{vhdl-mode} goes to buffer position 20 and asks for the | |
422 current column. Since the @code{begin} keyword at buffer position 20 is | |
423 in column zero, it adds @samp{0} to the running total. Since there is | |
424 only one syntactic component on the list for this line, indentation | |
425 calculation is complete, and the total indentation for the line is 2 | |
426 spaces. | |
427 Simple, huh? | |
428 | |
429 Actually, the mode usually just does The Right Thing without you having | |
430 to think about it in this much detail. But when customizing | |
431 indentation, it's helpful to understand the general indentation model | |
432 being used. | |
433 | |
434 @vindex vhdl-echo-syntactic-information-p | |
435 @vindex echo-syntactic-information-p (vhdl-) | |
436 @cindex TAB | |
437 To help you configure @code{vhdl-mode}, you can set the variable | |
438 @code{vhdl-echo-syntactic-information-p} to non-@code{nil} so that the | |
439 syntactic component list and calculated offset will always be echoed in | |
440 the minibuffer when you hit @kbd{TAB}. | |
441 | |
442 | |
443 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
444 @node Indentation Commands, Customizing Indentation, New Indentation Engine, Top | |
445 @comment node-name, next, previous,up | |
446 | |
447 @chapter Indentation Commands | |
448 @cindex Indentation Commands | |
449 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
450 | |
451 @strong{<TBD>} | |
452 | |
453 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
454 @node Customizing Indentation, Syntactic Symbols, Indentation Commands, Top | |
455 @comment node-name, next, previous,up | |
456 | |
457 @chapter Customizing Indentation | |
458 @cindex Customizing Indentation | |
459 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
460 | |
461 @cindex vhdl-set-offset | |
462 @cindex set-offset (vhdl-) | |
463 The @code{vhdl-offsets-alist} variable is where you customize all your | |
464 indentations. You simply need to decide what additional offset you want | |
465 to add for every syntactic symbol. You can use the command @kbd{C-c | |
466 C-o} (@code{vhdl-set-offset}) as the way to set offsets, both | |
467 interactively and from your mode hook. Also, you can set up | |
468 @emph{styles} of indentation. Most likely, you'll find one of the | |
469 pre-defined styles will suit your needs, but if not, this section will | |
470 describe how to set up basic editing configurations. @xref{Styles} for | |
471 an explanation of how to set up named styles. | |
472 | |
473 @cindex vhdl-basic-offset | |
474 @cindex basic-offset (vhdl-) | |
475 As mentioned previously, the variable @code{vhdl-offsets-alist} is an | |
476 association list between syntactic symbols and the offsets to be applied | |
477 for those symbols. In fact, these offset values can be an integer, a | |
478 function or variable name, or one of the following symbols: @code{+}, | |
479 @code{-}, @code{++}, @code{--}, @code{*}, or @code{/}. The symbol | |
480 values have the following meanings: | |
481 | |
482 @itemize @bullet | |
483 | |
484 @item | |
485 @code{+} -- 1 x @code{vhdl-basic-offset} | |
486 @item | |
487 @code{-} -- -1 x @code{vhdl-basic-offset} | |
488 @item | |
489 @code{++} -- 2 x @code{vhdl-basic-offset} | |
490 @item | |
491 @code{--} -- -2 x @code{vhdl-basic-offset} | |
492 @item | |
493 @code{*} -- 0.5 x @code{vhdl-basic-offset} | |
494 @item | |
495 @code{/} -- -0.5 x @code{vhdl-basic-offset} | |
496 | |
497 @end itemize | |
498 | |
499 @noindent | |
500 So, for example, because most of the default offsets are defined in | |
501 terms of @code{+}, @code{-}, and @code{0}, if you like the general | |
502 indentation style, but you use 2 spaces instead of 4 spaces per level, | |
503 you can probably achieve your style just by changing | |
504 @code{vhdl-basic-offset} like so (in your @file{.emacs} file): | |
505 @example | |
506 | |
507 (setq vhdl-basic-offset 2) | |
508 | |
509 @end example | |
510 | |
511 To change indentation styles more radically, you will want to change the | |
512 value associated with the syntactic symbols in the | |
513 @code{vhdl-offsets-alist} variable. First, I'll show you how to do that | |
514 interactively, then I'll describe how to make changes to your | |
515 @file{.emacs} file so that your changes are more permanent. | |
516 | |
517 @menu | |
518 * Interactive Customization:: | |
519 * Permanent Customization:: | |
520 * Styles:: | |
521 * Advanced Customizations:: | |
522 @end menu | |
523 | |
524 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
525 @node Interactive Customization, Permanent Customization, , Customizing Indentation | |
526 @comment node-name, next, previous,up | |
527 | |
528 @section Interactive Customization | |
529 @cindex Interactive Customization | |
530 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
531 | |
532 As an example of how to customize indentation, let's change the | |
533 style of the example above from: | |
534 @example | |
535 @group | |
536 | |
537 1: inverter : process | |
538 2: begin | |
539 3: q <= not d; | |
540 4: wait on d; | |
541 5: end inverter; | |
542 | |
543 @end group | |
544 @end example | |
545 @noindent | |
546 to: | |
547 @example | |
548 @group | |
549 | |
550 1: inverter : process | |
551 2: begin | |
552 3: q <= not d; | |
553 4: wait on d; | |
554 5: end inverter; | |
555 | |
556 @end group | |
557 @end example | |
558 | |
559 In other words, we want to change the indentation of the statments | |
560 inside the inverter process. Notice that the construct we want to | |
561 change starts on line 3. To change the indentation of a line, we need | |
562 to see which syntactic component affect the offset calculations for that | |
563 line. Hitting @kbd{C-c C-s} on line 3 yields: | |
564 @example | |
565 | |
566 ((statement-block-intro . 20)) | |
567 | |
568 @end example | |
569 | |
570 @findex vhdl-set-offset | |
571 @findex set-offset (vhdl-) | |
572 @kindex C-c C-o | |
573 @noindent | |
574 So we know that to change the offset of the first signal assignment, we need to | |
575 change the indentation for the @code{statement-block-intro} syntactic | |
576 symbol. To do this interactively, just hit @kbd{C-c C-o} | |
577 (@code{vhdl-set-offset}). This prompts you for the syntactic symbol to | |
578 change, providing a reasonable default. In this case, the default is | |
579 @code{statement-block-intro}, which is just the syntactic symbol we want to | |
580 change! | |
581 | |
582 After you hit return, @code{vhdl-mode} will then prompt you for the new | |
583 offset value, with the old value as the default. The default in this | |
584 case is @samp{+}, so hit backspace to delete the @samp{+}, then hit | |
585 @samp{++} and @kbd{RET}. This will associate an offset of twice the | |
586 basic indent with the syntactic symbol @code{statement-block-intro} in | |
587 the @code{vhdl-offsets-alist} variable. | |
588 | |
589 @findex vhdl-indent-defun | |
590 @findex indent-defun (vhdl-) | |
591 @kindex C-c C-q | |
592 To check your changes quickly, just hit @kbd{C-c C-q} | |
593 (@code{vhdl-indent-defun}) to reindent the entire function. The example | |
594 should now look like: | |
595 @example | |
596 @group | |
597 | |
598 1: inverter : process | |
599 2: begin | |
600 3: q <= not d; | |
601 4: wait on d; | |
602 5: end inverter; | |
603 | |
604 @end group | |
605 @end example | |
606 | |
607 Notice how just changing the offset on line 3 is all we needed to do. | |
608 Since the other affected lines are indented relative to line 3, they are | |
609 automatically indented the way you'd expect. For more complicated | |
610 examples, this may not always work. The general approach to take is to | |
611 always start adjusting offsets for lines higher up in the file, then | |
612 re-indent and see if any following lines need further adjustments. | |
613 | |
614 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
615 @node Permanent Customization, Styles, Interactive Customization, Customizing Indentation | |
616 @comment node-name, next, previous,up | |
617 | |
618 @section Permanent Indentation | |
619 @cindex Permanent Indentation | |
620 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
621 | |
622 @vindex vhdl-mode-hook | |
623 @cindex hooks | |
624 To make this change permanent, you need to add some lisp code to your | |
625 @file{.emacs} file. @code{vhdl-mode} provides a @code{vhdl-mode-hook} | |
626 that you can use to customize your language editing styles. This hook | |
627 gets run as the last thing when you enter @code{vhdl-mode}. | |
628 | |
629 Here's a simplified example of what you can add to your @file{.emacs} | |
630 file to make the changes described in the previous section | |
631 (@ref{Interactive Customization}) more permanent. See the Emacs | |
632 manuals for more information on customizing Emacs via hooks. | |
633 @xref{Sample .emacs File} for a more complete sample @file{.emacs} file. | |
634 @footnote{The use of @code{add-hook} in this example only works for | |
635 Emacs 19. Workarounds are available if you are using Emacs 18, but this | |
636 just points out another reason for you to upgrade to Emacs 19! | |
637 @code{:-)}} | |
638 @example | |
639 @group | |
640 | |
641 (defun my-vhdl-mode-hook () | |
642 ;; my customizations for all of vhdl-mode | |
643 (vhdl-set-offset 'statement-block-intro '++) | |
644 ;; other customizations can go here | |
645 ) | |
646 (add-hook 'vhdl-mode-hook 'my-vhdl-mode-hook) | |
647 | |
648 @end group | |
649 @end example | |
650 | |
651 For complex customizations, you will probably want to set up a | |
652 @emph{style} that groups all your customizations under a single | |
653 name. @xref{Styles} for details. | |
654 | |
655 The offset value can also be a function, and this is how power users | |
656 gain enormous flexibility in customizing indentation. @xref{Advanced | |
657 Customizations} for details. | |
658 | |
659 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
660 @node Styles, Advanced Customizations, Permanent Customization, Customizing Indentation | |
661 @comment node-name, next, previous,up | |
662 | |
663 @section Styles | |
664 @cindex Styles | |
665 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
666 | |
667 Most people only need to edit code formatted in just a few well-defined | |
668 and consistent styles. For example, their organization might impose a | |
669 ``blessed'' style that all its programmers must conform to. Similarly, | |
670 people who work on GNU software will have to use the GNU coding style on | |
671 C code. Some shops are more lenient, allowing some variety of coding | |
672 styles, and as programmers come and go, there could be a number of | |
673 styles in use. For this reason, @code{vhdl-mode} makes it convenient for | |
674 you to set up logical groupings of customizations called @dfn{styles}, | |
675 associate a single name for any particular style, and pretty easily | |
676 start editing new or existing code using these styles. This chapter | |
677 describes how to set up styles and how to edit your C code using styles. | |
678 | |
679 @menu | |
680 * Built-in Styles:: | |
681 * Adding Styles:: | |
682 * File Styles:: | |
683 @end menu | |
684 | |
685 | |
686 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
687 @node Built-in Styles, Adding Styles, , Styles | |
688 @comment node-name, next, previous,up | |
689 | |
690 @subsection Built-in Styles | |
691 @cindex Built-in Styles | |
692 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
693 | |
694 If you're lucky, one of @code{vhdl-mode}'s built-in styles might be just | |
695 what you're looking for. Some of the most common VHDL styles are | |
696 already built-in. These include: | |
697 | |
698 @itemize @bullet | |
699 @item | |
700 @cindex IEEE style | |
701 @code{GNU} -- the coding style in the IEEE Language Reference Manual. | |
702 | |
703 @end itemize | |
704 | |
705 @findex vhdl-set-style | |
706 @findex set-style (vhdl-) | |
707 If you'd like to experiment with these built-in styles you can simply | |
708 type the following in a @code{vhdl-mode} buffer: | |
709 @example | |
710 @group | |
711 | |
712 @kbd{M-x vhdl-set-style RET}. | |
713 | |
714 @end group | |
715 @end example | |
716 @noindent | |
717 You will be prompted for one of the above styles (with completion). | |
718 Enter one of the styles and hit @kbd{RET}. Note however that setting a | |
719 style in this way does @emph{not} automatically re-indent your file. | |
720 For commands that you can use to view the effect of your changes, see | |
721 @ref{Indentation Commands}. | |
722 | |
723 Once you find a built-in style you like, you can make the change | |
724 permanent by adding a call to your @file{.emacs} file. Let's say for | |
725 example that you want to use the @code{IEEE} style in all your | |
726 files. You would add this: | |
727 @example | |
728 @group | |
729 | |
730 (defun my-vhdl-mode-hook () | |
731 ;; use IEEE style for all VHDL code | |
732 (vhdl-set-style "IEEE") | |
733 ;; other customizations can go here | |
734 ) | |
735 (add-hook 'vhdl-mode-hook 'my-vhdl-mode-hook) | |
736 | |
737 @end group | |
738 @end example | |
739 | |
740 @noindent | |
741 @xref{Permanent Customization}. | |
742 | |
743 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
744 @node Adding Styles, File Styles, Built-in Styles, Styles | |
745 @comment node-name, next, previous,up | |
746 | |
747 @subsection Adding Styles | |
748 @cindex Adding Styles | |
749 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
750 | |
751 @vindex vhdl-style-alist | |
752 @vindex style-alist (vhdl-) | |
753 @findex vhdl-add-style | |
754 @findex add-style (vhdl-) | |
755 If none of the built-in styles is appropriate, you'll probably want to | |
756 add a new style definition. Styles are kept in the @code{vhdl-style-alist} | |
757 variable, but you probably won't want to modify this variable directly. | |
758 @code{vhdl-mode} provides a function, called @code{vhdl-add-style}, that you | |
759 can use to easily add new styles or update existing styles. This | |
760 function takes two arguments, a @var{stylename} string, and an | |
761 association list @var{description} of style customizations. If | |
762 @var{stylename} is not already in @code{vhdl-style-alist}, the new style is | |
763 added, otherwise the style already associated with @var{stylename} is | |
764 changed to the new @var{description}. This function also takes an | |
765 optional third argument, which if non-@code{nil}, automatically | |
766 institutes the new style in the current buffer. | |
767 | |
768 The sample @file{.emacs} file provides a concrete example of how a new | |
769 style can be added and automatically set. @xref{Sample .emacs File}. | |
770 | |
771 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
772 @node File Styles, , Adding Styles, Styles | |
773 @comment node-name, next, previous,up | |
774 | |
775 @subsection File Styles | |
776 @cindex File Styles | |
777 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
778 | |
779 @cindex local variables | |
780 The Emacs manual describes how you can customize certain variables on a | |
781 per-file basis by including a @dfn{Local Variable} block at the end of | |
782 the file. So far, you've only seen a functional interface to | |
783 @code{vhdl-mode}, which is highly inconvenient for use in a Local Variable | |
784 block. @code{vhdl-mode} provides two variables that make it easier for | |
785 you to customize your style on a per-file basis. | |
786 | |
787 @vindex vhdl-file-style | |
788 @vindex file-style (vhdl-) | |
789 @vindex vhdl-file-offsets | |
790 @vindex file-offsets (vhdl-) | |
791 | |
792 The variable @code{vhdl-file-style} can be set to a style name string as | |
793 described in @ref{Built-in Styles}. When the file is visited, | |
794 @code{vhdl-mode} will automatically set the file's style to this style | |
795 using @code{vhdl-set-style}. | |
796 | |
797 @vindex vhdl-offsets-alist | |
798 @vindex offsets-alist (vhdl-) | |
799 @findex vhdl-set-offset | |
800 @findex set-offset (vhdl-) | |
801 Another variable, @code{vhdl-file-offsets}, takes an association list | |
802 similar to what is allowed in @code{vhdl-offsets-alist}. When the file is | |
803 visited, @code{vhdl-mode} will automatically institute these offets using | |
804 @code{vhdl-set-offset}. @xref{Customizing Indentation}. | |
805 | |
806 Note that file style settings (i.e. @code{vhdl-file-style}) are applied | |
807 before file offset settings (i.e. @code{vhdl-file-offsets}). | |
808 | |
809 | |
810 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
811 @node Advanced Customizations, , Styles, Customizing Indentation | |
812 @comment node-name, next, previous,up | |
813 | |
814 @section Advanced Customizations | |
815 @cindex Advanced Customizations | |
816 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
817 | |
818 @vindex vhdl-style-alist | |
819 @vindex style-alist (vhdl-) | |
820 @vindex vhdl-basic-offset | |
821 @vindex basic-offset (vhdl-) | |
822 For most users, @code{vhdl-mode} will support their coding styles with | |
823 very little need for customizations. Usually, one of the standard | |
824 styles defined in @code{vhdl-style-alist} will do the trick. Sometimes, | |
825 one of the syntactic symbol offsets will need to be tweeked slightly, or | |
826 perhaps @code{vhdl-basic-offset} will need to be changed. However, some | |
827 styles require a more advanced ability for customization, and one of the | |
828 real strengths of @code{vhdl-mode} is that the syntactic analysis model | |
829 provides a very flexible framework for customizing indentation. This | |
830 allows you to perform special indentation calculations for situations | |
831 not handled by the mode directly. | |
832 | |
833 @menu | |
834 * Custom Indentation Functions:: | |
835 * Other Special Indentations:: | |
836 @end menu | |
837 | |
838 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
839 @node Custom Indentation Functions, Other Special Indentations, , Advanced Customizations | |
840 @comment node-name, next, previous,up | |
841 | |
842 @subsection Custom Indentation Functions | |
843 @cindex Custom Indentation Functions | |
844 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
845 | |
846 @cindex custom indentation functions | |
847 One of the most common ways to customize @code{vhdl-mode} is by writing | |
848 @dfn{custom indentation functions} and associating them with specific | |
849 syntactic symbols (see @ref{Syntactic Symbols}). @code{vhdl-mode} itself | |
850 uses custom indentation functions to provide more sophisticated | |
851 indentation, for example when lining up selected signal assignments: | |
852 @example | |
853 @group | |
854 | |
855 %%% TBD %%% | |
856 | |
857 @end group | |
858 @end example | |
859 | |
860 In this example, the @code{statement-cont} syntactic symbol has an | |
861 offset of @code{+}, and @code{vhdl-basic-offset} is 2, so lines 4 | |
862 through 6 are simply indented two spaces to the right of line 3. But | |
863 perhaps we'd like @code{vhdl-mode} to be a little more intelligent so | |
864 that it offsets the waveform descriptions relative to the signal | |
865 assignment operator in line 3. To do this, we have to write a custom | |
866 indentation function which finds the column of signal assignment | |
867 operator on the first line of the statement. Here is the lisp code | |
868 (from the @file{vhdl-mode.el} source file) that implements this: | |
869 @example | |
870 @group | |
871 | |
872 (defun vhdl-lineup-statement-cont (langelem) | |
873 ;; line up statement-cont after the assignment operator | |
874 (save-excursion | |
875 (let* ((relpos (cdr langelem)) | |
876 (assignp (save-excursion | |
877 (goto-char (vhdl-point 'boi)) | |
878 (and (re-search-forward "\\(<\\|:\\)=" | |
879 (vhdl-point 'eol) t) | |
880 (- (point) (vhdl-point 'boi))))) | |
881 (curcol (progn | |
882 (goto-char relpos) | |
883 (current-column))) | |
884 foundp) | |
885 (while (and (not foundp) | |
886 (< (point) (vhdl-point 'eol))) | |
887 (re-search-forward "\\(<\\|:\\)=\\|(" (vhdl-point 'eol) 'move) | |
888 (if (vhdl-in-literal (cdr langelem)) | |
889 (forward-char) | |
890 (if (= (preceding-char) ?\() | |
891 ;; skip over any parenthesized expressions | |
892 (goto-char (min (vhdl-point 'eol) | |
893 (scan-lists (point) 1 1))) | |
894 ;; found an assignment operator (not at eol) | |
895 (setq foundp (not (looking-at "\\s-*$")))))) | |
896 (if (not foundp) | |
897 ;; there's no assignment operator on the line | |
898 vhdl-basic-offset | |
899 ;; calculate indentation column after assign and ws, unless | |
900 ;; our line contains an assignment operator | |
901 (if (not assignp) | |
902 (progn | |
903 (forward-char) | |
904 (skip-chars-forward " \t") | |
905 (setq assignp 0))) | |
906 (- (current-column) assignp curcol)) | |
907 ))) | |
908 | |
909 @end group | |
910 @end example | |
911 @noindent | |
912 Custom indent functions take a single argument, which is a syntactic | |
913 component cons cell (see @ref{Syntactic Analysis}). The | |
914 function returns an integer offset value that will be added to the | |
915 running total indentation for the lne. Note that what actually gets | |
916 returned is the difference between the column that the signal assignment | |
917 operator is on, and the column of the buffer relative position passed in | |
918 the function's argument. Remember that @code{vhdl-mode} automatically | |
919 adds in the column of the component's relative buffer position and we | |
920 don't want that value added into the final total twice. | |
921 | |
922 @cindex statement-cont syntactic symbol | |
923 @findex vhdl-lineup-statement-cont | |
924 @findex lineup-statement-cont (vhdl-) | |
925 Now, to associate the function @code{vhdl-lineup-statement-cont} with the | |
926 @code{statement-cont} syntactic symbol, we can add something like the | |
927 following to our @code{vhdl-mode-hook}: | |
928 @example | |
929 | |
930 (vhdl-set-offset 'statement-cont 'vhdl-lineup-statement-cont) | |
931 | |
932 @end example | |
933 | |
934 @kindex C-c C-q | |
935 Now the function looks like this after re-indenting (using @kbd{C-c | |
936 C-q}): | |
937 @example | |
938 @group | |
939 | |
940 %%% TBD %%% | |
941 | |
942 @end group | |
943 @end example | |
944 | |
945 @vindex vhdl-offsets-alist | |
946 @vindex offsets-alist (vhdl-) | |
947 Custom indentation functions can be as simple or as complex as you like, | |
948 and any syntactic symbol that appears in @code{vhdl-offsets-alist} can have | |
949 a custom indentation function associated with it. Note however that | |
950 using many custom indentation functions may have a performance impact on | |
951 @code{vhdl-mode}. | |
952 | |
953 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
954 @node Other Special Indentations, , Custom Indentation Functions, Advanced Customizations | |
955 @comment node-name, next, previous,up | |
956 | |
957 @subsection Other Special Indentations | |
958 @cindex Other Special Indentations | |
959 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
960 | |
961 @vindex vhdl-special-indent-hook | |
962 @vindex special-indent-hook (vhdl-) | |
963 One other variable is available for you to customize @code{vhdl-mode}: | |
964 @code{vhdl-special-indent-hook}. This is a standard hook variable that | |
965 is called after every line is indented by @code{vhdl-mode}. You can use | |
966 it to do any special indentation or line adjustments your style | |
967 dictates, such as adding extra indentation to the port map clause in a | |
968 component instantiation, etc. Note however, that you should not change | |
969 @code{point} or @code{mark} inside your @code{vhdl-special-indent-hook} | |
970 functions. | |
971 | |
972 | |
973 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
974 @node Syntactic Symbols, Frequently Asked Questions, Customizing Indentation, Top | |
975 @comment node-name, next, previous,up | |
976 | |
977 @chapter Syntactic Symbols | |
978 @cindex Syntactic Symbols | |
979 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
980 | |
981 @vindex vhdl-offsets-alist | |
982 The complete list of recognized syntactic symbols is described in the | |
983 @code{vhdl-offsets-alist} variable. This chapter will provide some | |
984 examples to help clarify these symbols. | |
985 | |
986 @cindex -open syntactic symbols | |
987 @cindex -close syntactic symbols | |
988 Most syntactic symbol names follow a general naming convention. When a | |
989 line begins with a @code{begin} or @code{end} keyword, the syntactic | |
990 symbol will contain the suffix @code{-open} or @code{-close} | |
991 respectively. | |
992 | |
993 @cindex -intro syntactic symbols | |
994 @cindex -cont syntactic symbols | |
995 @cindex -block-intro syntactic symbols | |
996 Usually, a distinction is made between the first line that introduces a | |
997 construct and lines that continue a construct, and the syntactic symbols | |
998 that represent these lines will contain the suffix @code{-intro} or | |
999 @code{-cont} respectively. As a sub-classification of this scheme, a | |
1000 line which is the first of a particular block construct will contain the | |
1001 suffix @code{-block-intro}. | |
1002 | |
1003 @strong{<TBD> include the name and a brief example of every syntactic | |
1004 symbol currently recognized} | |
1005 | |
1006 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1007 @node Frequently Asked Questions, Getting the latest vhdl-mode release, Syntactic Symbols, Top | |
1008 @comment node-name, next, previous,up | |
1009 | |
1010 @chapter Frequently Asked Questions | |
1011 @cindex Frequently Asked Questions | |
1012 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1013 | |
1014 @kindex C-x h | |
1015 @kindex ESC C-\ | |
1016 @kindex C-c C-q | |
1017 @kindex ESC C-q | |
1018 @kindex ESC C-u | |
1019 @kindex RET | |
1020 @kindex LFD | |
1021 @findex newline-and-indent | |
1022 @quotation | |
1023 | |
1024 @strong{Q.} @emph{How do I re-indent the whole file?} | |
1025 | |
1026 @strong{A.} Visit the file and hit @kbd{C-x h} to mark the whole | |
1027 buffer. Then hit @kbd{@key{ESC} C-\} to re-indent the entire region | |
1028 which you've just marked. | |
1029 @sp 2 | |
1030 | |
1031 @strong{Q.} @emph{How do I re-indent the entire function?} | |
1032 | |
1033 @strong{A.} Hit @kbd{@key{ESC} C-h} to mark the entire function. Then | |
1034 hit @kbd{@key{ESC} C-\} to re-indent the entire region which you've just | |
1035 marked. | |
1036 @sp 2 | |
1037 | |
1038 @strong{Q.} @emph{How do I re-indent the current block?} | |
1039 | |
1040 @strong{A.} First move to the brace which opens the block with | |
1041 @kbd{@key{ESC} C-u}, then re-indent that expression with | |
1042 @kbd{@key{ESC} C-q}. | |
1043 @sp 2 | |
1044 | |
1045 @strong{Q.} @emph{How do I re-indent the current statement?} | |
1046 | |
1047 @strong{A.} First move to the beginning of the statement with | |
1048 @kbd{@key{ESC} a}, then re-indent that expression with @kbd{@key{ESC} | |
1049 C-q}. | |
1050 @sp 2 | |
1051 | |
1052 @strong{Q.} @emph{Why doesn't the @key{RET} key indent the line to | |
1053 where the new text should go after inserting the newline?} | |
1054 | |
1055 @strong{A.} Emacs' convention is that @key{RET} just adds a newline, | |
1056 and that @key{LFD} adds a newline and indents it. You can make | |
1057 @key{RET} do this too by adding this to your | |
1058 @code{vhdl-mode-hook} (see the sample @file{.emacs} file | |
1059 @ref{Sample .emacs File}): | |
1060 @example | |
1061 | |
1062 (define-key vhdl-mode-map "\C-m" 'newline-and-indent) | |
1063 | |
1064 @end example | |
1065 | |
1066 This is a very common question. @code{:-)} If you want this to be the | |
1067 default behavior, don't lobby me, lobby RMS! | |
1068 @sp 2 | |
1069 | |
1070 @strong{Q.} @emph{I put @code{(vhdl-set-offset 'statement-cont 0)} | |
1071 in my @file{.emacs} file but I get an error saying that | |
1072 @code{vhdl-set-offset}'s function definition is void.} | |
1073 | |
1074 @strong{A.} This means that @code{vhdl-mode} wasn't loaded into your | |
1075 Emacs session by the time the @code{vhdl-set-offset} call was reached, | |
1076 mostly likely because @code{vhdl-mode} is being autoloaded. Instead | |
1077 of putting the @code{vhdl-set-offset} line in your top-level | |
1078 @file{.emacs} file, put it in your @code{vhdl-mode-hook}, or | |
1079 simply add the following to the top of your @file{.emacs} file: | |
1080 @example | |
1081 | |
1082 (require 'vhdl-mode) | |
1083 | |
1084 @end example | |
1085 | |
1086 See the sample @file{.emacs} file @ref{Sample .emacs File} for | |
1087 details. | |
1088 | |
1089 @end quotation | |
1090 | |
1091 | |
1092 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1093 @node Getting the latest vhdl-mode release, Sample .emacs File, Frequently Asked Questions, Top | |
1094 @comment node-name, next, previous,up | |
1095 | |
1096 @chapter Getting the latest @code{vhdl-mode} release | |
1097 @cindex Getting the latest @code{vhdl-mode} release | |
1098 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1099 | |
1100 The best way to be sure you always have the latest @code{vhdl-mode} | |
1101 release is to join the @code{vhdl-mode-announce} mailing list. If you | |
1102 are a brave soul, and wish to participate in beta testing of new | |
1103 releases of @code{vhdl-mode}, you may also join the | |
1104 @code{vhdl-mode-victims} mailing list. Send email to the author to join | |
1105 either of these lists. | |
1106 | |
1107 The canonical anonymous FTP URL for @code{vhdl-mode} is | |
1108 @code{ftp://ftp.eda.com.au/pub/emacs/vhdl-mode.tar.gz}. Special thanks | |
1109 to Ken Wood <ken@@eda.com.au> for providing an FTP repository for | |
1110 @code{vhdl-mode}. | |
1111 | |
1112 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1113 @node Sample .emacs File, Requirements, Getting the latest vhdl-mode release, Top | |
1114 @comment node-name, next, previous,up | |
1115 | |
1116 @chapter Sample @file{.emacs} file | |
1117 @cindex Sample @file{.emacs} file | |
1118 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1119 | |
1120 @example | |
1121 ;; Here's a sample .emacs file that might help you along the way. Just | |
1122 ;; copy this region and paste it into your .emacs file. You may want to | |
1123 ;; change some of the actual values. | |
1124 | |
1125 (defconst my-vhdl-style | |
1126 '((vhdl-tab-always-indent . t) | |
1127 (vhdl-comment-only-line-offset . 4) | |
1128 (vhdl-offsets-alist . ((arglist-close . vhdl-lineup-arglist) | |
1129 (statement-cont . 0) | |
1130 (case-alternative . 4) | |
1131 (block-open . 0))) | |
1132 (vhdl-echo-syntactic-information-p . t) | |
1133 ) | |
1134 "My VHDL Programming Style") | |
1135 | |
1136 ;; Customizations for vhdl-mode | |
1137 (defun my-vhdl-mode-hook () | |
1138 ;; add my personal style and set it for the current buffer | |
1139 (vhdl-add-style "PERSONAL" my-vhdl-style t) | |
1140 ;; offset customizations not in my-vhdl-style | |
1141 (vhdl-set-offset 'statement-case-intro '++) | |
1142 ;; other customizations | |
1143 (setq tab-width 8 | |
1144 ;; this will make sure spaces are used instead of tabs | |
1145 indent-tabs-mode nil) | |
1146 ;; keybindings for VHDL are put in vhdl-mode-map | |
1147 (define-key vhdl-mode-map "\C-m" 'newline-and-indent) | |
1148 ) | |
1149 | |
1150 ;; the following only works in Emacs 19 | |
1151 ;; Emacs 18ers can use (setq vhdl-mode-hook 'my-vhdl-mode-hook) | |
1152 (add-hook 'vhdl-mode-hook 'my-vhdl-mode-hook) | |
1153 @end example | |
1154 | |
1155 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1156 @node Requirements, Limitations and Known Bugs, Sample .emacs File, Top | |
1157 @comment node-name, next, previous,up | |
1158 @chapter Requirements | |
1159 @cindex Requirements | |
1160 @comment * Requirements | |
1161 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1162 | |
1163 @cindex reporter.el | |
1164 @file{vhdl-mode.el} requires @file{reporter.el} for submission of bug | |
1165 reports. @file{reporter.el} is distributed with the latest FSF and | |
1166 XEmacs 19's. Here is the Emacs Lisp Archive anonymous ftp'ing | |
1167 record for those of you who are using older Emacsen. | |
1168 | |
1169 @comment * Here's the Emacs Lisp Archive information for @file{reporter.el}: | |
1170 @example | |
1171 | |
1172 GNU Emacs Lisp Code Directory Apropos -- "reporter" | |
1173 "~/" refers to archive.cis.ohio-state.edu:/pub/gnu/emacs/elisp-archive/ | |
1174 | |
1175 reporter (2.12) 06-Jul-1994 | |
1176 Barry A. Warsaw, <bwarsaw@@cen.com> | |
1177 ~/misc/reporter.el.Z | |
1178 Customizable bug reporting of lisp programs. | |
1179 | |
1180 @end example | |
1181 | |
1182 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1183 @node Limitations and Known Bugs, Mailing Lists and Submitting Bug Reports, Requirements, Top | |
1184 @comment node-name, next, previous,up | |
1185 @chapter Limitations and Known Bugs | |
1186 @cindex Limitations and Known Bugs | |
1187 @comment * Limitations and Known Bugs | |
1188 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1189 | |
1190 @itemize @bullet | |
1191 @item | |
1192 Re-indenting large regions or expressions can be slow. | |
1193 | |
1194 @item | |
1195 Use with Emacs 18 can be slow and annoying. You should seriously | |
1196 consider upgrading to Emacs 19. | |
1197 | |
1198 @end itemize | |
1199 | |
1200 @node Mailing Lists and Submitting Bug Reports, Concept Index, Limitations and Known Bugs, Top | |
1201 @comment node-name, next, previous,up | |
1202 @chapter Mailing Lists and Submitting Bug Reports | |
1203 @cindex Mailing Lists and Submitting Bug Reports | |
1204 @comment * Mailing Lists and Submitting Bug Reports | |
1205 | |
1206 @kindex C-c C-b | |
1207 @findex vhdl-submit-bug-report | |
1208 @findex submit-bug-report (vhdl-) | |
1209 @cindex beta testers mailing list | |
1210 @cindex announcement mailing list | |
1211 To report bugs, use the @kbd{C-c C-b} (@code{vhdl-submit-bug-report}) | |
1212 command. This provides vital information I need to reproduce your | |
1213 problem. Make sure you include a concise, but complete code example. | |
1214 Please try to boil your example down to just the essential code needed | |
1215 to reproduce the problem, and include an exact recipe of steps needed to | |
1216 expose the bug. Be especially sure to include any code that appears | |
1217 @emph{before} your bug example. | |
1218 | |
1219 For other help or suggestions, send a message to | |
1220 @code{rwhitby@@asc.corp.mot.com}. | |
1221 | |
1222 Send an add message to @code{rwhitby@@asc.corp.mot.com} to get on the | |
1223 @code{vhdl-mode-victims} beta testers list where beta releases of | |
1224 @code{vhdl-mode} are posted. Note that you shouldn't expect beta | |
1225 releases to be as stable as public releases. | |
1226 | |
1227 There is also an announce only list where the latest public releases of | |
1228 @code{vhdl-mode} are posted. Send an add message to | |
1229 @code{rwhitby@@asc.corp.mot.com} to be added to this list. | |
1230 | |
1231 @c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1232 @node Concept Index, Command Index, Mailing Lists and Submitting Bug Reports, Top | |
1233 @comment node-name, next, previous, up | |
1234 @unnumbered Concept Index | |
1235 @c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1236 | |
1237 @printindex cp | |
1238 | |
1239 | |
1240 @c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1241 @node Command Index, Key Index, Concept Index, Top | |
1242 @comment node-name, next, previous, up | |
1243 @unnumbered Command Index | |
1244 @c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1245 | |
1246 @ifinfo | |
1247 | |
1248 @end ifinfo | |
1249 Since all @code{vhdl-mode} commands are prepended with the string | |
1250 @samp{vhdl-}, each appears under its @code{vhdl-<thing>} name and its | |
1251 @code{<thing> (vhdl-)} name. | |
1252 @iftex | |
1253 @sp 2 | |
1254 @end iftex | |
1255 @printindex fn | |
1256 | |
1257 | |
1258 @c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1259 @node Key Index, Variable Index, Command Index, Top | |
1260 @comment node-name, next, previous, up | |
1261 @unnumbered Key Index | |
1262 @c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1263 | |
1264 @printindex ky | |
1265 | |
1266 | |
1267 @c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1268 @node Variable Index, , Key Index, Top | |
1269 @comment node-name, next, previous, up | |
1270 @unnumbered Variable Index | |
1271 @c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
1272 | |
1273 @ifinfo | |
1274 | |
1275 @end ifinfo | |
1276 Since all @code{vhdl-mode} variables are prepended with the string | |
1277 @samp{vhdl-}, each appears under its @code{vhdl-<thing>} name and its | |
1278 @code{<thing> (vhdl-)} name. | |
1279 @iftex | |
1280 @sp 2 | |
1281 @end iftex | |
1282 @printindex vr | |
1283 @summarycontents | |
1284 @contents | |
1285 @bye |