spacemacs
spacemacs copied to clipboard
Add option to disable spacemacs buffer on startup
I would like to have just a scratch buffer on startup, and it seems this cannot be achieved easily at the moment. Currently I am using the following workaround:
(defun dotspacemacs/user-config ()
;; ...
(when (string= "*scratch*" (buffer-name))
(spacemacs/switch-to-scratch-buffer))
)
However, it would be nice to be able to disable it altogether with a proper configuration option. This way I wouldn't have to wait for the spacemacs buffer to be built and displayed, just to discard it immediately.
For everyone who are confused, the key point is to not switch buffer if Emacs is called with filename arguments.
+1 on that @TheBB - I like the home buffer if I'm starting without arguments.
Edit file ~/.emacs.d/core/core-spacemacs.el Comment out the following lines:
(setq inhibit-startup-screen t)
(spacemacs-buffer/goto-buffer)
to
(setq inhibit-startup-screen nil)
;; (setq inhibit-startup-screen t)
;; (spacemacs-buffer/goto-buffer)
Any update on this? So far the code from @padde is the only way I can avoid a brief flashing of the big *spacemacs*
buffer when launching emacsclient
from command line. Assuming the *scratch*
buffer is blank.
What about this?
(defun dotspacemacs/user-config ()
(kill-buffer "*spacemacs*"))
This worked https://github.com/syl20bnr/spacemacs/issues/6899#issuecomment-306805429 Thanks @ginhton
P.S. Remember to restart the daemon if a daemon is in use!
add this at dotspacemacs/user-config
(add-hook 'server-switch-hook (lambda nil ( (kill-buffer "*scratch*"))))
@ginhton this worked, thanks! But has a warning:
Warning (initialization): An error occurred while loading ‘/home/lee/.emacs.d/init.el’:
Search failed: Search in Spacemacs]
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.
And when start emacs with --debug-init, this warn disappeared
@tasmo's comment seem to do it for me - would love a built in option
I'm thinking, an spacemacs varibale should be provied that spacemacs buffer shoulnd't be created during startup, this will descrease the time of startup of spacemacs.
This snippet makes *scratch*
the initial buffer instead:
(defun dotspacemacs/user-config ()
(setq initial-buffer-choice (lambda () (get-buffer "*scratch*"))))
Mic92's suggestion doesn't seem to be working for me. The Spacemacs buffer is still shown on startup.
The variables value after starting says:
initial-buffer-choice is a variable defined in ‘startup.el’. Its value is (closure (t) nil (get-buffer "scratch")) Original value was nil
Windows 1903
#### System Info :computer: - OS: windows-nt - Emacs: 26.3 - Spacemacs: 0.300.0 - Spacemacs branch: develop (rev. 7f92a4388) - Graphic display: t - Distribution: spacemacs - Editing style: vim - Completion: helm - Layers: ```elisp (autohotkey auto-completion command-log emacs-lisp git github helm imenu-list markdown multiple-cursors org (shell :variables shell-default-shell 'shell shell-default-height 30 shell-default-position 'bottom) spell-checking syntax-checking treemacs version-control) ``` - System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS THREADS LCMS2
Mic92's suggestion doesn't seem to be working for me
Are you running emacs in daemon/server mode by chance?
@peterhoeg Yes. I do: https://github.com/Mic92/dotfiles/blob/master/nixpkgs-config/emacs.nix#L74
Are you running emacs in daemon/server mode by chance?
That first test wasn't with a running as a daemon/server setup.
But now when starting: emacs --daemon
and: emacsclient -c
Then a Spacemacs frame opens at the scratch buffer.
Redefining the following 2 functions in your .spacemacs
file removes the startup screen
(defun spacemacs-buffer/goto-buffer (&optional refresh))
(defun spacemacs-buffer/display-startup-note ())
(defun spacemacs-buffer//startup-hook ())
That being said, they are the 3 functions that would need to be investigated to disable this functionality via a variable.
Thanks @russell ....
That worked for me like a champ!
Thanks @russell, this also worked for me :)
@russell solution gives me a warning...
Error (use-package): vi-tilde-fringe/:init: No buffer named *spacemacs*
In my case I solved it by inserting the definitions in the init.el file, otherwise I got an error during the startup:
(if (not (version<= spacemacs-emacs-min-version emacs-version))
(error (concat "Your version of Emacs (%s) is too old. "
"Spacemacs requires Emacs version %s or above.")
emacs-version spacemacs-emacs-min-version)
;; Disable file-name-handlers for a speed boost during init
(let ((file-name-handler-alist nil))
(require 'core-spacemacs)
(defun spacemacs-buffer/goto-buffer (&optional refresh))
;; here the new redefined functions
(defun spacemacs-buffer/display-startup-note ())
(defun spacemacs-buffer//startup-hook ())
(spacemacs/dump-restore-load-path)
(configuration-layer/load-lock-file)
(spacemacs/init)
(configuration-layer/stable-elpa-init)
(configuration-layer/load)
(spacemacs-buffer/display-startup-note)
(spacemacs/setup-startup-hook)
(spacemacs/dump-eval-delayed-functions)
(when (and dotspacemacs-enable-server (not (spacemacs-is-dumping-p)))
(require 'server)
(when dotspacemacs-server-socket-dir
(setq server-socket-dir dotspacemacs-server-socket-dir))
(unless (server-running-p)
(message "Starting a server...")
(server-start)))))
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!