2

I am trying to start emacs with both eshell and the specified file, but displaying the buffer with the file.

When I add the following line to emacs

(add-hook 'emacs-startup-hook (lambda () (eshell)))

then eshell also loads on startup with the file, but eshell is shown instead of the file.

I tried to change the initial-buffer-choice variable so that the file is shown instead, but am not sure what function to give to return the file specified in command line. Can anyone please give me some ideas?

1

Since emacs-startup-hook is (docstring, obtained with C-h v emacs-startup-hook)

run after loading init files and handling the command line.

The command previous-buffer should do what you want.

In selected window switch to previous buffer.

(add-hook 'emacs-startup-hook (lambda () (eshell) (previous-buffer)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.