I want to give an arbitrary command some buffer-local behavior without advising it. (I can do it by advising, but I want to also be able to do it without advising.)
E.g., just looking at some property on a command symbol, I want to then do something only in the buffer that was current when the command was invoked (however it was invoked).
Checking the property value can happen any time (and any number of times) after the command is invoked. The buffer-local behavior needs to change, to reflect the current value of the property.
(It's OK to limit this to buffers that are displayed.
I tried looking at window-buffer-change-functions
etc., but I didn't notice anything that might help.)
So far, I'm guessing that it's not possible from Lisp. But I'm hoping someone knows better, or at least knows for sure.
(I posed this question on [email protected], but haven't gotten any response yet.)
this-command(orreal-this-command) inpre-command-hookand add the(current-buffer)value to a property on the command symbol.this-command(andreal-this-commandisn't needed). No, I don't want to record the curent buffer for each invocation of each command, usingpre-command-hookor otherwise. I was hoping that there was some record or access to that info in the command loop from Lisp, but I feared (and fear) there isn't.