aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2003-08-06 01:09:33 +0000
committerRichard M. Stallman2003-08-06 01:09:33 +0000
commit10b6c9320f8c37bb4258841f2e5dcbb5ff72887b (patch)
tree751be274ef61ba0cc3746735d00186664a735f10
parent9e31e67b6f2286a3ce34cf4633875a2ec16664cf (diff)
downloademacs-10b6c9320f8c37bb4258841f2e5dcbb5ff72887b.tar.gz
emacs-10b6c9320f8c37bb4258841f2e5dcbb5ff72887b.zip
Doc fixes, args renamed.
(warning-type-format): Renamed from warning-group-format.
-rw-r--r--lisp/emacs-lisp/warnings.el66
1 files changed, 33 insertions, 33 deletions
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 4d0354236a8..0c9255a93e0 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -43,7 +43,7 @@
43Each element looks like (LEVEL STRING FUNCTION) and 43Each element looks like (LEVEL STRING FUNCTION) and
44defines LEVEL as a severity level. STRING specifies the 44defines LEVEL as a severity level. STRING specifies the
45description of this level. STRING should use `%s' to 45description of this level. STRING should use `%s' to
46specify where to put the warning group information, 46specify where to put the warning type information,
47or it can omit the `%s' so as not to include that information. 47or it can omit the `%s' so as not to include that information.
48 48
49The optional FUNCTION, if non-nil, is a function to call 49The optional FUNCTION, if non-nil, is a function to call
@@ -91,26 +91,26 @@ the warning is completely ignored."
91 91
92(defcustom warning-suppress-log-types nil 92(defcustom warning-suppress-log-types nil
93 "List of warning types that should not be logged. 93 "List of warning types that should not be logged.
94If any element of this list matches the GROUP argument to `display-warning', 94If any element of this list matches the TYPE argument to `display-warning',
95the warning is completely ignored. 95the warning is completely ignored.
96The element must match the first elements of GROUP. 96The element must match the first elements of TYPE.
97Thus, (foo bar) as an element matches (foo bar) 97Thus, (foo bar) as an element matches (foo bar)
98or (foo bar ANYTHING...) as GROUP. 98or (foo bar ANYTHING...) as TYPE.
99If GROUP is a symbol FOO, that is equivalent to the list (FOO), 99If TYPE is a symbol FOO, that is equivalent to the list (FOO),
100so only the element (FOO) will match it." 100so only the element (FOO) will match it."
101 :group 'warnings 101 :group 'warnings
102 :type '(repeat (repeat symbol)) 102 :type '(repeat (repeat symbol))
103 :version "21.4") 103 :version "21.4")
104 104
105(defcustom warning-suppress-types nil 105(defcustom warning-suppress-types nil
106 "Custom groups for warnings not to display immediately. 106 "List of warning types not to display immediately.
107If any element of this list matches the GROUP argument to `display-warning', 107If any element of this list matches the TYPE argument to `display-warning',
108the warning is logged nonetheless, but the warnings buffer is 108the warning is logged nonetheless, but the warnings buffer is
109not immediately displayed. 109not immediately displayed.
110The element must match an initial segment of the list GROUP. 110The element must match an initial segment of the list TYPE.
111Thus, (foo bar) as an element matches (foo bar) 111Thus, (foo bar) as an element matches (foo bar)
112or (foo bar ANYTHING...) as GROUP. 112or (foo bar ANYTHING...) as TYPE.
113If GROUP is a symbol FOO, that is equivalent to the list (FOO), 113If TYPE is a symbol FOO, that is equivalent to the list (FOO),
114so only the element (FOO) will match it. 114so only the element (FOO) will match it.
115See also `warning-suppress-log-types'." 115See also `warning-suppress-log-types'."
116 :group 'warnings 116 :group 'warnings
@@ -155,9 +155,9 @@ also call that function before the next warning.")
155;;; safely, testing the existing value, before they call one of the 155;;; safely, testing the existing value, before they call one of the
156;;; warnings functions. 156;;; warnings functions.
157;;;###autoload 157;;;###autoload
158(defvar warning-group-format " (%s)" 158(defvar warning-type-format " (%s)"
159 "Format for displaying the warning group in the warning message. 159 "Format for displaying the warning type in the warning message.
160The result of formatting the group this way gets included in the 160The result of formatting the type this way gets included in the
161message under the control of the string in `warning-levels'.") 161message under the control of the string in `warning-levels'.")
162 162
163(defun warning-numeric-level (level) 163(defun warning-numeric-level (level)
@@ -166,19 +166,19 @@ message under the control of the string in `warning-levels'.")
166 (link (memq elt warning-levels))) 166 (link (memq elt warning-levels)))
167 (length link))) 167 (length link)))
168 168
169(defun warning-suppress-p (group suppress-list) 169(defun warning-suppress-p (type suppress-list)
170 "Non-nil if a warning with group GROUP should be suppressed. 170 "Non-nil if a warning with type TYPE should be suppressed.
171SUPPRESS-LIST is the list of kinds of warnings to suppress." 171SUPPRESS-LIST is the list of kinds of warnings to suppress."
172 (let (some-match) 172 (let (some-match)
173 (dolist (elt suppress-list) 173 (dolist (elt suppress-list)
174 (if (symbolp group) 174 (if (symbolp type)
175 ;; If GROUP is a symbol, the ELT must be (GROUP). 175 ;; If TYPE is a symbol, the ELT must be (TYPE).
176 (if (and (consp elt) 176 (if (and (consp elt)
177 (eq (car elt) group) 177 (eq (car elt) type)
178 (null (cdr elt))) 178 (null (cdr elt)))
179 (setq some-match t)) 179 (setq some-match t))
180 ;; If GROUP is a list, ELT must match it or some initial segment of it. 180 ;; If TYPE is a list, ELT must match it or some initial segment of it.
181 (let ((tem1 group) 181 (let ((tem1 type)
182 (tem2 elt) 182 (tem2 elt)
183 (match t)) 183 (match t))
184 ;; Check elements of ELT until we run out of them. 184 ;; Check elements of ELT until we run out of them.
@@ -187,7 +187,7 @@ SUPPRESS-LIST is the list of kinds of warnings to suppress."
187 (setq match nil)) 187 (setq match nil))
188 (setq tem1 (cdr tem1) 188 (setq tem1 (cdr tem1)
189 tem2 (cdr tem2))) 189 tem2 (cdr tem2)))
190 ;; If ELT is an initial segment of GROUP, MATCH is t now. 190 ;; If ELT is an initial segment of TYPE, MATCH is t now.
191 ;; So set SOME-MATCH. 191 ;; So set SOME-MATCH.
192 (if match 192 (if match
193 (setq some-match t))))) 193 (setq some-match t)))))
@@ -196,10 +196,10 @@ SUPPRESS-LIST is the list of kinds of warnings to suppress."
196 some-match)) 196 some-match))
197 197
198;;;###autoload 198;;;###autoload
199(defun display-warning (group message &optional level buffer-name) 199(defun display-warning (type message &optional level buffer-name)
200 "Display a warning message, MESSAGE. 200 "Display a warning message, MESSAGE.
201GROUP should be a custom group name (a symbol), 201TYPE is the warning type: either a custom group name (a symbol),
202or else a list of symbols whose first element is a custom group name. 202or a list of symbols whose first element is a custom group name.
203\(The rest of the symbols represent subcategories, for warning purposes 203\(The rest of the symbols represent subcategories, for warning purposes
204only, and you can use whatever symbols you like.) 204only, and you can use whatever symbols you like.)
205 205
@@ -224,8 +224,8 @@ See also `warning-series', `warning-prefix-function' and
224 (setq level (cdr (assq level warning-level-aliases)))) 224 (setq level (cdr (assq level warning-level-aliases))))
225 (or (< (warning-numeric-level level) 225 (or (< (warning-numeric-level level)
226 (warning-numeric-level warning-minimum-log-level)) 226 (warning-numeric-level warning-minimum-log-level))
227 (warning-suppress-p group warning-suppress-log-types) 227 (warning-suppress-p type warning-suppress-log-types)
228 (let* ((groupname (if (consp group) (car group) group)) 228 (let* ((typename (if (consp type) (car type) type))
229 (buffer (get-buffer-create (or buffer-name "*Warnings*"))) 229 (buffer (get-buffer-create (or buffer-name "*Warnings*")))
230 (level-info (assq level warning-levels)) 230 (level-info (assq level warning-levels))
231 start end) 231 start end)
@@ -243,7 +243,7 @@ See also `warning-series', `warning-prefix-function' and
243 (setq level-info (funcall warning-prefix-function 243 (setq level-info (funcall warning-prefix-function
244 level level-info))) 244 level level-info)))
245 (insert (format (nth 1 level-info) 245 (insert (format (nth 1 level-info)
246 (format warning-group-format groupname)) 246 (format warning-type-format typename))
247 message) 247 message)
248 (newline) 248 (newline)
249 (when (and warning-fill-prefix (not (string-match "\n" message))) 249 (when (and warning-fill-prefix (not (string-match "\n" message)))
@@ -273,7 +273,7 @@ See also `warning-series', `warning-prefix-function' and
273 ;; immediate display. 273 ;; immediate display.
274 (or (< (warning-numeric-level level) 274 (or (< (warning-numeric-level level)
275 (warning-numeric-level warning-minimum-level)) 275 (warning-numeric-level warning-minimum-level))
276 (warning-suppress-p group warning-suppress-types) 276 (warning-suppress-p type warning-suppress-types)
277 (let ((window (display-buffer buffer))) 277 (let ((window (display-buffer buffer)))
278 (when (and (markerp warning-series) 278 (when (and (markerp warning-series)
279 (eq (marker-buffer warning-series) buffer)) 279 (eq (marker-buffer warning-series) buffer))
@@ -281,13 +281,13 @@ See also `warning-series', `warning-prefix-function' and
281 (sit-for 0))))))) 281 (sit-for 0)))))))
282 282
283;;;###autoload 283;;;###autoload
284(defun lwarn (group level message &rest args) 284(defun lwarn (type level message &rest args)
285 "Display a warning message made from (format MESSAGE ARGS...). 285 "Display a warning message made from (format MESSAGE ARGS...).
286Aside from generating the message with `format', 286Aside from generating the message with `format',
287this is equivalent to `display-warning'. 287this is equivalent to `display-warning'.
288 288
289GROUP should be a custom group name (a symbol). 289TYPE is the warning type: either a custom group name (a symbol).
290or else a list of symbols whose first element is a custom group name. 290or a list of symbols whose first element is a custom group name.
291\(The rest of the symbols represent subcategories and 291\(The rest of the symbols represent subcategories and
292can be whatever you like.) 292can be whatever you like.)
293 293
@@ -296,14 +296,14 @@ LEVEL should be either :warning, :error, or :emergency.
296 if you do not attend to it promptly. 296 if you do not attend to it promptly.
297:error -- invalid data or circumstances. 297:error -- invalid data or circumstances.
298:warning -- suspicious data or circumstances." 298:warning -- suspicious data or circumstances."
299 (display-warning group (apply 'format message args) level)) 299 (display-warning type (apply 'format message args) level))
300 300
301;;;###autoload 301;;;###autoload
302(defun warn (message &rest args) 302(defun warn (message &rest args)
303 "Display a warning message made from (format MESSAGE ARGS...). 303 "Display a warning message made from (format MESSAGE ARGS...).
304Aside from generating the message with `format', 304Aside from generating the message with `format',
305this is equivalent to `display-warning', using 305this is equivalent to `display-warning', using
306`emacs' as the group and `:warning' as the level." 306`emacs' as the type and `:warning' as the level."
307 (display-warning 'emacs (apply 'format message args))) 307 (display-warning 'emacs (apply 'format message args)))
308 308
309(provide 'warnings) 309(provide 'warnings)