SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions

SrSpeedbar

What is SrSpeedbar?

SrSpeedbar is mode make SpeedBar show in Current Frame by SebastianRose.

Install

Put Lisp:sr-speedbar.el in your load-path, add
        (require 'sr-speedbar)
in ~/.emacs

Usage

Open sr-speedbar window.
Close sr-speedbar window.
Toggle sr-speedbar window.
Select sr-speedbar window.
Turn on refresh speedbar content.
Turn off refresh speedbar content.
Toggle refresh speedbar content.

Customize

All below setup can customize by: M-x customize-group RET sr-speedbar RET

The ‘sr-speedbar’ window width under WINDOW system.
The ‘sr-speedbar’ window width under CONSOLE.
The max window width allowed remember.
Whether delete other window before showing up.
Whether skip ‘sr-speedbar’ window when use command ‘other-window’ select window in cyclic ordering of windows.
Control status of refresh speedbar content.

Screenshot

This is screenshot by SebastianRose:

SrSpeedbarInXterm

This is screenshot by AndyStewart:

MultiTermDedicatedShotPage


A bug/problem found: speedbar’s frame doesn’t react on window resize. It may become wider/narrower depending on when it was opened (small window resize to big window → it becomes wider, big window resize to small window → becomes narrow). Re-opening speedbar fixes the problem. Emacs 23.1.


On GNU Emacs 23.0.60.1 when opening sr-speedbar the ‘let: Wrong type argument: stringp, nil’ error occurs and the content of sr-speedbar is the same buffer. – Andrea

Setting the width doesn’t appear to work (Emacs 23.1, Ubuntu 8.10).

In Emacs 23.3 and 24 it works, but in 24 a new problem appear, when clicking a file in speedbar it allways open a split window, it should use the same window one was previously editing in the same frame. – AlvaroMartinez

Setting pop-up-windows to nil fixed this problem for me. See http://www.gnu.org/s/emacs/manual/html_node/elisp/Displaying-Buffers.html. – Ben Booth

Please report an Emacs bug: ‘M-x report-emacs-bug’. They’ve made lots of changes to the code affecting windows. They would no doubt like to know about this problem. – DrewAdams


A few problems. First, this is being tested on GNU Emacs 23.1.50.1 (i386-mingw-nt5.1.2600).

  1. As noted above, window width setting does not seem to work.
  2. The speedbar starts in a file mode, and does react to navigating folders but fails to show individual files.
  3. Entering vhdl-mode made the initial window become the speedbar contents rather than the file that was selected in dired.
  4. In vhdl-mode, it would not show subcontent of projects (likely a similar issue as with not showing files under a hierarchy.)

Hard to know if this routine is being actively supported. Your mileage may vary.

A few addendums. Not showing the files is due to the fundamental speedbar setting for showing files it does not know about. Once that is set, it will show other files when navigating directories. However, a few bugs remain

  1. Window width still does not appear to work.
  2. In VHDL mode, it does not support the other display modes (like projects) and so it’ll show the project as a directory, but will not permit those to open and display.
  3. When selecting a file in the speedbar, it’ll load it into a buffer, but it doesn’t load the mode correctly somehow. The vhdl file is still in fundamental mode, and I have to manually toggle vhdl-mode on for that file. Then things like syntax coloring appear. I wonder if the vhdl-mode is getting loaded for the speedbar window rather than the buffer for the file you selected.

Further further addendums. I might need to clean this up a bit.

  1. The issue with the speedbar, file selection, and loading a new mode appears to be a fundamental bug in speedbar itself. I removed sr-speedbar from being loaded and just had emacs open speedbar in a new frame immediately upon opening. When opening like this, it picks up the menu bar (bad), defaults to showing files (good), and upon selecting a file, the mode gets loaded for the speedbar frame, NOT the buffer. This is readily apparent due to the menu bar issue. The speedbar frame picks up the VHDL menu that gets added for that mode, while the buffer that was loaded is still in Fundamental mode.

– Mark


How can I disable the icons? I only want ASCII, even in GUI Emacs.

Answer:

(setq speedbar-use-images nil)

– Charles Strahan


Can I set the default font size for just the sr-speedbar buffer to something other than my other buffers/windows? I tried setting default-frame-alist as suggested by the speedbar-article, but that just caused all my frames to change font size whenever speedbar spawns. It wold be nice if sr-speedbar could default to a small font so that I can get a better overview over large code bases easily.

To answer my own question, I read the wikipage on FacesPerBuffer and came up with this:

(make-face 'speedbar-face)
(set-face-font 'speedbar-face "Inconsolata-12")
(setq speedbar-mode-hook '(lambda () (buffer-face-set 'speedbar-face)))

which solved my problem.

– Jeff


Even with (setq sr-speedbar-skip-other-window-p t) in .emacs file, the behavior of delete-other-windows is still weird in current version of sr-speedbar.el. In detail, suppose 2 windows opened, in either of them ^ X 1, there is still chance to select the SPEEDBAR window to be active, which is not usually the user want – the user want the original window be selected. After some experiment, I come up with following elisp code to further advice delete-other-windows not to select the SPEEDBAR window.

(defadvice delete-other-windows (after my-sr-speedbar-delete-other-window-advice activate)
  "Check whether we are in speedbar, if it is, jump to next window."
  (let ()
	(when (and (sr-speedbar-window-exist-p sr-speedbar-window)
               (eq sr-speedbar-window (selected-window)))
      (other-window 1)
	)))
(ad-enable-advice 'delete-other-windows 'after 'my-sr-speedbar-delete-other-window-advice)
(ad-activate 'delete-other-windows)

just place them after the elisp lines you use to load sr-speedbar.

– liyu1981


How to keep speed bar window width after resizing?

add

(with-current-buffer sr-speedbar-buffer-name
  (setq window-size-fixed 'width))

to your .emacs after calling

sr-speedbar-open

— Chen Xian’an


How to integrate sr-speedbar with ERC’s erc-speedbar-browser?


CategoryNavigation