]> git.eshelyaron.com Git - emacs.git/commitdiff
(display-warning): Issue a message if called during daemon
authorChong Yidong <cyd@stupidchicken.com>
Sat, 11 Oct 2008 22:06:52 +0000 (22:06 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sat, 11 Oct 2008 22:06:52 +0000 (22:06 +0000)
initialization.

lisp/emacs-lisp/warnings.el

index a6c77d4c5a03372b349464c4601b83b9a009aaec..fdfe8a9efd0bac42517fc5c6c8cd5492072cf2b1 100644 (file)
@@ -268,7 +268,7 @@ See also `warning-series', `warning-prefix-function' and
            (goto-char warning-series)))
        (if (nth 2 level-info)
            (funcall (nth 2 level-info)))
-       (if noninteractive
+     (cond (noninteractive
            ;; Noninteractively, take the text we inserted
            ;; in the warnings buffer and print it.
            ;; Do this unconditionally, since there is no way
@@ -280,17 +280,28 @@ See also `warning-series', `warning-prefix-function' and
                (goto-char end)
                (if (bolp)
                    (forward-char -1))
-               (message "%s" (buffer-substring start (point)))))
-         ;; 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)))))))
+               (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))))))))
 \f
 ;;;###autoload
 (defun lwarn (type level message &rest args)