I have sr-sppedbar always turned on, but whenever I start, I have to manually click the code window to switch the cursor from speedbar to the codes. How do I start emacs with cursor in the main window instead of sr-speedbar?

Update: It works after adding (other-window 1) to start hook in init.el.

  • 1
    Emacs runs through startup.el which is hard-coded into the executable, and people often have desktop restore features, such as desktop.el activated. Selecting the right window/buffer at start-up is always a trick, and this is why I created my own startup.el and build Emacs from source. The easiest thing to do will be to place a line of code at the bottom of your .emacs file or add a function to the emacs-startup-hook that runs last in time. Essentially, you want to use (select-window WINDOW) or simply (other-window COUNT).
    – lawlist
    Sep 27 '16 at 15:19
  • 1
    See also the function get-buffer-window to help obtain the value for the first argument in select-window. Alternatively, you could modify speedbar.el and sr-speedbar.el.
    – lawlist
    Sep 27 '16 at 15:21

It works after adding (other-window 1) to start hook in init.el

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.