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

API function to update hotlist for a buffer with direct values #2098

Open
trygveaa opened this issue Mar 16, 2024 · 0 comments
Open

API function to update hotlist for a buffer with direct values #2098

trygveaa opened this issue Mar 16, 2024 · 0 comments
Labels
feature New feature request

Comments

@trygveaa
Copy link
Contributor

Feature description

Currently the only way to change the hotlist as far as I know is to increase one of the priorities by one, or to clear it for a buffer. It would be useful with an API function that lets you set/update the hotlist for a buffer by explicitly setting the number of lines for each priority as well as setting a custom creation time.

The use case for this is when loading history in slack.py. It's may load unread messages in several buffers and currently they will appear in the hotlist in the order they are loaded. By being able to set the creation time, I would be able to sort the hotlist in the correct order by message time, like it would be sorted when new messages arrive.

Additionally, the way it loads messages is to first just set the hotlist without printing any lines, and then at a later time printing the messages in the buffer. This is done for performance reasons and because of rate limiting in certain Slack API functions. Also, the number set in the hotlist when first loading may not be exactly correct, so it has to be updated when printing the lines in the buffer. Currently, I either have to clear the hotlist first and print the lines to get the correct amount which changes the hotlist order, or I have to check the current value of the hotlist, and set notify_none on some of the lines I print to get the correct amount (though, setting notify_none has other implications as well). If I could update the hotlist with the correct amount and creation time after printing the lines, it would be much simpler and I would avoid these problems.

@trygveaa trygveaa added the feature New feature request label Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

1 participant