370 |
|
|
371 |
@item |
@item |
372 |
Try to avoid compiler warnings about undefined free variables, by adding |
Try to avoid compiler warnings about undefined free variables, by adding |
373 |
@code{defvar} definitions for these variables. |
dummy @code{defvar} definitions for these variables, like this: |
374 |
|
|
375 |
Sometimes adding a @code{require} for another package is useful to avoid |
@example |
376 |
compilation warnings for variables and functions defined in that |
(defvar foo) |
377 |
package. If you do this, often it is better if the @code{require} acts |
@end example |
378 |
only at compile time. Here's how to do that: |
|
379 |
|
Such a definition has no effect except to tell the compiler |
380 |
|
not to warn about uses of the variable @code{foo} in this file. |
381 |
|
|
382 |
|
@item |
383 |
|
If you use many functions and variables from a certain file, you can |
384 |
|
add a @code{require} for that package to avoid compilation warnings |
385 |
|
for them. It is better if the @code{require} acts only at compile |
386 |
|
time. Here's how to do this: |
387 |
|
|
388 |
@example |
@example |
389 |
(eval-when-compile |
(eval-when-compile |
390 |
(require 'foo) |
(require 'foo)) |
|
(defvar bar-baz)) |
|
391 |
@end example |
@end example |
392 |
|
|
393 |
If you bind a variable in one function, and use it or set it in another |
@item |
394 |
function, the compiler warns about the latter function unless the |
If you bind a variable in one function, and use it or set it in |
395 |
variable has a definition. But often these variables have short names, |
another function, the compiler warns about the latter function unless |
396 |
and it is not clean for Lisp packages to define such variable names. |
the variable has a definition. But adding a definition would be |
397 |
Therefore, you should rename the variable to start with the name prefix |
unclean if the variable has a short names, since Lisp packages should |
398 |
used for the other functions and variables in your package. |
not define short variable names. The right thing to do is to rename |
399 |
|
this variable to start with the name prefix used for the other |
400 |
|
functions and variables in your package. |
401 |
|
|
402 |
@item |
@item |
403 |
Indent each function with @kbd{C-M-q} (@code{indent-sexp}) using the |
Indent each function with @kbd{C-M-q} (@code{indent-sexp}) using the |