Mercurial > emacs
annotate lisp/warnings.el @ 47571:c26abde8fcad
(custom-make-dependencies): Bind to t around evaluating the def-form.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 21 Sep 2002 20:00:20 +0000 |
parents | 0d4291124ff0 |
children | 3f0f00c7a374 |
rev | line source |
---|---|
46575 | 1 ;;; warnings.el --- log and display warnings |
2 | |
3 ;; Copyright (C) 2002 Free Software Foundation, Inc. | |
4 | |
5 ;; Maintainer: FSF | |
6 ;; Keywords: internal | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;; This file implements the entry points `warn', `lwarn' | |
28 ;; and `display-warnings'. | |
29 | |
30 ;;; Code: | |
31 | |
32 (defvar warning-levels | |
46656
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
33 '((:emergency "Emergency%s: " ding) |
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
34 (:error "Error%s: ") |
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
35 (:warning "Warning%s: ") |
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
36 (:debug "Debug%s: ")) |
46698
ae636e084c86
(warning-levels): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
46696
diff
changeset
|
37 "List of severity level definitions for `display-warning'. |
46575 | 38 Each element looks like (LEVEL STRING FUNCTION) and |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
39 defines LEVEL as a severity level. STRING specifies the |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
40 description of this level. STRING should use `%s' to |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
41 specify where to put the warning group information, |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
42 or it can omit the `%s' so as not to include that information. |
46575 | 43 |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
44 The optional FUNCTION, if non-nil, is a function to call |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
45 with no arguments, to get the user's attention. |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
46 |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
47 The standard levels are :emergency, :error, :warning and :debug. |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
48 See `display-warning' for documentation of their meanings. |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
49 Level :debug is ignored by default (see `warning-minimum-level').") |
46575 | 50 (put 'warning-levels 'risky-local-variable t) |
51 | |
52 ;; These are for compatibility with XEmacs. | |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
53 ;; I don't think there is any chance of designing meaningful criteria |
46575 | 54 ;; to distinguish so many levels. |
55 (defvar warning-level-aliases | |
56 '((emergency . :emergency) | |
57 (error . :error) | |
58 (warning . :warning) | |
59 (notice . :warning) | |
60 (info . :warning) | |
61 (critical . :emergency) | |
62 (alarm . :emergency)) | |
63 "Alist of aliases for severity levels for `display-warning'. | |
64 Each element looks like (ALIAS . LEVEL) and defines | |
47271
b4cd4023d957
(warning-level-aliases): Fix spacing.
Juanma Barranquero <lekktu@gmail.com>
parents:
47109
diff
changeset
|
65 ALIAS as equivalent to LEVEL. LEVEL must be defined in `warning-levels'; |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
66 it may not itself be an alias.") |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
67 |
46575 | 68 (defcustom warning-minimum-level :warning |
69 "Minimum severity level for displaying the warning buffer. | |
70 If a warning's severity level is lower than this, | |
71 the warning is logged in the warnings buffer, but the buffer | |
72 is not immediately displayed. See also `warning-minimum-log-level'." | |
73 :group 'warnings | |
74 :type '(choice (const :emergency) (const :error) (const :warning)) | |
75 :version "21.4") | |
76 (defvaralias 'display-warning-minimum-level 'warning-minimum-level) | |
77 | |
78 (defcustom warning-minimum-log-level :warning | |
79 "Minimum severity level for logging a warning. | |
80 If a warning severity level is lower than this, | |
81 the warning is completely ignored." | |
82 :group 'warnings | |
83 :type '(choice (const :emergency) (const :error) (const :warning)) | |
84 :version "21.4") | |
85 (defvaralias 'log-warning-minimum-level 'warning-minimum-log-level) | |
86 | |
46656
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
87 (defcustom warning-suppress-log-types nil |
46575 | 88 "List of warning types that should not be logged. |
89 If any element of this list matches the GROUP argument to `display-warning', | |
90 the warning is completely ignored. | |
91 The element must match the first elements of GROUP. | |
92 Thus, (foo bar) as an element matches (foo bar) | |
93 or (foo bar ANYTHING...) as GROUP. | |
46698
ae636e084c86
(warning-levels): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
46696
diff
changeset
|
94 If GROUP is a symbol FOO, that is equivalent to the list (FOO), |
46575 | 95 so only the element (FOO) will match it." |
96 :group 'warnings | |
97 :type '(repeat (repeat symbol)) | |
98 :version "21.4") | |
99 | |
46656
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
100 (defcustom warning-suppress-types nil |
46575 | 101 "Custom groups for warnings not to display immediately. |
102 If any element of this list matches the GROUP argument to `display-warning', | |
103 the warning is logged nonetheless, but the warnings buffer is | |
104 not immediately displayed. | |
105 The element must match an initial segment of the list GROUP. | |
106 Thus, (foo bar) as an element matches (foo bar) | |
107 or (foo bar ANYTHING...) as GROUP. | |
108 If GROUP is a symbol FOO, that is equivalent to the list (FOO), | |
109 so only the element (FOO) will match it. | |
46656
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
110 See also `warning-suppress-log-types'." |
46575 | 111 :group 'warnings |
112 :type '(repeat (repeat symbol)) | |
113 :version "21.4") | |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
114 |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
115 ;;; The autoload cookie is so that programs can bind this variable |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
116 ;;; safely, testing the existing value, before they call one of the |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
117 ;;; warnings functions. |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
118 ;;;###autoload |
46575 | 119 (defvar warning-prefix-function nil |
120 "Function to generate warning prefixes. | |
121 This function, if non-nil, is called with two arguments, | |
122 the severity level and its entry in `warning-levels', | |
123 and should return the entry that should actually be used. | |
124 The warnings buffer is current when this function is called | |
125 and the function can insert text in it. This text becomes | |
126 the beginning of the warning.") | |
127 | |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
128 ;;; The autoload cookie is so that programs can bind this variable |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
129 ;;; safely, testing the existing value, before they call one of the |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
130 ;;; warnings functions. |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
131 ;;;###autoload |
46575 | 132 (defvar warning-series nil |
133 "Non-nil means treat multiple `display-warning' calls as a series. | |
47109
796b2ef84d40
(warning-series): Now can be a marker, not an integer.
Richard M. Stallman <rms@gnu.org>
parents:
46830
diff
changeset
|
134 A marker indicates a position in the warnings buffer |
796b2ef84d40
(warning-series): Now can be a marker, not an integer.
Richard M. Stallman <rms@gnu.org>
parents:
46830
diff
changeset
|
135 which is the start of the current series; it means that |
796b2ef84d40
(warning-series): Now can be a marker, not an integer.
Richard M. Stallman <rms@gnu.org>
parents:
46830
diff
changeset
|
136 additional warnings in the same buffer should not move point. |
796b2ef84d40
(warning-series): Now can be a marker, not an integer.
Richard M. Stallman <rms@gnu.org>
parents:
46830
diff
changeset
|
137 t means the next warning begins a series (and stores a marker here). |
46575 | 138 A symbol with a function definition is like t, except |
139 also call that function before the next warning.") | |
140 (put 'warning-series 'risky-local-variable t) | |
141 | |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
142 ;;; The autoload cookie is so that programs can bind this variable |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
143 ;;; safely, testing the existing value, before they call one of the |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
144 ;;; warnings functions. |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
145 ;;;###autoload |
46575 | 146 (defvar warning-fill-prefix nil |
147 "Non-nil means fill each warning text using this string as `fill-prefix'.") | |
148 | |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
149 ;;; The autoload cookie is so that programs can bind this variable |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
150 ;;; safely, testing the existing value, before they call one of the |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
151 ;;; warnings functions. |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
152 ;;;###autoload |
46656
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
153 (defvar warning-group-format " (%s)" |
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
154 "Format for displaying the warning group in the warning message. |
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
155 The result of formatting the group this way gets included in the |
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
156 message under the control of the string in `warning-levels'.") |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
157 |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
158 (defun warning-numeric-level (level) |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
159 "Return a numeric measure of the warning severity level LEVEL." |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
160 (let* ((elt (assq level warning-levels)) |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
161 (link (memq elt warning-levels))) |
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
162 (length link))) |
46656
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
163 |
46575 | 164 (defun warning-suppress-p (group suppress-list) |
165 "Non-nil if a warning with group GROUP should be suppressed. | |
166 SUPPRESS-LIST is the list of kinds of warnings to suppress." | |
167 (let (some-match) | |
168 (dolist (elt suppress-list) | |
169 (if (symbolp group) | |
170 ;; If GROUP is a symbol, the ELT must be (GROUP). | |
171 (if (and (consp elt) | |
172 (eq (car elt) group) | |
173 (null (cdr elt))) | |
174 (setq some-match t)) | |
175 ;; If GROUP is a list, ELT must match it or some initial segment of it. | |
176 (let ((tem1 group) | |
177 (tem2 elt) | |
178 (match t)) | |
179 ;; Check elements of ELT until we run out of them. | |
180 (while tem2 | |
181 (if (not (equal (car tem1) (car tem2))) | |
182 (setq match nil)) | |
183 (setq tem1 (cdr tem1) | |
184 tem2 (cdr tem2))) | |
185 ;; If ELT is an initial segment of GROUP, MATCH is t now. | |
186 ;; So set SOME-MATCH. | |
187 (if match | |
188 (setq some-match t))))) | |
189 ;; If some element of SUPPRESS-LIST matched, | |
190 ;; we return t. | |
191 some-match)) | |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
192 |
46579
e07579b3efcc
(display-warning, warn, lwarn): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
46575
diff
changeset
|
193 ;;;###autoload |
46575 | 194 (defun display-warning (group message &optional level buffer-name) |
195 "Display a warning message, MESSAGE. | |
46698
ae636e084c86
(warning-levels): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
46696
diff
changeset
|
196 GROUP should be a custom group name (a symbol), |
46575 | 197 or else a list of symbols whose first element is a custom group name. |
198 \(The rest of the symbols represent subcategories, for warning purposes | |
199 only, and you can use whatever symbols you like.) | |
200 | |
201 LEVEL should be either :warning, :error, or :emergency. | |
202 :emergency -- a problem that will seriously impair Emacs operation soon | |
203 if you do not attend to it promptly. | |
204 :error -- data or circumstances that are inherently wrong. | |
205 :warning -- data or circumstances that are not inherently wrong, | |
206 but raise suspicion of a possible problem. | |
207 :debug -- info for debugging only. | |
208 | |
209 BUFFER-NAME, if specified, is the name of the buffer for logging the | |
210 warning. By default, it is `*Warnings*'. | |
211 | |
212 See the `warnings' custom group for user customization features. | |
213 | |
214 See also `warning-series', `warning-prefix-function' and | |
215 `warning-fill-prefix' for additional programming features." | |
216 (unless level | |
217 (setq level :warning)) | |
218 (if (assq level warning-level-aliases) | |
219 (setq level (cdr (assq level warning-level-aliases)))) | |
220 (or (< (warning-numeric-level level) | |
221 (warning-numeric-level warning-minimum-log-level)) | |
46656
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
222 (warning-suppress-p group warning-suppress-log-types) |
46575 | 223 (let* ((groupname (if (consp group) (car group) group)) |
224 (buffer (get-buffer-create (or buffer-name "*Warnings*"))) | |
225 (level-info (assq level warning-levels)) | |
226 start end) | |
227 (with-current-buffer buffer | |
228 (goto-char (point-max)) | |
229 (when (and warning-series (symbolp warning-series)) | |
230 (setq warning-series | |
47109
796b2ef84d40
(warning-series): Now can be a marker, not an integer.
Richard M. Stallman <rms@gnu.org>
parents:
46830
diff
changeset
|
231 (prog1 (point-marker) |
46575 | 232 (unless (eq warning-series t) |
233 (funcall warning-series))))) | |
234 (unless (bolp) | |
235 (newline)) | |
236 (setq start (point)) | |
237 (if warning-prefix-function | |
238 (setq level-info (funcall warning-prefix-function | |
239 level level-info))) | |
46698
ae636e084c86
(warning-levels): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
46696
diff
changeset
|
240 (insert (format (nth 1 level-info) |
ae636e084c86
(warning-levels): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
46696
diff
changeset
|
241 (format warning-group-format groupname)) |
46656
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
242 message) |
46575 | 243 (newline) |
244 (when (and warning-fill-prefix (not (string-match "\n" message))) | |
245 (let ((fill-prefix warning-fill-prefix) | |
246 (fill-column 78)) | |
247 (fill-region start (point)))) | |
248 (setq end (point)) | |
47109
796b2ef84d40
(warning-series): Now can be a marker, not an integer.
Richard M. Stallman <rms@gnu.org>
parents:
46830
diff
changeset
|
249 (when (and (markerp warning-series) |
796b2ef84d40
(warning-series): Now can be a marker, not an integer.
Richard M. Stallman <rms@gnu.org>
parents:
46830
diff
changeset
|
250 (eq (marker-buffer warning-series) buffer)) |
46575 | 251 (goto-char warning-series))) |
252 (if (nth 2 level-info) | |
253 (funcall (nth 2 level-info))) | |
254 (if noninteractive | |
255 ;; Noninteractively, take the text we inserted | |
256 ;; in the warnings buffer and print it. | |
257 ;; Do this unconditionally, since there is no way | |
258 ;; to view logged messages unless we output them. | |
259 (with-current-buffer buffer | |
47480
0d4291124ff0
(display-warning): In batch mode,
Richard M. Stallman <rms@gnu.org>
parents:
47271
diff
changeset
|
260 (save-excursion |
0d4291124ff0
(display-warning): In batch mode,
Richard M. Stallman <rms@gnu.org>
parents:
47271
diff
changeset
|
261 ;; Don't include the final newline in the arg |
0d4291124ff0
(display-warning): In batch mode,
Richard M. Stallman <rms@gnu.org>
parents:
47271
diff
changeset
|
262 ;; to `message', because it adds a newline. |
0d4291124ff0
(display-warning): In batch mode,
Richard M. Stallman <rms@gnu.org>
parents:
47271
diff
changeset
|
263 (goto-char end) |
0d4291124ff0
(display-warning): In batch mode,
Richard M. Stallman <rms@gnu.org>
parents:
47271
diff
changeset
|
264 (if (bolp) |
0d4291124ff0
(display-warning): In batch mode,
Richard M. Stallman <rms@gnu.org>
parents:
47271
diff
changeset
|
265 (forward-char -1)) |
0d4291124ff0
(display-warning): In batch mode,
Richard M. Stallman <rms@gnu.org>
parents:
47271
diff
changeset
|
266 (message "%s" (buffer-substring start (point))))) |
46575 | 267 ;; Interactively, decide whether the warning merits |
268 ;; immediate display. | |
269 (or (< (warning-numeric-level level) | |
46698
ae636e084c86
(warning-levels): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
46696
diff
changeset
|
270 (warning-numeric-level warning-minimum-level)) |
46656
ac53ae45c502
(warning-levels): Add %s to the strings.
Richard M. Stallman <rms@gnu.org>
parents:
46646
diff
changeset
|
271 (warning-suppress-p group warning-suppress-types) |
46575 | 272 (let ((window (display-buffer buffer))) |
47109
796b2ef84d40
(warning-series): Now can be a marker, not an integer.
Richard M. Stallman <rms@gnu.org>
parents:
46830
diff
changeset
|
273 (when (and (markerp warning-series) |
796b2ef84d40
(warning-series): Now can be a marker, not an integer.
Richard M. Stallman <rms@gnu.org>
parents:
46830
diff
changeset
|
274 (eq (marker-buffer warning-series) buffer)) |
46575 | 275 (set-window-start window warning-series)) |
276 (sit-for 0))))))) | |
46830
fa2c544d95fd
(warning-prefix-function, warning-series)
Richard M. Stallman <rms@gnu.org>
parents:
46698
diff
changeset
|
277 |
46579
e07579b3efcc
(display-warning, warn, lwarn): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
46575
diff
changeset
|
278 ;;;###autoload |
46575 | 279 (defun lwarn (group level message &rest args) |
280 "Display a warning message made from (format MESSAGE ARGS...). | |
281 Aside from generating the message with `format', | |
46696
6caa78f4752d
(lwarn, warn): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
46656
diff
changeset
|
282 this is equivalent to `display-warning'. |
46575 | 283 |
284 GROUP should be a custom group name (a symbol). | |
285 or else a list of symbols whose first element is a custom group name. | |
286 \(The rest of the symbols represent subcategories and | |
287 can be whatever you like.) | |
288 | |
289 LEVEL should be either :warning, :error, or :emergency. | |
290 :emergency -- a problem that will seriously impair Emacs operation soon | |
291 if you do not attend to it promptly. | |
292 :error -- invalid data or circumstances. | |
293 :warning -- suspicious data or circumstances." | |
294 (display-warning group (apply 'format message args) level)) | |
295 | |
46579
e07579b3efcc
(display-warning, warn, lwarn): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
46575
diff
changeset
|
296 ;;;###autoload |
46575 | 297 (defun warn (message &rest args) |
298 "Display a warning message made from (format MESSAGE ARGS...). | |
299 Aside from generating the message with `format', | |
46696
6caa78f4752d
(lwarn, warn): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
46656
diff
changeset
|
300 this is equivalent to `display-warning', using |
46575 | 301 `emacs' as the group and `:warning' as the level." |
302 (display-warning 'emacs (apply 'format message args))) | |
303 | |
46646 | 304 (provide 'warnings) |
305 | |
46575 | 306 ;;; warnings.el ends here |