emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lispref/tips.texi


From: Richard M . Stallman
Subject: [Emacs-diffs] Changes to emacs/lispref/tips.texi
Date: Tue, 16 Nov 2004 13:02:27 -0500

Index: emacs/lispref/tips.texi
diff -c emacs/lispref/tips.texi:1.59 emacs/lispref/tips.texi:1.60
*** emacs/lispref/tips.texi:1.59        Sun Apr 18 02:05:02 2004
--- emacs/lispref/tips.texi     Tue Nov 16 17:30:48 2004
***************
*** 370,394 ****
  
  @item
  Try to avoid compiler warnings about undefined free variables, by adding
! @code{defvar} definitions for these variables.
  
! Sometimes adding a @code{require} for another package is useful to avoid
! compilation warnings for variables and functions defined in that
! package.  If you do this, often it is better if the @code{require} acts
! only at compile time.  Here's how to do that:
  
  @example
  (eval-when-compile
!   (require 'foo)
!   (defvar bar-baz))
  @end example
  
! If you bind a variable in one function, and use it or set it in another
! function, the compiler warns about the latter function unless the
! variable has a definition.  But often these variables have short names,
! and it is not clean for Lisp packages to define such variable names.
! Therefore, you should rename the variable to start with the name prefix
! used for the other functions and variables in your package.
  
  @item
  Indent each function with @kbd{C-M-q} (@code{indent-sexp}) using the
--- 370,403 ----
  
  @item
  Try to avoid compiler warnings about undefined free variables, by adding
! dummy @code{defvar} definitions for these variables, like this:
  
! @example
! (defvar foo)
! @end example
! 
! Such a definition has no effect except to tell the compiler
! not to warn about uses of the variable @code{foo} in this file.
! 
! @item
! If you use many functions and variables from a certain file, you can
! add a @code{require} for that package to avoid compilation warnings
! for them.  It is better if the @code{require} acts only at compile
! time.  Here's how to do this:
  
  @example
  (eval-when-compile
!   (require 'foo))
  @end example
  
! @item
! If you bind a variable in one function, and use it or set it in
! another function, the compiler warns about the latter function unless
! the variable has a definition.  But adding a definition would be
! unclean if the variable has a short names, since Lisp packages should
! not define short variable names.  The right thing to do is to rename
! this variable to start with the name prefix used for the other
! functions and variables in your package.
  
  @item
  Indent each function with @kbd{C-M-q} (@code{indent-sexp}) using the




reply via email to

[Prev in Thread] Current Thread [Next in Thread]