On Jun 17, 2011, at 12:05 , Thomas Hisch wrote:
Thx for the example, but it does't work as expected, just consider multiple buffers, vi state hook is also executed when i switch for example from emacs state to vi state,.. All this leads to negative values of vimtest-var.
I thought of using vimpulse-visual-local-vars because, when looking at its definition I looks like exactly what I want:
(viper-deflocalvar vimpulse-visual-local-vars '(cua-mode mark-active transient-mark-mode zmacs-regions) "System variables that are reset for each Visual session.")
Or am I wrong ?
Well aware of vi-state-hooks behavior. I was just giving you a tidbit to send you in potentially a workable direction. :) You could try using a buffer-local variable to test if you've applied your change, or wait for a better solution. I don't see a really clean way to hook into impulse visual mode deactivation without adding an additional hook to impulse. You could maybe use deactivate-mark-hook, and check if vimpulse-visual-mode is true, but you'd have to be sure that your function came before vimpulse-visual-deactivate-hook in the hook. Tim