Closed swsnr closed 5 years ago
Hmm, for some reason I wasn't watching my own repo and saw this message just now. :-(
Your suggestions seem good. This would simplify the code a lot... (not that it's super complex :-) ).
Btw, those hooks are triggered before the switch is triggered right? I played briefly with the idea but I got some strange stackoverflow errors... Maybe the save command is triggering some infinite loop using those hooks.
@bbatsov I don't know; I must admit that I didn't actually try. I just thought it might be a good idea. :blush:
Now that hooks are configurable in 0.3 everyone can just remove the command triggers and try some hook triggers instead. E.g.
(add-to-list 'super-save-hook-triggers 'buffer-list-update-hook)
Currently super-save advises a couple of Emacs functions to catch buffer switching, but I think we could replace these advises with two hooks:
window-configuration-change-hook
: This hook will trigger—among other things—when a window gets to display a different buffer, i.e. if the user switches to a different buffer within the current window. This would replace theswitch-to-buffer
advise.buffer-list-update-hook
: This hook triggers whenever the buffer list changes, which occurs—among other things–upon calls toselect-window
, i.e. when the user switches to a different window.