Closed CSRaghunandan closed 6 years ago
After taking a good look at the indent-guide
code, I can definitely say that the result of adding this feature to highlight-indent-guides
should be a good deal less laggy than the implementation in indent-guide
, for a number of reasons. However, it would also have decently more overhead than the current static guide implementation. I'll want to play around with this some, and gauge just how much slower it makes things ... I'm already a little uncomfortable with the added overhead from the last big update, and I think I'll want to try to optimize what I have a little more before tackling this.
However, I do think this would be a cool feature to have, and I definitely would like to add it. I also think it will be possible to do it without causing too many issues. The main problem I'm seeing right now is, highlight-indent-guides
uses font-lock
to do most of the work regarding deciding what to redraw and when, and that's one of the reasons it's as fast as it is. But if we want the guides to change dynamically based on where the point is, we would have to refontify at least part of the buffer every time the point moves, and that can potentially get really slow, especially if there are other loaded modes that make heavy use of font-lock
. Hopefully this won't cause much of an issue, though. For the moment, I'll play with this and try to see what kind of performance I can get.
Thanks for looking at this up.
Also, I noticed highlight-indent-guides
does not draw guides for lines that have no content(other than a new-line character). Is that how it's supposed to work? or is something wrong at my side. (sorry for going off topic, but this is such a minor issue so decided to ask in the same thread).
Yeah, it's designed to not draw guides for lines that are empty, or contain only whitespace, or where the beginning of the line is part of a string or comment. I did this for a few reasons:
Yeah, I kinda like the way this works tbh. This is the best solution as for highlighting guides in emacs 👍
Also, i've set highlight-indent-guides-method
to character
. Would the choice of character effect the performance(like if i decided to use an unicode character)?
No, it shouldn't matter what character you pick, it'll all be the same performance-wise.
+1 for this. Any updates?
Just to be clear on my goal, I'd like to be able to have guides for all levels, and then specify a different color for the current level. (The way Sublime does it).
@tam5 this has actually been nearly ready for a few weeks, I just haven't had the time to put the finishing touches on it so I can push. Note that there are a number of minor bugs at the moment, which I won't fix until after the initial release because that would just take even longer (most of these are minor color glitches that go away when you move point). In general though, I'm quite happy with how this turned out. It seems pretty performant on my machine, anyway. I'll keep you guys posted.
It's done! Or at least it works well enough that I'm comfortable releasing it. I'm sure it could use some performance improvements, and I'm sure there are all sorts of new bugs now, but I'm pretty happy with it for the moment.
It can distinguish between the current indent level, the ancestors of the current level, and all other levels, and each of those three categories has its own set of faces that you can customize. And if you really want, you can now set a custom "highlighter" function, which allows you to set whatever faces you want arbitrarily, or disable specific levels altogether.
Let me know if you have any trouble with it.
I've fixed all the bugs I can find, and I've made a sizable performance improvement. I haven't tried it on anything other than my i7 MBP, but I feel like it should be fast/stable enough for just about anyone.
@CSRaghunandan @tam5 Again, when you get around to trying it, let me know how it goes. Thanks!
@DarthFennec Thank you. I've been using it for a couple of days now and I'm quite happy with it 👍 I'll report if I see any issues popup. It's performing quite well.
@DarthFennec sorry for going off topic, are you an Arch linux user who works on a MBP? Just curious. I've a MBP 13in and I always wanted to dualboot Arch on it :) Never tried it though
Yep, I dual-boot Arch on a MBP at the office. There are some tricks to setting some of it up, but it's all rather well documented (as you would expect when it comes to Arch). It all works pretty well.
Closing due to inactivity. If you find any issues with this in the future, let me know.
@DarthFennec finally got around to trying this out... so far seems to work great!
thanks!
This is an enhancement request, is there a way I can make
highlight-indent-guides
to show the indent guides only for the current block I am in, like the wayindent-guides
work? I really miss this feature of indent-guides, but it was laggy and had lots of issues.