summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/warnings.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/warnings.el')
-rw-r--r--lisp/emacs-lisp/warnings.el26
1 files changed, 18 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 8e5ae6be365..1207353ba30 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -68,6 +68,7 @@ Each element looks like (ALIAS . LEVEL) and defines ALIAS as
equivalent to LEVEL. LEVEL must be defined in `warning-levels';
it may not itself be an alias.")
+(defvaralias 'display-warning-minimum-level 'warning-minimum-level)
(defcustom warning-minimum-level :warning
"Minimum severity level for displaying the warning buffer.
If a warning's severity level is lower than this,
@@ -77,8 +78,8 @@ is not immediately displayed. See also `warning-minimum-log-level'."
:type '(choice (const :emergency) (const :error)
(const :warning) (const :debug))
:version "22.1")
-(defvaralias 'display-warning-minimum-level 'warning-minimum-level)
+(defvaralias 'log-warning-minimum-level 'warning-minimum-log-level)
(defcustom warning-minimum-log-level :warning
"Minimum severity level for logging a warning.
If a warning severity level is lower than this,
@@ -89,7 +90,6 @@ because warnings not logged aren't displayed either."
:type '(choice (const :emergency) (const :error)
(const :warning) (const :debug))
:version "22.1")
-(defvaralias 'log-warning-minimum-level 'warning-minimum-log-level)
(defcustom warning-suppress-log-types nil
"List of warning types that should not be logged.
@@ -153,6 +153,11 @@ also call that function before the next warning.")
(defvar warning-fill-prefix nil
"Non-nil means fill each warning text using this string as `fill-prefix'.")
+;; I don't see why it can't just use the buffer-local fill-column,
+;; but at least this is better than hard-coding 78.
+(defvar warning-fill-column 78
+ "Value to use for `fill-column' when filling warnings.")
+
;; The autoload cookie is so that programs can bind this variable
;; safely, testing the existing value, before they call one of the
;; warnings functions.
@@ -222,8 +227,9 @@ has to create the buffer, it disables undo in the buffer.
See the `warnings' custom group for user customization features.
-See also `warning-series', `warning-prefix-function' and
-`warning-fill-prefix' for additional programming features."
+See also `warning-series', `warning-prefix-function',
+`warning-fill-prefix', and `warning-fill-column' for additional
+programming features."
(if (not (or after-init-time noninteractive (daemonp)))
;; Ensure warnings that happen early in the startup sequence
;; are visible when startup completes (bug#20792).
@@ -241,11 +247,15 @@ See also `warning-series', `warning-prefix-function' and
(old (get-buffer buffer-name))
(buffer (or old (get-buffer-create buffer-name)))
(level-info (assq level warning-levels))
+ ;; `newline' may be unbound during bootstrap.
+ (newline (if (fboundp 'newline) #'newline
+ (lambda () (insert "\n"))))
start end)
(with-current-buffer buffer
;; If we created the buffer, disable undo.
(unless old
- (special-mode)
+ (when (fboundp 'special-mode) ; Undefined during bootstrap.
+ (special-mode))
(setq buffer-read-only t)
(setq buffer-undo-list t))
(goto-char (point-max))
@@ -256,7 +266,7 @@ See also `warning-series', `warning-prefix-function' and
(funcall warning-series)))))
(let ((inhibit-read-only t))
(unless (bolp)
- (newline))
+ (funcall newline))
(setq start (point))
(if warning-prefix-function
(setq level-info (funcall warning-prefix-function
@@ -264,10 +274,10 @@ See also `warning-series', `warning-prefix-function' and
(insert (format (nth 1 level-info)
(format warning-type-format typename))
message)
- (newline)
+ (funcall newline)
(when (and warning-fill-prefix (not (string-match "\n" message)))
(let ((fill-prefix warning-fill-prefix)
- (fill-column 78))
+ (fill-column warning-fill-column))
(fill-region start (point))))
(setq end (point)))
(when (and (markerp warning-series)