summaryrefslogtreecommitdiff
path: root/devdocs/elisp/warning-basics.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/warning-basics.html')
-rw-r--r--devdocs/elisp/warning-basics.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/devdocs/elisp/warning-basics.html b/devdocs/elisp/warning-basics.html
new file mode 100644
index 00000000..74cc15dc
--- /dev/null
+++ b/devdocs/elisp/warning-basics.html
@@ -0,0 +1,16 @@
+ <h4 class="subsection">Warning Basics</h4> <p>Every warning has a textual message, which explains the problem for the user, and a <em>severity level</em> which is a symbol. Here are the possible severity levels, in order of decreasing severity, and their meanings: </p> <dl compact> <dt><code>:emergency</code></dt> <dd><p>A problem that will seriously impair Emacs operation soon if you do not attend to it promptly. </p></dd> <dt><code>:error</code></dt> <dd><p>A report of data or circumstances that are inherently wrong. </p></dd> <dt><code>:warning</code></dt> <dd><p>A report of data or circumstances that are not inherently wrong, but raise suspicion of a possible problem. </p></dd> <dt><code>:debug</code></dt> <dd><p>A report of information that may be useful if you are debugging. </p></dd> </dl> <p>When your program encounters invalid input data, it can either signal a Lisp error by calling <code>error</code> or <code>signal</code> or report a warning with severity <code>:error</code>. Signaling a Lisp error is the easiest thing to do, but it means the program cannot continue processing. If you want to take the trouble to implement a way to continue processing despite the bad data, then reporting a warning of severity <code>:error</code> is the right way to inform the user of the problem. For instance, the Emacs Lisp byte compiler can report an error that way and continue compiling other functions. (If the program signals a Lisp error and then handles it with <code>condition-case</code>, the user won’t see the error message; it could show the message to the user by reporting it as a warning.) </p> <p>Each warning has a <em>warning type</em> to classify it. The type is a list of symbols. The first symbol should be the custom group that you use for the program’s user options. For example, byte compiler warnings use the warning type <code>(bytecomp)</code>. You can also subcategorize the warnings, if you wish, by using more symbols in the list. </p> <dl> <dt id="display-warning">Function: <strong>display-warning</strong> <em>type message &amp;optional level buffer-name</em>
+</dt> <dd>
+<p>This function reports a warning, using <var>message</var> as the message and <var>type</var> as the warning type. <var>level</var> should be the severity level, with <code>:warning</code> being the default. </p> <p><var>buffer-name</var>, if non-<code>nil</code>, specifies the name of the buffer for logging the warning. By default, it is <samp>*Warnings*</samp>. </p>
+</dd>
+</dl> <dl> <dt id="lwarn">Function: <strong>lwarn</strong> <em>type level message &amp;rest args</em>
+</dt> <dd><p>This function reports a warning using the value of <code>(format-message
+<var>message</var> <var>args</var>...)</code> as the message in the <samp>*Warnings*</samp> buffer. In other respects it is equivalent to <code>display-warning</code>. </p></dd>
+</dl> <dl> <dt id="warn">Function: <strong>warn</strong> <em>message &amp;rest args</em>
+</dt> <dd><p>This function reports a warning using the value of <code>(format-message
+<var>message</var> <var>args</var>...)</code> as the message, <code>(emacs)</code> as the type, and <code>:warning</code> as the severity level. It exists for compatibility only; we recommend not using it, because you should specify a specific warning type. </p></dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Warning-Basics.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Warning-Basics.html</a>
+ </p>
+</div>