After using speedbar for a while, I found it will change the base directory according to currently displayed buffer.
How do I disable it? I just want the speedbar do nothing while I am switching to another buffer.
After using speedbar for a while, I found it will change the base directory according to currently displayed buffer.
How do I disable it? I just want the speedbar do nothing while I am switching to another buffer.
In addition to the correct @PascalVKooten answer, there is a annoying problem when you navigate in the speedbar tree: you lost the start directory. The follow code helps to go back to the initial directory using the 'h' key in the speedbar frame:
(setq var_start-path default-directory)
(define-key speedbar-file-key-map (kbd "h")
(lambda() (interactive)
(when (and (not (equal var_start-path
sr-speedbar-last-refresh-dictionary))
(not (sr-speedbar-window-p)))
(setq sr-speedbar-last-refresh-dictionary var_start-path))
(setq default-directory var_start-path)
(speedbar-refresh))
)
This code is extracted from the projectile-speedbar package code. This package is interesting but it is not working for me.
I don't think this behavior is possible in plain Speedbar (After looking at variables, functions and the customization window).
However, if you check out the SrSpeedbar package, I see an option: “sr-speedbar-refresh-turn-off”. Once called, it should disable refreshing; sticking to wherever it is at.