Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rational-speedbar.el, a good filetree that comes built-in to emacs #102

Closed
erikLundstedt opened this issue Mar 21, 2022 · 7 comments · Fixed by #117
Closed

add rational-speedbar.el, a good filetree that comes built-in to emacs #102

erikLundstedt opened this issue Mar 21, 2022 · 7 comments · Fixed by #117

Comments

@erikLundstedt
Copy link
Contributor

I have been working on a 'rational-speedbar.el' module for a while and it seems stable enough to merge into main
https://gitlab.com/Erik.Lundstedt/rational-speedbar/-/tree/main

about

speedbar is the filetree that comes builtin to emacs, it is easy to use,light-weight and has fair integreation with many parts of vanilla emacs

what I have done is that i have added some useful (evil only/evil-friendly)keybindings and added a lot of extensions to the list of supported extensions

I have also set it to NOT show the icons as they are really ugly(in my opinion)

I currently dont set it to start on emacs start as that should be up to the user in my opinion

in general, I have set up some sane/rational defaults that shouldnt interfear with the user

feel free to give ideas on how I can improve the module before I create a PR

@jeffbowman
Copy link
Contributor

Thanks! Your link gives a 404 message, so I can't review.

@erikLundstedt
Copy link
Contributor Author

Thanks! Your link gives a 404 message, so I can't review.

thats strange

apparently you might have to loggin
https://gist.github.com/erikLundstedt/1182a024fe700ecafb7b8c6d3c39ad05

@jeffbowman
Copy link
Contributor

apparently you might have to loggin

I tried logging in, but the link still didn't work for me. Maybe your repo is private?

Thanks for the gist though! You don't (require 'speedbar) so I get an error when I (require 'rational-speedbar)

    Debugger entered--Lisp error: (void-function speedbar-add-supported-extension)

This is resolved by adding (require 'speedbar) before loading rational-speedbar.

For other feedback:

  • I'd cleanup the multiple blank lines
  • cleanup the closing parens (see https://github.com/bbatsov/emacs-lisp-style-guide).
  • I agree with your opinion on the icons, but maybe don't include that part of the comment in the final version. I would suggest this for all other opinion based comments as well (eg. "why would you", etc)
  • No, I would not automatically start speedbar. It might be interesting to add a key binding to toggle speedbar visibility. If you go this route, try using emacs -Q to make sure your suggested keybinding does not conflict with something already mapped.

@erikLundstedt
Copy link
Contributor Author

apparently you might have to loggin

I tried logging in, but the link still didn't work for me. Maybe your repo is private?

it shouldnt be, I will check that as gitlab makes new repos private by default

Thanks for the gist though! You don't (require 'speedbar) so I get an error when I (require 'rational-speedbar)

    Debugger entered--Lisp error: (void-function speedbar-add-supported-extension)

This is resolved by adding (require 'speedbar) before loading rational-speedbar.

I didnt think that was required as speedbar is part of core emacs, it might be required anyways but thats nothing ive noticed

For other feedback:

I would do this before an actual merge

  • I agree with your opinion on the icons, but maybe don't include that part of the comment in the final version. I would suggest this for all other opinion based comments as well (eg. "why would you", etc)

those comments are mainly for fun and can be cleaned if needed

  • No, I would not automatically start speedbar. It might be interesting to add a key binding to toggle speedbar visibility. If you go this route, try using emacs -Q to make sure your suggested keybinding does not conflict with something already mapped.

im not sure about adding a keybind to toggle speedbar as

  1. that would require a lot of setup for us tiling-wm users
  2. keybindings are quite personal, thats why im only adding a few that i found usefull, and only for evil-users

@erikLundstedt
Copy link
Contributor Author

Thanks! Your link gives a 404 message, so I can't review.

I have made it public now

it should never have been private but that was probably just me messing up when creating the repo in the UI

@jeffbowman
Copy link
Contributor

Regarding (require 'speedbar)

I didnt think that was required as speedbar is part of core emacs, it might be required anyways but thats nothing ive noticed

Yes, it is part of core Emacs, but M-x speedbar runs an alias to an autoloaded function, so you don't have to require it anywhere to enable using it. However, you do need to require it to load the definitions in code because the autoload feature does not know you want the file loaded when you are assigning a value to a variable. If you have run either M-x speedbar RET interactively or if you call (speedbar) in code, then the definitions are all loaded by the time you want to set the speedbar-add-supported-extension value.

Hope that makes sense.

im not sure about adding a keybind to toggle speedbar as

  1. that would require a lot of setup for us tiling-wm users
  2. keybindings are quite personal, thats why im only adding a few that i found usefull, and only for evil-users

Fair point. I use AwesomeWM, but I don't seem to need to add any additional setup for keybinds in Emacs. Probably way off topic, but I'm curious about your use case.
More on topic, key bindings are indeed quite personal, I don't mind suggesting one, for example C-c C-s, as that is not bound normally by Emacs, but documenting it would become very important so a user would know what happened. Leaving it out is very reasonable.

those comments are mainly for fun and can be cleaned if needed

I figured as much, I was amused.

And thanks for the module! I look forward to a final PR for this! I have often wanted to use speedbar but just haven't invested time in it. I tried Treemacs for a bit, but having to add projects to it seemed like an extra step that wasn't needed, so I stopped using that one too - although more for pragmatic reasons. I wish sr-speedbar were built-in. I find the extra frame for speedbar to be a bit annoying as I now have to configure its width etc (and this might be where I would have to do some work in my WM to get speedbar to "work" correctly visualy). sr-speedbar puts the speedbar in a window in the current frame.

@erikLundstedt
Copy link
Contributor Author

@jeffbowman

Fair point. I use AwesomeWM, but I don't seem to need to add any additional setup for keybinds in Emacs. Probably way off topic, but I'm curious about your use case.
More on topic, key bindings are indeed quite personal, I don't mind suggesting one, for example C-c C-s, as that is not bound normally by Emacs, but documenting it would become very important so a user would know what happened. Leaving it out is very reasonable.

/.../

And thanks for the module! I look forward to a final PR for this! I have often wanted to use speedbar but just haven't invested time in it. I tried Treemacs for a bit, but having to add projects to it seemed like an extra step that wasn't needed, so I stopped using that one too - although more for pragmatic reasons. I wish sr-speedbar were built-in. I find the extra frame for speedbar to be a bit annoying as I now have to configure its width etc (and this might be where I would have to do some work in my WM to get speedbar to "work" correctly visualy). sr-speedbar puts the speedbar in a window in the current frame.

cool,I use awesome aswell
I have had similar issues with getting speedbar show up where i want it to, i ended up solving it by:

  1. making a tag dedicated to emacs/development stuff(I SOMETIMES "have" to use intelij)
  2. setting the master_width_factor to 0.2 (actually i set it to 1.0 divided by 5.0 but thats just because i had issues if i did it differently)
    this makes the layout have a thin area for the filetree and let the rest be taken up by emacs(adjust the actuall value if needed, 0.2 seemed to work nicely for me but you should adjust if you use large gaps or wide padding)
    so my layout now looks something like this:
[ ][     ]
instead of:
[   ][   ]

the issue with not starting speedbar on startup while using a tilling wm is that you have to find a whay to put it in the correct "node"(to borrow wording from bspwm) so it doesnt start ocypying the main area, I think I did this by loading the module and starting speedbar in after-init-hock which seems to work (at least with a single screen)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants