My guess is that you ran a session with tool-bar-mode
on and desktop-save-mode
on. When you exited that session, a desktop file was saved and that desktop file included tool-bar-mode
on. Now you add the three lines to turn off the three modes (but you don't turn off tool-bar-mode
explicitly in the session) and you restart emacs. The init file turns off the three modes to begin with and then restores the desktop from the saved desktop file, which turns on tool-bar-mode
since it is part of what was saved. And since it's on in this new session, it will be saved in the desktop file when you exit and the process will be repeated ad infinitum,
My suggestion is to change the order: enable desktop-save-mode
first so that the desktop file will be read to setup the current session, then turn off the three modes in the current session. That way, they will be off when the desktop file is saved at the end of the session and when emacs is restarted they are not going to be part of the saved configuration, thereby breaking the cycle.
I have not tested any of this and I don't really know what desktop-save-mode
saves, so this may be wrong, but it looks plausible to me. If you put the (desktop-save-mode 1)
first, do you still see the problem?