Next: , Previous: , Up: Display   [Contents][Index]


52.4 Warnings

SXEmacs contains a facility for unified display of various warnings. Unlike errors, warnings are displayed in the situations when SXEmacs encounters a problem that is recoverable, but which should be fixed for safe future operation.

For example, warnings are printed by the startup code when it encounters problems with X keysyms, when there is an error in init.el, and in other problematic situations. Unlike messages, warnings are displayed in a separate buffer, and include an explanatory message that may span across several lines. Here is an example of how a warning is displayed:

(1) (initialization/error) An error has occurred while loading ~/.config/sxemacs/init.el:

Symbol's value as variable is void: bogus-variable

To ensure normal operation, you should investigate the cause of the error
in your initialization file and remove it.  Use the `-debug-init' option
to SXEmacs to view a complete error backtrace.

Each warning has a class and a priority level. The class is a symbol describing what sort of warning this is, such as initialization, resource or key-mapping.

The warning priority level specifies how important the warning is. The recognized warning levels, in increased order of priority, are: debug, info, notice, warning, error, critical, alert and emergency.

Function: display-warning class message &optional level

This function displays a warning message message (a string). class should be a warning class symbol, as described above, or a list of such symbols. level describes the warning priority level. If unspecified, it default to warning.

(display-warning 'resource
  "Bad resource specification encountered:
something like

    Emacs*foo: bar

You should replace the * with a . in order to get proper behavior when
you use the specifier and/or `set-face-*' functions.")
---------- Warning buffer ----------
(1) (resource/warning) Bad resource specification encountered:
something like

    Emacs*foo: bar

You should replace the * with a . in order to get proper behavior when
you use the specifier and/or `set-face-*' functions.
---------- Warning buffer ----------
Function: lwarn class level message &rest args

This function displays a formatted labeled warning message. As above, class should be the warning class symbol, or a list of such symbols, and level should specify the warning priority level (warning by default).

Unlike in display-warning, message may be a formatted message, which will be, together with the rest of the arguments, passed to format.

(lwarn 'message-log 'warning
  "Error caught in `remove-message-hook': %s"
  (error-message-string e))
Variable: log-warning-minimum-level

This variable specifies the minimum level of warnings that should be generated. Warnings with level lower than defined by this variable are completely ignored, as if they never happened.

Variable: display-warning-minimum-level

This variable specifies the minimum level of warnings that should be displayed. Unlike log-warning-minimum-level, setting this function does not suppress warnings entirely—they are still generated in the ‘*Warnings*’ buffer, only they are not displayed by default.

Variable: log-warning-suppressed-classes

This variable specifies a list of classes that should not be logged or displayed. If any of the class symbols associated with a warning is the same as any of the symbols listed here, the warning will be completely ignored, as it they never happened.

Variable: display-warning-suppressed-classes

This variable specifies a list of classes that should not be logged or displayed. If any of the class symbols associated with a warning is the same as any of the symbols listed here, the warning will not be displayed. The warning will still logged in the *Warnings* buffer (unless also contained in ‘log-warning-suppressed-classes’), but the buffer will not be automatically popped up.


Next: , Previous: , Up: Display   [Contents][Index]