Closed bx closed 7 years ago
Why do you save the position before opening a new buffer? I have the version from https://github.com/pazz/alot/issues/828#issuecomment-173211684 . It just saves the position before rebuilding the buffer.
You are free to update the wiki. If your hook is related to something in there put it next to it and try to explain the differences.
why did we not aimply push the first commit from #633? it seems that this is a commonly used feature, so it could make sense to me it into master directly?
Maybe because it was slow? That was before my time :)
But I agree that it would be nice to have in core (as I mentioned above I also use sucha hook). Do you think it is interesting to extend the idea to other buffer types (thread->keep focus and folds; still others?)?
It would be great to see pazz/alot@747139cb77cd37ee7ad9e7a157da43f2fa16f342 pulled into core so an external hook wouldn't be necessary. @lucc I am not too familiar with the internal workings of alot, so I just chose a hook that made sense to me, is there a different hook you prefer I use? Also I would also be interesting in having thread focus and folding be saved, ideally with an option to save across restarts but that seems like a separate feature request (or two).
@bx I don't have a preference which hook you use, I was hoping to learn something from you about the difference between the two.
Maybe keeping the focus position in threads is not as problematic as in search results as I assume the former never grow as long as the latter (what is the biggest thread you have, 10, 50, 100? For me notmuch search --format=json '*' | jq '.[].total' | sort -un | tail -n 1
says 79).
Keeping the fold status is certanly a different PR.
I wrote some hooks to maintain the position of focus in a search buffer after it loses and regains focus (based on #633), that others may find useful. I was thinking of adding it to the Contrib Hooks wiki page and although it seems like github will allow me to edit that page I thought I'd check in with the project maintainers before doing so.
These are the hooks (adopted from pazz/alot@47139cb77cd37ee7ad9e7a157da43f2fa16f342) I am using to retain position focus in a search buffer: