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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 08 Dec 2018 12:46:21 +0200

> From: "N. Jackson" <[email-masked]>
> Cc: [email-masked]
> Date: Fri, 07 Dec 2018 12:08:33 -0500
> 
> I think, perhaps, that if something were written to *Messages* to inform
> the user that there was a warning/error, and to direct them to the
> *Warnings* buffer for details, it would make it less likely that the
> user would miss the information altogether. Something like
> 
>   An initialization error occurred -- see *Warnings* buffer for details.

Don't we already use the echo area to show the error itself?

> Also, the frame that was split to display the *Warnings* buffer was not
> the one that had the focus when Emacs finished starting up. (Indeed, I
> think it might have been on the most deeply buried frame.) There is a
> very high probability I would never see a warning/error displayed so
> obscurely.
> 
> It would seem that it would be better, if it were feasible, if the
> *Warnings* buffer could be displayed in a window on the frame that
> has the focus after Emacs finishes starting up.
> 
> 
> DETAILS
> 
> Here is a detailed example of the problem. I think this might have
> really happened to me in real life (resulting in Bug##33536 [1]).
> 
> Scenario: I have a notion that it would be a good idea to remove and
> then re-install an Emacs package. I decide that to be sure that none of
> it still hanging around in memory, I should exit an restart Emacs
> between removing the package and reinstalling it. The package in this
> case happens to be bbdb from Gnu Elpa. I have
> 
>   (bbdb-initialize 'gnus 'message)
> 
> in my init file.
> 
> When Emacs starts after bbdb has been uninstalled, the above line
> results in an error. A *Warnings* buffer is displayed as follows:
> 
>   Warning (initialization): An error occurred while loading `/home/nlj/.emacs':
> 
>   Symbol's function definition is void: bbdb-initialize
> 
>   To ensure normal operation, you should investigate and remove the
>   cause of the error in your initialization file.  Start Emacs with
>   the `--debug-init' option to view a complete error backtrace.
> 
> But I don't see this error/warning message because I don't visit the
> frame on which it is displayed. After all, it's just going to be a short
> Emacs session during which all I'm going to do is install bbdb.

I'm not sure we can guarantee that the frame showing *Warnings* is
always on top, since user initialization can create any number of
frames.  Maybe Martin has some tricks up his sleeves?

> In my *Messages* buffer is displayed:
> 
>   Loading cua-base...done
>   Loading delsel...done
>   Loading desktop...done
>   Loading battery...done
>   Loading time...done
>   Loading elec-pair...done
>   Loading saveplace...done
>   Loading savehist...done
>   Loading paren...done
>   Loading /home/nlj/.recentf...done
>   Cleaning up the recentf list...done (0 removed)
>   Starting new Ispell process /usr/bin/aspell with default dictionary...
>   Loading dired-x...done
>   Setting up indent for shell type sh
>   Indentation variables are now local.
>   Indentation setup for shell type sh
>   Ispell process killed
>   Starting new Ispell process /usr/bin/aspell with default dictionary...
>   Setting up indent for shell type sh
>   Indentation variables are now local.
>   Indentation setup for shell type sh
>   Omitting...
>   Omitted 384 lines.
>   uncompressing de.map.gz...done
>   Wrote /data/projects/vc/emacs/git/emacs/.emacs.desktop.lock
>   Desktop: 7 frames, 54 buffers restored.
>   For information about GNU Emacs and the GNU system, type C-h C-a.
> 
> This shows no indication of the initialization error.

Delayed warnings are not written to *Messages*, they are written to
*Warnings* instead.  This is so they don't get discarded if *Messages*
gets too long.  You just need to become accustomed to look in
*Warnings* as you are already accustomed to look in *Messages* (which
by default is not shown in any window, right?).

> Now it might be a user error to look for an indication of start up
> problems only in *Messages*, and it might a user error to miss the
> *Warnings* buffer, but I think it would improve Emacs, were it feasible,
> if it helped the user to avoid these mistakes by mentioning the
> error/warning in *Messages*, and by displaying the *Warnings* buffer in
> a frame that isn't buried.

Mentioning that in *Messages* is problematic, as it could disappear
without a trace.  I think.