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

tui-icon being set to single space in treemacs doom-colors theme? #489

Open
kitchen opened this issue Jun 17, 2020 · 4 comments
Open

tui-icon being set to single space in treemacs doom-colors theme? #489

kitchen opened this issue Jun 17, 2020 · 4 comments
Labels
is:bug Something isn't working as intended re:terminal Only applies to Emacs in the terminal re:treemacs
Milestone

Comments

@kitchen
Copy link

kitchen commented Jun 17, 2020

I'm trying to get doom emacs working reasonably well in a terminal. It does. I think it can do better. One thing that has been bugging me is the treemacs view looks a bit ... off. It took me a while to realize why, but I think it's mostly because there are no icons or any other special indications of file types or even directories:

Screen Shot 2020-06-17 at 12 04 36 AM

I tried setting the theme to Default and suddenly I had something! It wasn't much, but at least I had little green + and - next to directories, making them visually easier to distinguish.

So I started digging, and it seems as though doom's "doom-atom" theme is entirely built up from scratch, which, ok, fine. I can add fallback tui icons to those things, no big.

But then I looked at the doom-colors theme and see some shenanigans. I'm very new to lisp, emacs lisp, and emacs in general, but as I understand it, this is looping through everything in the all-the-icons-icon-alist figuring out what the icon should be, looping through each extension, and setting the tui-icons and gui-icons hash table keys for the extension in the treemacs--current-theme theme.

There are a few problems here that I can think of and maybe one isn't a problem, but the other definitely is:

  1. treemacs--current-theme is not deterministic? Or is it in the scope of treemacs-create-theme? I'm thinking the idea was to do something sorta like inheriting the default theme into the doom-colors theme? The more I type on this line the less sure I understand what's happening. Feel free to ignore this point.
  2. But more importantly, it appears as though the tui-icon is being set to " " for every extension in the list. Specifically: lines 263 where the cons is being built, lines 266-267 where it's being split back up into the gui icon and the tui icon, and finally line 270 where the tui icon is being set in the hash table.

Is this intended? I believe it to be overwriting potentially existing tui icons with empty strings. I'd like to figure out a way to get a reasonable set of tui icons in place (perhaps a PR to all-the-icons, followed by a PR to here to pull those in? 🤷) but I also need to make sure I'm understanding what's here and the intent.

Thanks!

@kitchen kitchen changed the title tui-icon being set to " " in treemacs doom-colors theme? tui-icon being set to single space in treemacs doom-colors theme? Jun 17, 2020
@kitchen
Copy link
Author

kitchen commented Jun 17, 2020

I may have answered point one, and yes, it seems as though it's being set locally when in the treemacs-create-theme and treemacs-modify-theme blocks. I'm certain I don't fully understand what's going on or how it's all working, but here:

https://github.com/Alexander-Miller/treemacs/blob/7d6c0c6e410be00d3d36bec3baaa685e69b4fca1/src/elisp/treemacs-themes.el#L83
https://github.com/Alexander-Miller/treemacs/blob/7d6c0c6e410be00d3d36bec3baaa685e69b4fca1/src/elisp/treemacs-themes.el#L100

@ema2159
Copy link
Contributor

ema2159 commented Jun 17, 2020

The thing is, all-the-icons isn't supported in Emacs TUI, so what we do I to simply remove the icons when using the time in TUI Emacs. A possible solution (I have to check this though) would be to add characters (hopefully with different colors) to indicate if something is an opened or closed directory or a file.

@kitchen
Copy link
Author

kitchen commented Jun 18, 2020

Ya but the Default theme seems to at least have +/- for directories, which I think is getting overwritten in this code.

As a proof of concept, would doing something like a lookup from a second mapping of just extensions => tui icons be a thing that would be of interest? Or should I maybe reach out to all-the-icons and see if they'd be interested in having tui alternatives to their icons and then can add support for that into the doom-colors theme?

Mostly I'm trying to not reinvent the entire wheel here just to get some reasonable tui icons and looking for guidance how I could do that in such a way that might be something y'all would want to include.

@kitchen
Copy link
Author

kitchen commented Jun 18, 2020

So I think what I can do here is use treemacs-modify-theme or treemacs-create-theme and a custom loop a-la the previously mentioned shenanigans to modify just the tui icons for the theme without having to copy/paste everything over. I'll experiment with it.

I did copy over the :fallback bits from the treemacs Default theme in the doom-atom theme and it worked like a charm, making the tui treemacs much more usable, but I'm not sure if that's a viable way of doing that to submit to this repo (or if licensing would even allow for that 🤷 )

@hlissner hlissner added backlog is:bug Something isn't working as intended re:terminal Only applies to Emacs in the terminal re:treemacs help wanted Cannot be resolved without outside help labels Sep 16, 2021
@hlissner hlissner added this to the Backlog milestone Oct 6, 2021
@hlissner hlissner removed the backlog label Oct 6, 2021
@hlissner hlissner removed the help wanted Cannot be resolved without outside help label Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:bug Something isn't working as intended re:terminal Only applies to Emacs in the terminal re:treemacs
Projects
None yet
Development

No branches or pull requests

3 participants