Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable spacemacs buffer on startup #6899

Open
padde opened this issue Aug 23, 2016 · 21 comments
Open

Add option to disable spacemacs buffer on startup #6899

padde opened this issue Aug 23, 2016 · 21 comments
Labels
- Mailling list - Feature request stale marked as a stale issue/pr (usually by a bot)

Comments

@padde
Copy link

padde commented Aug 23, 2016

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.

@TheBB
Copy link
Collaborator

TheBB commented Aug 23, 2016

For everyone who are confused, the key point is to not switch buffer if Emacs is called with filename arguments.

@vaz
Copy link

vaz commented Aug 24, 2016

+1 on that @TheBB - I like the home buffer if I'm starting without arguments.

@ginhton
Copy link

ginhton commented Jun 7, 2017

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)

@lzhang10
Copy link

lzhang10 commented Aug 24, 2017

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.

@tasmo
Copy link

tasmo commented Feb 10, 2018

What about this?

(defun dotspacemacs/user-config ()
  (kill-buffer "*spacemacs*"))

@thammegowda
Copy link

This worked #6899 (comment) Thanks @ginhton

P.S. Remember to restart the daemon if a daemon is in use!

@jiahut
Copy link

jiahut commented Apr 4, 2018

add this at dotspacemacs/user-config

 (add-hook 'server-switch-hook (lambda nil ( (kill-buffer "*scratch*"))))

@lixianyang
Copy link

@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

@diego898
Copy link

@tasmo's comment seem to do it for me - would love a built in option

@c02y
Copy link

c02y commented May 17, 2019

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.

@Mic92
Copy link

Mic92 commented Feb 5, 2020

This snippet makes *scratch* the initial buffer instead:

(defun dotspacemacs/user-config ()
  (setq initial-buffer-choice (lambda () (get-buffer "*scratch*"))))

@duianto
Copy link
Collaborator

duianto commented Feb 7, 2020

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

@peterhoeg
Copy link
Contributor

Mic92's suggestion doesn't seem to be working for me

Are you running emacs in daemon/server mode by chance?

@Mic92
Copy link

Mic92 commented Feb 11, 2020

@duianto
Copy link
Collaborator

duianto commented Feb 14, 2020

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.

@russell
Copy link
Contributor

russell commented Aug 25, 2020

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.

@susoooo
Copy link

susoooo commented Apr 22, 2021

Thanks @russell ....

That worked for me like a champ!

@ghost
Copy link

ghost commented Nov 28, 2021

Thanks @russell, this also worked for me :)

@GiulioCocconi
Copy link

@russell solution gives me a warning...
Error (use-package): vi-tilde-fringe/:init: No buffer named *spacemacs*

@rkachach
Copy link

rkachach commented Feb 14, 2022

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)))))

Copy link

github-actions bot commented May 1, 2024

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!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Mailling list - Feature request stale marked as a stale issue/pr (usually by a bot)
Projects
Mailing list
  
Acknowledged
Development

No branches or pull requests