2003-05-30 23:31:15 +00:00
|
|
|
|
;;; warnings.el --- log and display warnings
|
|
|
|
|
|
2011-01-25 04:08:28 +00:00
|
|
|
|
;; Copyright (C) 2002-2011 Free Software Foundation, Inc.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
|
|
|
|
|
;; Maintainer: FSF
|
|
|
|
|
;; Keywords: internal
|
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 03:21:21 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2003-05-30 23:31:15 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:21:21 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 03:21:21 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; This file implements the entry points `warn', `lwarn'
|
2004-03-22 07:48:01 +00:00
|
|
|
|
;; and `display-warning'.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(defgroup warnings nil
|
|
|
|
|
"Log and display warnings."
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1"
|
2003-05-30 23:31:15 +00:00
|
|
|
|
:group 'lisp)
|
|
|
|
|
|
|
|
|
|
(defvar warning-levels
|
|
|
|
|
'((:emergency "Emergency%s: " ding)
|
|
|
|
|
(:error "Error%s: ")
|
|
|
|
|
(:warning "Warning%s: ")
|
|
|
|
|
(:debug "Debug%s: "))
|
|
|
|
|
"List of severity level definitions for `display-warning'.
|
|
|
|
|
Each element looks like (LEVEL STRING FUNCTION) and
|
|
|
|
|
defines LEVEL as a severity level. STRING specifies the
|
|
|
|
|
description of this level. STRING should use `%s' to
|
2003-08-06 01:09:33 +00:00
|
|
|
|
specify where to put the warning type information,
|
2003-05-30 23:31:15 +00:00
|
|
|
|
or it can omit the `%s' so as not to include that information.
|
|
|
|
|
|
|
|
|
|
The optional FUNCTION, if non-nil, is a function to call
|
|
|
|
|
with no arguments, to get the user's attention.
|
|
|
|
|
|
|
|
|
|
The standard levels are :emergency, :error, :warning and :debug.
|
|
|
|
|
See `display-warning' for documentation of their meanings.
|
|
|
|
|
Level :debug is ignored by default (see `warning-minimum-level').")
|
|
|
|
|
(put 'warning-levels 'risky-local-variable t)
|
|
|
|
|
|
|
|
|
|
;; These are for compatibility with XEmacs.
|
|
|
|
|
;; I don't think there is any chance of designing meaningful criteria
|
|
|
|
|
;; to distinguish so many levels.
|
|
|
|
|
(defvar warning-level-aliases
|
|
|
|
|
'((emergency . :emergency)
|
|
|
|
|
(error . :error)
|
|
|
|
|
(warning . :warning)
|
|
|
|
|
(notice . :warning)
|
|
|
|
|
(info . :warning)
|
|
|
|
|
(critical . :emergency)
|
|
|
|
|
(alarm . :emergency))
|
|
|
|
|
"Alist of aliases for severity levels for `display-warning'.
|
2011-05-05 00:06:10 +00:00
|
|
|
|
Each element looks like (ALIAS . LEVEL) and defines ALIAS as
|
|
|
|
|
equivalent to LEVEL. LEVEL must be defined in `warning-levels';
|
2003-05-30 23:31:15 +00:00
|
|
|
|
it may not itself be an alias.")
|
|
|
|
|
|
|
|
|
|
(defcustom warning-minimum-level :warning
|
|
|
|
|
"Minimum severity level for displaying the warning buffer.
|
|
|
|
|
If a warning's severity level is lower than this,
|
|
|
|
|
the warning is logged in the warnings buffer, but the buffer
|
|
|
|
|
is not immediately displayed. See also `warning-minimum-log-level'."
|
|
|
|
|
:group 'warnings
|
2005-06-17 11:49:17 +00:00
|
|
|
|
:type '(choice (const :emergency) (const :error)
|
|
|
|
|
(const :warning) (const :debug))
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1")
|
2003-05-30 23:31:15 +00:00
|
|
|
|
(defvaralias 'display-warning-minimum-level 'warning-minimum-level)
|
|
|
|
|
|
|
|
|
|
(defcustom warning-minimum-log-level :warning
|
|
|
|
|
"Minimum severity level for logging a warning.
|
|
|
|
|
If a warning severity level is lower than this,
|
2005-06-17 11:49:17 +00:00
|
|
|
|
the warning is completely ignored.
|
|
|
|
|
Value must be lower or equal than `warning-minimum-level',
|
|
|
|
|
because warnings not logged aren't displayed either."
|
2003-05-30 23:31:15 +00:00
|
|
|
|
:group 'warnings
|
2005-06-17 11:49:17 +00:00
|
|
|
|
:type '(choice (const :emergency) (const :error)
|
|
|
|
|
(const :warning) (const :debug))
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1")
|
2003-05-30 23:31:15 +00:00
|
|
|
|
(defvaralias 'log-warning-minimum-level 'warning-minimum-log-level)
|
|
|
|
|
|
|
|
|
|
(defcustom warning-suppress-log-types nil
|
|
|
|
|
"List of warning types that should not be logged.
|
2003-08-06 01:09:33 +00:00
|
|
|
|
If any element of this list matches the TYPE argument to `display-warning',
|
2003-05-30 23:31:15 +00:00
|
|
|
|
the warning is completely ignored.
|
2003-08-06 01:09:33 +00:00
|
|
|
|
The element must match the first elements of TYPE.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
Thus, (foo bar) as an element matches (foo bar)
|
2003-08-06 01:09:33 +00:00
|
|
|
|
or (foo bar ANYTHING...) as TYPE.
|
|
|
|
|
If TYPE is a symbol FOO, that is equivalent to the list (FOO),
|
2003-05-30 23:31:15 +00:00
|
|
|
|
so only the element (FOO) will match it."
|
|
|
|
|
:group 'warnings
|
|
|
|
|
:type '(repeat (repeat symbol))
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1")
|
2003-05-30 23:31:15 +00:00
|
|
|
|
|
|
|
|
|
(defcustom warning-suppress-types nil
|
2003-08-06 01:09:33 +00:00
|
|
|
|
"List of warning types not to display immediately.
|
|
|
|
|
If any element of this list matches the TYPE argument to `display-warning',
|
2003-05-30 23:31:15 +00:00
|
|
|
|
the warning is logged nonetheless, but the warnings buffer is
|
|
|
|
|
not immediately displayed.
|
2003-08-06 01:09:33 +00:00
|
|
|
|
The element must match an initial segment of the list TYPE.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
Thus, (foo bar) as an element matches (foo bar)
|
2003-08-06 01:09:33 +00:00
|
|
|
|
or (foo bar ANYTHING...) as TYPE.
|
|
|
|
|
If TYPE is a symbol FOO, that is equivalent to the list (FOO),
|
2003-05-30 23:31:15 +00:00
|
|
|
|
so only the element (FOO) will match it.
|
|
|
|
|
See also `warning-suppress-log-types'."
|
|
|
|
|
:group 'warnings
|
|
|
|
|
:type '(repeat (repeat symbol))
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1")
|
2003-05-30 23:31:15 +00:00
|
|
|
|
|
2010-09-19 00:05:26 +00:00
|
|
|
|
;; The autoload cookie is so that programs can bind this variable
|
|
|
|
|
;; safely, testing the existing value, before they call one of the
|
|
|
|
|
;; warnings functions.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defvar warning-prefix-function nil
|
|
|
|
|
"Function to generate warning prefixes.
|
|
|
|
|
This function, if non-nil, is called with two arguments,
|
|
|
|
|
the severity level and its entry in `warning-levels',
|
|
|
|
|
and should return the entry that should actually be used.
|
|
|
|
|
The warnings buffer is current when this function is called
|
|
|
|
|
and the function can insert text in it. This text becomes
|
|
|
|
|
the beginning of the warning.")
|
|
|
|
|
|
2010-09-19 00:05:26 +00:00
|
|
|
|
;; The autoload cookie is so that programs can bind this variable
|
|
|
|
|
;; safely, testing the existing value, before they call one of the
|
|
|
|
|
;; warnings functions.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defvar warning-series nil
|
|
|
|
|
"Non-nil means treat multiple `display-warning' calls as a series.
|
|
|
|
|
A marker indicates a position in the warnings buffer
|
|
|
|
|
which is the start of the current series; it means that
|
|
|
|
|
additional warnings in the same buffer should not move point.
|
2011-05-05 00:06:10 +00:00
|
|
|
|
If t, the next warning begins a series (and stores a marker here).
|
2003-05-30 23:31:15 +00:00
|
|
|
|
A symbol with a function definition is like t, except
|
|
|
|
|
also call that function before the next warning.")
|
|
|
|
|
(put 'warning-series 'risky-local-variable t)
|
|
|
|
|
|
2010-09-19 00:05:26 +00:00
|
|
|
|
;; The autoload cookie is so that programs can bind this variable
|
|
|
|
|
;; safely, testing the existing value, before they call one of the
|
|
|
|
|
;; warnings functions.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defvar warning-fill-prefix nil
|
|
|
|
|
"Non-nil means fill each warning text using this string as `fill-prefix'.")
|
|
|
|
|
|
2010-09-19 00:05:26 +00:00
|
|
|
|
;; The autoload cookie is so that programs can bind this variable
|
|
|
|
|
;; safely, testing the existing value, before they call one of the
|
|
|
|
|
;; warnings functions.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
;;;###autoload
|
* textmodes/tex-mode.el (tex-alt-dvi-print-command)
(tex-dvi-print-command, tex-bibtex-command, tex-start-commands)
(tex-start-options, slitex-run-command, latex-run-command)
(tex-run-command, tex-directory):
* textmodes/ispell.el (ispell-html-skip-alists)
(ispell-tex-skip-alists, ispell-tex-skip-alists):
* textmodes/fill.el (adaptive-fill-first-line-regexp):
(adaptive-fill-regexp):
* textmodes/dns-mode.el (auto-mode-alist):
* progmodes/python.el (interpreter-mode-alist):
* progmodes/etags.el (tags-compression-info-list):
* progmodes/etags.el (tags-file-name):
* net/browse-url.el (browse-url-galeon-program)
(browse-url-firefox-program):
* mail/sendmail.el (mail-signature-file)
(mail-citation-prefix-regexp):
* international/mule-conf.el (eight-bit):
* international/latexenc.el (latex-inputenc-coding-alist):
* international/fontset.el (x-pixel-size-width-font-regexp):
* emacs-lisp/warnings.el (warning-type-format):
* emacs-lisp/trace.el (trace-buffer):
* emacs-lisp/lisp-mode.el (lisp-interaction-mode-map)
(emacs-lisp-mode-map):
* calendar/holidays.el (holiday-solar-holidays)
(holiday-bahai-holidays, holiday-islamic-holidays)
(holiday-christian-holidays, holiday-hebrew-holidays)
(hebrew-holidays-4, hebrew-holidays-3, hebrew-holidays-2)
(hebrew-holidays-1, holiday-oriental-holidays)
(holiday-general-holidays):
* x-dnd.el (x-dnd-known-types):
* tool-bar.el (tool-bar):
* startup.el (site-run-file):
* shell.el (shell-dumb-shell-regexp):
* rfn-eshadow.el (file-name-shadow-tty-properties)
(file-name-shadow-properties):
* paths.el (remote-shell-program, news-directory):
* mouse.el ([C-down-mouse-3]):
* menu-bar.el (menu-bar-tools-menu):
* jka-cmpr-hook.el (jka-compr-load-suffixes)
(jka-compr-mode-alist-additions, jka-compr-compression-info-list)
(jka-compr-compression-info-list):
* isearch.el (search-whitespace-regexp):
* image-file.el (image-file-name-extensions):
* find-dired.el (find-ls-option):
* files.el (directory-listing-before-filename-regexp)
(directory-free-space-args, insert-directory-program)
(list-directory-brief-switches, magic-fallback-mode-alist)
(magic-fallback-mode-alist, auto-mode-interpreter-regexp)
(automount-dir-prefix):
* faces.el (face-x-resources, x-font-regexp, x-font-regexp-head)
(x-font-regexp-slant, x-font-regexp-weight, face-x-resources)
(face-font-registry-alternatives, face-font-registry-alternatives)
(face-font-family-alternatives):
* facemenu.el (facemenu-add-new-face, facemenu-background-menu)
(facemenu-foreground-menu, facemenu-face-menu):
* epa-hook.el (epa-file-name-regexp):
* dnd.el (dnd-protocol-alist):
* textmodes/rst.el (auto-mode-alist):
* button.el (default-button): Purecopy strings.
2009-11-06 05:16:23 +00:00
|
|
|
|
(defvar warning-type-format (purecopy " (%s)")
|
2003-08-06 01:09:33 +00:00
|
|
|
|
"Format for displaying the warning type in the warning message.
|
|
|
|
|
The result of formatting the type this way gets included in the
|
2003-05-30 23:31:15 +00:00
|
|
|
|
message under the control of the string in `warning-levels'.")
|
|
|
|
|
|
|
|
|
|
(defun warning-numeric-level (level)
|
|
|
|
|
"Return a numeric measure of the warning severity level LEVEL."
|
|
|
|
|
(let* ((elt (assq level warning-levels))
|
|
|
|
|
(link (memq elt warning-levels)))
|
|
|
|
|
(length link)))
|
|
|
|
|
|
2003-08-06 01:09:33 +00:00
|
|
|
|
(defun warning-suppress-p (type suppress-list)
|
|
|
|
|
"Non-nil if a warning with type TYPE should be suppressed.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
SUPPRESS-LIST is the list of kinds of warnings to suppress."
|
|
|
|
|
(let (some-match)
|
|
|
|
|
(dolist (elt suppress-list)
|
2003-08-06 01:09:33 +00:00
|
|
|
|
(if (symbolp type)
|
|
|
|
|
;; If TYPE is a symbol, the ELT must be (TYPE).
|
2003-05-30 23:31:15 +00:00
|
|
|
|
(if (and (consp elt)
|
2003-08-06 01:09:33 +00:00
|
|
|
|
(eq (car elt) type)
|
2003-05-30 23:31:15 +00:00
|
|
|
|
(null (cdr elt)))
|
|
|
|
|
(setq some-match t))
|
2003-08-06 01:09:33 +00:00
|
|
|
|
;; If TYPE is a list, ELT must match it or some initial segment of it.
|
|
|
|
|
(let ((tem1 type)
|
2003-05-30 23:31:15 +00:00
|
|
|
|
(tem2 elt)
|
|
|
|
|
(match t))
|
|
|
|
|
;; Check elements of ELT until we run out of them.
|
|
|
|
|
(while tem2
|
|
|
|
|
(if (not (equal (car tem1) (car tem2)))
|
|
|
|
|
(setq match nil))
|
|
|
|
|
(setq tem1 (cdr tem1)
|
|
|
|
|
tem2 (cdr tem2)))
|
2003-08-06 01:09:33 +00:00
|
|
|
|
;; If ELT is an initial segment of TYPE, MATCH is t now.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
;; So set SOME-MATCH.
|
|
|
|
|
(if match
|
|
|
|
|
(setq some-match t)))))
|
|
|
|
|
;; If some element of SUPPRESS-LIST matched,
|
|
|
|
|
;; we return t.
|
|
|
|
|
some-match))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2003-08-06 01:09:33 +00:00
|
|
|
|
(defun display-warning (type message &optional level buffer-name)
|
2003-05-30 23:31:15 +00:00
|
|
|
|
"Display a warning message, MESSAGE.
|
2003-08-06 01:09:33 +00:00
|
|
|
|
TYPE is the warning type: either a custom group name (a symbol),
|
|
|
|
|
or a list of symbols whose first element is a custom group name.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
\(The rest of the symbols represent subcategories, for warning purposes
|
|
|
|
|
only, and you can use whatever symbols you like.)
|
|
|
|
|
|
2005-06-17 11:49:17 +00:00
|
|
|
|
LEVEL should be either :debug, :warning, :error, or :emergency
|
|
|
|
|
\(but see `warning-minimum-level' and `warning-minimum-log-level').
|
2006-05-01 20:16:40 +00:00
|
|
|
|
Default is :warning.
|
2005-06-17 11:49:17 +00:00
|
|
|
|
|
2003-05-30 23:31:15 +00:00
|
|
|
|
:emergency -- a problem that will seriously impair Emacs operation soon
|
|
|
|
|
if you do not attend to it promptly.
|
|
|
|
|
:error -- data or circumstances that are inherently wrong.
|
|
|
|
|
:warning -- data or circumstances that are not inherently wrong,
|
|
|
|
|
but raise suspicion of a possible problem.
|
|
|
|
|
:debug -- info for debugging only.
|
|
|
|
|
|
2007-03-31 19:41:46 +00:00
|
|
|
|
BUFFER-NAME, if specified, is the name of the buffer for logging
|
|
|
|
|
the warning. By default, it is `*Warnings*'. If this function
|
|
|
|
|
has to create the buffer, it disables undo in the buffer.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
|
|
|
|
|
See the `warnings' custom group for user customization features.
|
|
|
|
|
|
|
|
|
|
See also `warning-series', `warning-prefix-function' and
|
|
|
|
|
`warning-fill-prefix' for additional programming features."
|
|
|
|
|
(unless level
|
|
|
|
|
(setq level :warning))
|
2007-03-31 19:41:46 +00:00
|
|
|
|
(unless buffer-name
|
|
|
|
|
(setq buffer-name "*Warnings*"))
|
2003-05-30 23:31:15 +00:00
|
|
|
|
(if (assq level warning-level-aliases)
|
|
|
|
|
(setq level (cdr (assq level warning-level-aliases))))
|
|
|
|
|
(or (< (warning-numeric-level level)
|
2005-06-17 11:49:17 +00:00
|
|
|
|
(warning-numeric-level warning-minimum-log-level))
|
2003-08-06 01:09:33 +00:00
|
|
|
|
(warning-suppress-p type warning-suppress-log-types)
|
|
|
|
|
(let* ((typename (if (consp type) (car type) type))
|
2007-03-31 19:41:46 +00:00
|
|
|
|
(old (get-buffer buffer-name))
|
2011-05-05 00:06:10 +00:00
|
|
|
|
(buffer (or old (get-buffer-create buffer-name)))
|
2003-05-30 23:31:15 +00:00
|
|
|
|
(level-info (assq level warning-levels))
|
|
|
|
|
start end)
|
|
|
|
|
(with-current-buffer buffer
|
2007-03-31 19:41:46 +00:00
|
|
|
|
;; If we created the buffer, disable undo.
|
|
|
|
|
(unless old
|
2010-09-19 00:05:26 +00:00
|
|
|
|
(special-mode)
|
|
|
|
|
(setq buffer-read-only t)
|
2007-03-31 19:41:46 +00:00
|
|
|
|
(setq buffer-undo-list t))
|
2003-05-30 23:31:15 +00:00
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(when (and warning-series (symbolp warning-series))
|
|
|
|
|
(setq warning-series
|
|
|
|
|
(prog1 (point-marker)
|
|
|
|
|
(unless (eq warning-series t)
|
|
|
|
|
(funcall warning-series)))))
|
2010-09-19 00:05:26 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
2011-05-05 00:06:10 +00:00
|
|
|
|
(unless (bolp)
|
|
|
|
|
(newline))
|
|
|
|
|
(setq start (point))
|
|
|
|
|
(if warning-prefix-function
|
|
|
|
|
(setq level-info (funcall warning-prefix-function
|
|
|
|
|
level level-info)))
|
|
|
|
|
(insert (format (nth 1 level-info)
|
|
|
|
|
(format warning-type-format typename))
|
|
|
|
|
message)
|
|
|
|
|
(newline)
|
|
|
|
|
(when (and warning-fill-prefix (not (string-match "\n" message)))
|
|
|
|
|
(let ((fill-prefix warning-fill-prefix)
|
|
|
|
|
(fill-column 78))
|
|
|
|
|
(fill-region start (point))))
|
|
|
|
|
(setq end (point)))
|
2003-05-30 23:31:15 +00:00
|
|
|
|
(when (and (markerp warning-series)
|
|
|
|
|
(eq (marker-buffer warning-series) buffer))
|
|
|
|
|
(goto-char warning-series)))
|
|
|
|
|
(if (nth 2 level-info)
|
|
|
|
|
(funcall (nth 2 level-info)))
|
2011-05-05 00:06:10 +00:00
|
|
|
|
(cond (noninteractive
|
|
|
|
|
;; Noninteractively, take the text we inserted
|
|
|
|
|
;; in the warnings buffer and print it.
|
|
|
|
|
;; Do this unconditionally, since there is no way
|
|
|
|
|
;; to view logged messages unless we output them.
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(save-excursion
|
|
|
|
|
;; Don't include the final newline in the arg
|
|
|
|
|
;; to `message', because it adds a newline.
|
|
|
|
|
(goto-char end)
|
|
|
|
|
(if (bolp)
|
|
|
|
|
(forward-char -1))
|
|
|
|
|
(message "%s" (buffer-substring start (point))))))
|
|
|
|
|
((and (daemonp) (null after-init-time))
|
|
|
|
|
;; Warnings assigned during daemon initialization go into
|
|
|
|
|
;; the messages buffer.
|
|
|
|
|
(message "%s"
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char end)
|
|
|
|
|
(if (bolp)
|
|
|
|
|
(forward-char -1))
|
|
|
|
|
(buffer-substring start (point))))))
|
|
|
|
|
(t
|
|
|
|
|
;; Interactively, decide whether the warning merits
|
|
|
|
|
;; immediate display.
|
|
|
|
|
(or (< (warning-numeric-level level)
|
|
|
|
|
(warning-numeric-level warning-minimum-level))
|
|
|
|
|
(warning-suppress-p type warning-suppress-types)
|
|
|
|
|
(let ((window (display-buffer buffer)))
|
|
|
|
|
(when (and (markerp warning-series)
|
|
|
|
|
(eq (marker-buffer warning-series) buffer))
|
|
|
|
|
(set-window-start window warning-series))
|
|
|
|
|
(sit-for 0))))))))
|
2003-05-30 23:31:15 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2003-08-06 01:09:33 +00:00
|
|
|
|
(defun lwarn (type level message &rest args)
|
2003-05-30 23:31:15 +00:00
|
|
|
|
"Display a warning message made from (format MESSAGE ARGS...).
|
|
|
|
|
Aside from generating the message with `format',
|
|
|
|
|
this is equivalent to `display-warning'.
|
|
|
|
|
|
2006-05-01 20:16:40 +00:00
|
|
|
|
TYPE is the warning type: either a custom group name (a symbol),
|
2003-08-06 01:09:33 +00:00
|
|
|
|
or a list of symbols whose first element is a custom group name.
|
2003-05-30 23:31:15 +00:00
|
|
|
|
\(The rest of the symbols represent subcategories and
|
|
|
|
|
can be whatever you like.)
|
|
|
|
|
|
2005-06-17 11:49:17 +00:00
|
|
|
|
LEVEL should be either :debug, :warning, :error, or :emergency
|
|
|
|
|
\(but see `warning-minimum-level' and `warning-minimum-log-level').
|
|
|
|
|
|
2003-05-30 23:31:15 +00:00
|
|
|
|
:emergency -- a problem that will seriously impair Emacs operation soon
|
|
|
|
|
if you do not attend to it promptly.
|
|
|
|
|
:error -- invalid data or circumstances.
|
2005-06-17 11:49:17 +00:00
|
|
|
|
:warning -- suspicious data or circumstances.
|
|
|
|
|
:debug -- info for debugging only."
|
2003-08-06 01:09:33 +00:00
|
|
|
|
(display-warning type (apply 'format message args) level))
|
2003-05-30 23:31:15 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun warn (message &rest args)
|
|
|
|
|
"Display a warning message made from (format MESSAGE ARGS...).
|
|
|
|
|
Aside from generating the message with `format',
|
|
|
|
|
this is equivalent to `display-warning', using
|
2003-08-06 01:09:33 +00:00
|
|
|
|
`emacs' as the type and `:warning' as the level."
|
2003-05-30 23:31:15 +00:00
|
|
|
|
(display-warning 'emacs (apply 'format message args)))
|
|
|
|
|
|
|
|
|
|
(provide 'warnings)
|
|
|
|
|
|
|
|
|
|
;;; warnings.el ends here
|