I use emacs 23.3.1 on ubuntu 12.04. I installed speedbar on it. The emacs init file looks like this :

 ;;; Emacs Load Path
 (setq load-path (cons "~/emacs-config" load-path))

 ;; speedbar in the same frame
 (require 'sr-speedbar)
 (load "~/emacs-config/sr-speedbar")

emacs-config has sr-speedbar.el. I don't get any error message on load. However, speedbar is not started on loading. I have to M-x sr-speedbar-open every time I start emacs.

Also, is there a way to start sr-speedbar in buffers mode always. Right now it is in files mode so it shows the listing of the directory of the current file.

  • Perhaps you can help me better understand a few things so that I might be able to help you in return. According to the information that gets listed when I type C-h m on the speedbar buffer, Speedbar mode defined in 'speedbar.el': Major mode for managing a display of directories and tags.. Unless I'm mistaken, the buffer is a separate animal that runs independently of other buffers when other major modes are present. Is your question, "How can I enable a separate speedbar buffer on startup?" If so, then perhaps something simple like (speedbar) in your .emacs file after (require..) – lawlist Apr 11 '14 at 4:30
  • For finer control over when functions load on startup, there are three hooks normally used -- before-init-hook, after-init-hook, and emacs-startup-hook. I personally like the emacs-startup-hook -- e.g., (add-hook 'emacs-startup-hook (lambda () (function-one) (function-two) (setq ...) (message "hello-world") )) – lawlist Apr 11 '14 at 4:36
  • 1
    Thanks lawlist. My question is "How do I enable speedbar buffer BUT in the same emacs windows". when I add (speedbar) to .emacs I get two different windows one for speedbar and another for emacs. Your second response though made things much clearer. Instead of (speedbar), I do (sr-speedbar-open) and that makes the speedbar show in the same window. If you can respond by saying that add (sr-speedbar-open) into the .emacs, then I can accept it as a correct answer. Thanks again for your help – doon Apr 11 '14 at 6:51

One method would be to add (sr-speedbar-open) into the .emacs file, underneath the line of code (load "~/emacs-config/sr-speedbar").

A second method would be to use either the after-init-hook or the emacs-startup-hook -- that would permit the entire .emacs file to be loaded before anything inside the hook is executed. Additional functions or settings can be added to the hook using the following method:

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

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.