Closed kaushalmodi closed 9 years ago
Oh dear, that's an unforeseen consequence. Yes, the behavior was put in intentionally, but the result you got is definitely something I would consider a bug, and I'd like to fix that.
Anyone have any suggestion on how we can keep the p
key for refreshing but prevent these sequential refreshs due to keyboard repeat?
Add a hook to post-command-functions (or whatever it may be called) to toggle a flag on/off. I'm thinking about it like a state machine – press p
from state A and we refresh and move to state B. p
from B does nothing, but anything but p
moves back to A.
I went with the lazy option and implemented 1 second timeout between refreshs. The problem I had with toggling a state is that the user wouldn't be able to keep periodically hitting p
if he actually wanted to refresh again.
With the timeout at least it will work one second later.
I think that's a fine, practical solution. I agree with the limitation if the same were implemented using states. I wish we were able to distinguish between the pressed and released states of a key; then this solution would have become even better. If that were possible, you can limit the refresh to happen only once per key-pressed state.
I was casually navigating the questions and I slammed on the
p
key to go the top (I know that I could have also doneM-<
to prevent this issue).The issue is that once I was at the top of the question list, each
p
hit caused the buffer to refresh; I was unaware of that behavior. So my emacs froze for few seconds and then I see this in the Messages buffer:It looks like this behavior was putting in intentionally.
Suggestions:
p
or whilep
is slammed down. I must have held downp
for about a second or two longer and that caused these many refresh requests.