diff options
| author | Eli Zaretskii | 2017-11-24 16:36:33 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-11-24 16:36:33 +0200 |
| commit | b4f67ebb92b3d753e601e333f64b871a602b3979 (patch) | |
| tree | ca50396b640d84329497f0d6c84fd53218bbdf2a | |
| parent | 8a2b204e646b50ad2e2a302c21a9f6e6cc78908e (diff) | |
| download | emacs-b4f67ebb92b3d753e601e333f64b871a602b3979.tar.gz emacs-b4f67ebb92b3d753e601e333f64b871a602b3979.zip | |
Improve discoverability of 'defvar' for suppressing warnings
* doc/lispref/compile.texi (Compiler Errors): Add index entries.
* doc/lispref/variables.texi (Defining Variables): Mention that
defvar with no value is used for suppressing compiler warnings.
(Bug#29400)
| -rw-r--r-- | doc/lispref/compile.texi | 10 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index 201d9fc2fa5..57ff06085d9 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi | |||
| @@ -434,6 +434,7 @@ to what @code{eval-when-compile} does. | |||
| 434 | @node Compiler Errors | 434 | @node Compiler Errors |
| 435 | @section Compiler Errors | 435 | @section Compiler Errors |
| 436 | @cindex compiler errors | 436 | @cindex compiler errors |
| 437 | @cindex byte-compiler errors | ||
| 437 | 438 | ||
| 438 | Error and warning messages from byte compilation are printed in a | 439 | Error and warning messages from byte compilation are printed in a |
| 439 | buffer named @file{*Compile-Log*}. These messages include file names | 440 | buffer named @file{*Compile-Log*}. These messages include file names |
| @@ -450,6 +451,10 @@ compiled, and point shows how far the byte compiler was able to read; | |||
| 450 | the cause of the error might be nearby. @xref{Syntax Errors}, for | 451 | the cause of the error might be nearby. @xref{Syntax Errors}, for |
| 451 | some tips for locating syntax errors. | 452 | some tips for locating syntax errors. |
| 452 | 453 | ||
| 454 | @cindex byte-compiler warnings | ||
| 455 | @cindex free variable, byte-compiler warning | ||
| 456 | @cindex reference to free variable, compilation warning | ||
| 457 | @cindex function not known to be defined, compilation warning | ||
| 453 | A common type of warning issued by the byte compiler is for | 458 | A common type of warning issued by the byte compiler is for |
| 454 | functions and variables that were used but not defined. Such warnings | 459 | functions and variables that were used but not defined. Such warnings |
| 455 | report the line number for the end of the file, not the locations | 460 | report the line number for the end of the file, not the locations |
| @@ -490,12 +495,13 @@ The reference to @var{variable} must be in the @var{then-form} of the | |||
| 490 | 495 | ||
| 491 | @item | 496 | @item |
| 492 | You can tell the compiler that a function is defined using | 497 | You can tell the compiler that a function is defined using |
| 493 | @code{declare-function}. @xref{Declaring Functions}. | 498 | @code{declare-function}. @xref{Declaring Functions}. |
| 494 | 499 | ||
| 495 | @item | 500 | @item |
| 496 | Likewise, you can tell the compiler that a variable is defined using | 501 | Likewise, you can tell the compiler that a variable is defined using |
| 497 | @code{defvar} with no initial value. (Note that this marks the | 502 | @code{defvar} with no initial value. (Note that this marks the |
| 498 | variable as special.) @xref{Defining Variables}. | 503 | variable as special, i.e.@: dynamically bound.) @xref{Defining |
| 504 | Variables}. | ||
| 499 | @end itemize | 505 | @end itemize |
| 500 | 506 | ||
| 501 | You can also suppress any and all compiler warnings within a certain | 507 | You can also suppress any and all compiler warnings within a certain |
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 52d1f3bbf5e..99bbfc91243 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi | |||
| @@ -435,7 +435,9 @@ dynamically bound value; @pxref{Void Variables}), then @var{value} is | |||
| 435 | evaluated and @var{symbol} is set to the result. But if @var{symbol} | 435 | evaluated and @var{symbol} is set to the result. But if @var{symbol} |
| 436 | is not void, @var{value} is not evaluated, and @var{symbol}'s value is | 436 | is not void, @var{value} is not evaluated, and @var{symbol}'s value is |
| 437 | left unchanged. If @var{value} is omitted, the value of @var{symbol} | 437 | left unchanged. If @var{value} is omitted, the value of @var{symbol} |
| 438 | is not changed in any case. | 438 | is not changed in any case. Using @code{defvar} with no value is one |
| 439 | method of suppressing byte compilation warnings, see @ref{Compiler | ||
| 440 | Errors}. | ||
| 439 | 441 | ||
| 440 | If @var{symbol} has a buffer-local binding in the current buffer, | 442 | If @var{symbol} has a buffer-local binding in the current buffer, |
| 441 | @code{defvar} acts on the default value, which is buffer-independent, | 443 | @code{defvar} acts on the default value, which is buffer-independent, |