emacsorphanage / helm-swoop

Efficiently hopping squeezed lines powered by Emacs helm interface
GNU General Public License v3.0
689 stars 55 forks source link

Make line numbers optional #113

Closed alphapapa closed 5 years ago

alphapapa commented 7 years ago

This lets the display of line numbers be optionally disabled.

Thanks for your work on helm-swoop!

alphapapa commented 7 years ago

Well, oops: I didn't realize that parsing the line number from the beginning of the line in the result buffer is how it knows which line to jump to in the source buffer. So this breaks helm-swoop--goto-line and makes the package basically useless.

I guess there might be two ways of fixing this: either rewrite a lot of code to get the line numbers differently (which might be slower, but would probably be fine except for extremely large buffers), or use overlays to hide the line numbers in the Helm buffer (though I don't know much about overlays, so I'm not sure this is feasible).

Anyway, this PR should not be used or pulled, but I will leave it open for the moment to hopefully get feedback about the best way to proceed. Thanks.

alphapapa commented 7 years ago

I forgot I even filed this. I've come up with this proof-of-concept using text-properties. It seems to work much faster than helm-swoop's method of inserting line numbers into the buffer. Of course, it doesn't provide all the features, like the awesome line-editing ability of helm-swoop. But maybe we can do something with it.

https://github.com/alphapapa/helm-swish

CeleritasCelery commented 5 years ago

I tried out helm swish and did some bench marking on a large file, but did not see much of performance difference.

conao3 commented 5 years ago

@alphapapa We can close? But I think implement this feature in the future by another way.

alphapapa commented 5 years ago

@CeleritasCelery That seems strange to me. The performance difference is very significant for me.

@conao3 Yes, feel free to close this PR, as I don't intend to work on it anymore.

If I may, I'd recommend rewriting the line numbers to use text-properties to store and retrieve them, and perhaps using overlays to optionally display them. I think that will improve performance and flexibility.

conao3 commented 5 years ago

Good. I try this approach. Thanks!