Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacsclient --create-frame opens *scratch* even with initial-buffer-choice set

Tags:

emacs

elisp

I start emacs with emacs --daemon when the computer starts up, and then open a new graphical frame with emacsclient -c -n.

According to https://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html:

If you omit a filename argument while supplying the ‘-c’ option, the new frame displays the scratch buffer by default. If initial-buffer-choice is a string, the new frame displays that file or directory instead.

I have (setq initial-buffer-choice "~/") in my ~/.emacs. However, when I open a new frame, it still starts *scratch*, rather than ~. I have a ~ buffer, but it's not the displayed initially.

Is there something else I need to do to prevent the *scratch* buffer (which I never use) from being created?

Even with a minimal ~/.emacs which only has (setq initial-buffer-choice "~/"), upon starting a new frame with emacsclient -c -n, it still opens up with *scratch*.

like image 472
Dan Jones Avatar asked Dec 02 '25 02:12

Dan Jones


1 Answers

This behavior appears to be limited to versions before 24. In emacs 23, emacsclient -c (or emacsclient -t) always opens to *scratch*, even when initial-buffer-choice is set. This is fixed in emacs 24, so the solution is to upgrade.

like image 97
Dan Jones Avatar answered Dec 04 '25 23:12

Dan Jones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!