reddit / emacs

startup.el overwriting variables in ~/.emacs

CountMoosuch · 2022-07-20 06:51
I am trying to disable the splash screen by default when opening Emacs. Everything I tried from the many help threads for this very problem failed, so I tried `C-h v inhibit-startup-screen` to see if these variables were indeed being set correctly. In fact, the value of `inhibit-startup-screen` was `nil`, and it is being set by `startup.el`. How can I have `startup.el` not overwrite my Emacs configuration file? EDIT: Found the solution. There were some errors in loading the Emacs config file, however the splash/startup screen hid those errors, so I never knew there were any problems. When the config file couldn't finish loading, it didn't get to my `(setq inhibit-startup-screen t)` instruction, hence it used the default `startup.el` setting. Resolving those errors meant that the config file would load entirely, and indeed the startup screen would be inhibited.
7890yuiop · 2022-07-20 07:21
`startup.el` (and everything it loads) are pre-loaded / baked into the Emacs executable (or the associated portable dump file, nowadays). The `inhibit-startup-screen` variable is defined in there, but that is certainly not overwriting your init file (which necessarily gets loaded later). So your problem isn't what you thought it was. Show what you're actually doing.
CountMoosuch · 2022-07-20 07:38
Thanks for your response 7890yuiop. As mentioned, I open an emacs session (which loads my ~/.emacs config file), and when I inspect the variable using C-h v inhibit-startup-screen, the help says that it is being set by setup.el, despite having the line (setq inhibit-startup-screen t) in my config file. I’m not sure what you mean by “show wha you are actually doing”, as this is what I am “actually” doing
whudwl · 2022-07-20 08:00
just remove everything in your .emacs and leave only **(setq inhibit-startup-screen t)** and see what happens? also my emacs tells me **inhibit-startup-screen** is **defined** in startup.el. you said emacs told you the variable is being **set** by setup.el, is that so?
CountMoosuch · 2022-07-20 09:01
Okay, after some debugging I found the issue. I’ll update the post to solved.
7890yuiop · 2022-07-20 09:07
> I’m not sure what you mean by “show wha you are actually doing”, as this is what I am “actually” doing I mean that "Everything I tried from the many help threads for this very problem failed" tells us nothing whatsoever about what you are doing. OTOH this: > despite having the line `(setq inhibit-startup-screen t)` in my config file. does indeed show us what you are doing. If you don't show what you're doing, people can't point out problems (or the lack thereof) with the approach. It's best to include such information from the outset.
CountMoosuch · 2022-07-20 09:16
I see what you’re saying, but the problem was never about setting the correct variables to inhibit the startup screen. The problem was only ever about the variable never even being set, despite it being in my config file. I didn’t ever consider it relevant to repeat the many help threads you can get by googling “how to suppress startup screen emacs”—and indeed it wasn’t relevant to the solution.
7890yuiop · 2022-07-20 09:51
What you've specifically tried so far (or at minimum what your current failing attempt looks like), is relevant *every single time you ask for help*. It's the only thing that the people who might try to help you have to go by. Otherwise you are asking people to *guess* what you've done. "Despite it being in my config file" could mean a dozen different things, eleven of which might be wrong in different ways. We need to see what you've done.
CountMoosuch · 2022-07-20 10:08
Fair call, thank you for the feedback, I will go into more depth in future. All the best
onetom · 2022-07-20 13:17
it's interesting you haven't seen any errors. i usually get a separate window below the startup screen or scratch buffer which tells me to restart Emacs with the `-debug-init` option. u should also check the `*Messages*` buffer with `C-h e` aka `view-echo-area-messages`. u can remember the shortcut as *H*elp *E*rrors, for example
CountMoosuch · 2022-07-20 18:56
I got that window telling me to check —debug-unit only when I start emacs with -nw. In the gui I had to switch away from the splash screen to show the warnings/messages screen Thanks for the mnemonic for that shortcut!