1

After several years of being annoyed of Emacs on Ubuntu (not Mac via brew) having a ~2-3 second delay before displaying file contents at startup I finally decided to debug this.

I ran strace -r emacs and piped all output to a file. Reading through the file I noticed that there were only three syscalls that took longer than 10ms and they were all pselect6 calls. One of the calls in particular was taking a lot of time (if you're not immediately familiar with -r it shows the time between syscalls): 0.000499 pselect6(4, [3], [], NULL, {1, 996507900}, {NULL, 8}) = 0 (Timeout) 1.997844 ioctl(3, FIONREAD, [0]) = 0 and tracing that back to the open call with fd 3: 0.000000 open("/dev/tty", O_RDWR|O_NOCTTY) = 3

So Emacs is timing out, waiting for user input on startup?

This occurs regardless of what init scripts I use and I've tried both enabling and disabling the splash screen. All to no avail, the 2 second delay persists.

The only thing that seems to affect this 2 second pause is to hit a key, which will take me directly to the file you wanted to open.

I've tried installing both Emacs 23 and 24 and both are affected.

Here is a screenshot of what Emacs looks like while waiting: http://imgur.com/5WWKL0h And here is after the 2 seconds are up and scratch has loaded: http://imgur.com/ZRfSJxg

Does anyone know how to get emacs to not wait for input on /dev/tty?

Edit: Here's the entire strace log from starting up emacs: https://paste.ee/r/cL5jP

  • Emacs does not do this out of the box. First things first: can you reproduce this with emacs -q? with emacs -Q? with emacs -Q -nw? – Gilles Oct 1 '16 at 21:28
  • Does this happen when TERM is set to vt102? I.e. when you do TERM=vt102 emacs? Emacs has some special-case code for determining xterm's capabilities. – jch Oct 2 '16 at 15:48
  • @Gilles No difference using those options. – Oscar Oct 3 '16 at 17:36
  • @jch That does fix the delay. It doesn't quite explain why I'm affected while my coworkers are not. Even on the same host – Oscar Oct 3 '16 at 17:37
  • Are you running the same terminal emulator? Are you starting Emacs in the exact same manner? – jch Oct 3 '16 at 19:23

Your Answer

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

Browse other questions tagged or ask your own question.