1

emacs-25 GUI on Debian.

I set up emacs so that it shows the scratch buffer at startup. However, when I open a file via a file manager with right-click -> open with -> emacs, emacs starts up with a split screen and two buffers: on top the scratch buffer, at the bottom the file buffer. I would like that in this circumstance only the file buffer is shown and not the scratch one. How can I do that?

1

I set up emacs so that it shows the scratch buffer at startup.

How did you achieve this? By setting the variable initial-buffer-choice to a non-nil value or some other means?

I would like that in this circumstance only the file buffer is shown and not the scratch one.

Usually you can achieve your desired behaviour by leaving initial-buffer-choice to its default nil value and setting the variable inhibit-startup-screen to a non-nil value in your user-init-file:

(setq inhibit-startup-screen t
      initial-buffer-choice  nil)

If this does not work, see the following:

When I open a file via a file manager with right-click -> open with -> emacs, emacs starts up with a split screen and two buffers

Are you able to replicate this behaviour when manually invoking Emacs from a command-line or a program launcher? For example, try running the following two commands in a terminal emulator:

$ emacs        # w/o file argument
$ emacs foo    # w/  file argument

If the manual Emacs invocation works as desired (i.e. no split screen), then the issue may lie with your desktop environment (e.g. the command-line arguments passed to Emacs in the installed emacs.desktop file), though I'd be very surprised if this is the case.

  • In my init-file I simply use (setq inhibit-startup-message t). I tried the changes you suggested but the behaviour of emacs remains unchanged, even if I run it from a terminal emulator, with the GUI or without (-nw). Without file argument it shows the scratch buffer, with a file argument it shows a split screen with the scratch buffer and file buffer as I described above. – rockemacs May 29 '17 at 13:29
  • @rockemacs I can't replicate this. What happens when you start emacs with the option '-q' or '-Q'? – Basil May 29 '17 at 13:41
  • the '-Q' option does exactly what I want, it shows the scratch buffer w/o file argument, it shows the file buffer w/ file argument. With the '-q' option instead the screen is split if I give a file argument. So, I suppose there is something else in my init-file that alter the intended behaviour of emacs. – rockemacs May 29 '17 at 14:06
  • 2
    @rockemacs Actually if the undesired behaviour occurs with -q it means there is something in your site lisp (e.g. emacs packages installed via apt) that is causing the issue. – Basil May 29 '17 at 14:53

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.