aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2018-05-25 21:37:17 -0400
committerNoam Postavsky2018-06-12 07:40:33 -0400
commit2634d867b66ddff568048ce664f003ae8950bdfa (patch)
tree092f9967f3831bbfda374ea3a5cdc8062566b3dd
parent61f5d6311c6757ad5c7883d737bbbf2407355940 (diff)
downloademacs-2634d867b66ddff568048ce664f003ae8950bdfa.tar.gz
emacs-2634d867b66ddff568048ce664f003ae8950bdfa.zip
Let display-warning work during bootstrap
* lisp/emacs-lisp/warnings.el (display-warning): Only call `special-mode' and `newline' if they are `fbound'.
-rw-r--r--lisp/emacs-lisp/warnings.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 665733181cb..c4d97ceab03 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -241,11 +241,15 @@ See also `warning-series', `warning-prefix-function' and
241 (old (get-buffer buffer-name)) 241 (old (get-buffer buffer-name))
242 (buffer (or old (get-buffer-create buffer-name))) 242 (buffer (or old (get-buffer-create buffer-name)))
243 (level-info (assq level warning-levels)) 243 (level-info (assq level warning-levels))
244 ;; `newline' may be unbound during bootstrap.
245 (newline (if (fboundp 'newline) #'newline
246 (lambda () (insert "\n"))))
244 start end) 247 start end)
245 (with-current-buffer buffer 248 (with-current-buffer buffer
246 ;; If we created the buffer, disable undo. 249 ;; If we created the buffer, disable undo.
247 (unless old 250 (unless old
248 (special-mode) 251 (when (fboundp 'special-mode) ; Undefined during bootstrap.
252 (special-mode))
249 (setq buffer-read-only t) 253 (setq buffer-read-only t)
250 (setq buffer-undo-list t)) 254 (setq buffer-undo-list t))
251 (goto-char (point-max)) 255 (goto-char (point-max))
@@ -256,7 +260,7 @@ See also `warning-series', `warning-prefix-function' and
256 (funcall warning-series))))) 260 (funcall warning-series)))))
257 (let ((inhibit-read-only t)) 261 (let ((inhibit-read-only t))
258 (unless (bolp) 262 (unless (bolp)
259 (newline)) 263 (funcall newline))
260 (setq start (point)) 264 (setq start (point))
261 (if warning-prefix-function 265 (if warning-prefix-function
262 (setq level-info (funcall warning-prefix-function 266 (setq level-info (funcall warning-prefix-function
@@ -264,7 +268,7 @@ See also `warning-series', `warning-prefix-function' and
264 (insert (format (nth 1 level-info) 268 (insert (format (nth 1 level-info)
265 (format warning-type-format typename)) 269 (format warning-type-format typename))
266 message) 270 message)
267 (newline) 271 (funcall newline)
268 (when (and warning-fill-prefix (not (string-match "\n" message))) 272 (when (and warning-fill-prefix (not (string-match "\n" message)))
269 (let ((fill-prefix warning-fill-prefix) 273 (let ((fill-prefix warning-fill-prefix)
270 (fill-column 78)) 274 (fill-column 78))