34 |
(:error "Error%s: ") |
(:error "Error%s: ") |
35 |
(:warning "Warning%s: ") |
(:warning "Warning%s: ") |
36 |
(:debug "Debug%s: ")) |
(:debug "Debug%s: ")) |
37 |
"List of severity level definitions for `define-warnings'. |
"List of severity level definitions for `display-warning'. |
38 |
Each element looks like (LEVEL STRING FUNCTION) and |
Each element looks like (LEVEL STRING FUNCTION) and |
39 |
defines LEVEL as a severity level. STRING is the description |
defines LEVEL as a severity level. STRING is the description |
40 |
to use in the buffer, and FUNCTION (which may be omitted) |
to use in the buffer, and FUNCTION (which may be omitted) |
86 |
The element must match the first elements of GROUP. |
The element must match the first elements of GROUP. |
87 |
Thus, (foo bar) as an element matches (foo bar) |
Thus, (foo bar) as an element matches (foo bar) |
88 |
or (foo bar ANYTHING...) as GROUP. |
or (foo bar ANYTHING...) as GROUP. |
89 |
If GROUP is a symbol FOO, that is equivalent to the list (FOO) |
If GROUP is a symbol FOO, that is equivalent to the list (FOO), |
90 |
so only the element (FOO) will match it." |
so only the element (FOO) will match it." |
91 |
:group 'warnings |
:group 'warnings |
92 |
:type '(repeat (repeat symbol)) |
:type '(repeat (repeat symbol)) |
121 |
(let* ((elt (assq level warning-levels)) |
(let* ((elt (assq level warning-levels)) |
122 |
(link (memq elt warning-levels))) |
(link (memq elt warning-levels))) |
123 |
(length link))) |
(length link))) |
124 |
|
|
125 |
(defvar warning-series nil |
(defvar warning-series nil |
126 |
"Non-nil means treat multiple `display-warning' calls as a series. |
"Non-nil means treat multiple `display-warning' calls as a series. |
127 |
An integer is a position in the warnings buffer |
An integer is a position in the warnings buffer |
171 |
;;;###autoload |
;;;###autoload |
172 |
(defun display-warning (group message &optional level buffer-name) |
(defun display-warning (group message &optional level buffer-name) |
173 |
"Display a warning message, MESSAGE. |
"Display a warning message, MESSAGE. |
174 |
GROUP should be a custom group name (a symbol). |
GROUP should be a custom group name (a symbol), |
175 |
or else a list of symbols whose first element is a custom group name. |
or else a list of symbols whose first element is a custom group name. |
176 |
\(The rest of the symbols represent subcategories, for warning purposes |
\(The rest of the symbols represent subcategories, for warning purposes |
177 |
only, and you can use whatever symbols you like.) |
only, and you can use whatever symbols you like.) |
215 |
(if warning-prefix-function |
(if warning-prefix-function |
216 |
(setq level-info (funcall warning-prefix-function |
(setq level-info (funcall warning-prefix-function |
217 |
level level-info))) |
level level-info))) |
218 |
(setq group-string (format warning-group-format groupname)) |
(insert (format (nth 1 level-info) |
219 |
(insert (format (nth 1 level-info) group-string) |
(format warning-group-format groupname)) |
220 |
message) |
message) |
221 |
(newline) |
(newline) |
222 |
(when (and warning-fill-prefix (not (string-match "\n" message))) |
(when (and warning-fill-prefix (not (string-match "\n" message))) |
238 |
;; Interactively, decide whether the warning merits |
;; Interactively, decide whether the warning merits |
239 |
;; immediate display. |
;; immediate display. |
240 |
(or (< (warning-numeric-level level) |
(or (< (warning-numeric-level level) |
241 |
(warning-numeric-level warning-minimum-level)) |
(warning-numeric-level warning-minimum-level)) |
242 |
(warning-suppress-p group warning-suppress-types) |
(warning-suppress-p group warning-suppress-types) |
243 |
(let ((window (display-buffer buffer))) |
(let ((window (display-buffer buffer))) |
244 |
(when warning-series |
(when warning-series |