/[emacs]/emacs/lispref/tips.texi
ViewVC logotype

Diff of /emacs/lispref/tips.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.43.2.8 by miles, Tue Apr 27 14:08:35 2004 UTC revision 1.43.2.9 by miles, Wed Dec 8 23:31:36 2004 UTC
# Line 370  coherent if all libraries use the same c Line 370  coherent if all libraries use the same c
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

Legend:
Removed from v.1.43.2.8  
changed lines
  Added in v.1.43.2.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26