Subject: bug#33654: 27.0.50; No record of init file errors printed in *Messages*

From: martin rudalics <[email-masked]>
Date: Sun, 09 Dec 2018 09:26:55 +0100

> Maybe we could add something to window-setup-hook when we have delayed
 > warnings to display after startup?

I'd leave 'window-setup-hook' alone and do something similar to the
attached patch.  We could also try "(reusable-frames . visible)" there
which should put any frame already showing *Warnings* on top of the
others (at least here it does that), but not all window managers out
there might comply.

Here I neither use desktop nor multiple frames.  So please test the
patch with the originally posted desktop saved multiple frames setup.

Thanks, martin
diff --git a/lisp/startup.el b/lisp/startup.el
index a7b40b7..ad19934 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -708,7 +708,12 @@ normal-top-level
 	(if (fboundp 'font-menu-add-default)
 	    (font-menu-add-default))
 	(unless inhibit-startup-hooks
-	  (run-hooks 'window-setup-hook))))
+          ;; Display *Warnings* on selected frame if they happen to be
+          ;; shown elsewhere.
+          (let ((buffer (get-buffer "*Warnings*")))
+            (when (buffer-live-p buffer)
+              (display-buffer buffer '(nil (reusable-frames . nil)))))
+          (run-hooks 'window-setup-hook))))
     ;; Subprocesses of Emacs do not have direct access to the terminal, so
     ;; unless told otherwise they should only assume a dumb terminal.
     ;; We are careful to do it late (after term-setup-hook), although the
@@ -2584,6 +2589,12 @@ command-line-1
         (when (fboundp 'frame-notice-user-settings)
           (frame-notice-user-settings))
 
+        ;; Display *Warnings* on selected frame if they happen to be
+        ;; shown elsewhere.
+        (let ((buffer (get-buffer "*Warnings*")))
+          (when (buffer-live-p buffer)
+            (display-buffer buffer '(nil (reusable-frames . nil)))))
+
         ;; If there are no switches to process, we might as well
         ;; run this hook now, and there may be some need to do it
         ;; before doing any output.