On 2010-07-25 00:29, ??t??p??n N??mec wrote:
Vegard ??ye <[email protected]> writes:
(define-minor-mode surround-mode)
(vimpulse-define-key 'surround-mode 'vi-state "d" vimpulse-delete-surround-or-delete) (vimpulse-define-key 'surround-mode 'vi-state "c" vimpulse-change-surround-or-change)
(With the usual disclaimer about my very limited knowledge of Vimpulse and Viper,) this strikes me as the cleanest one -- it just looks so Right. :-D Defining this kind of minor modes (possibly global -- I assume that would work, too?) is perhaps The Way for writing Vimpulse plug-ins.
Yes, it should work with globalized minor modes as well -- the code just checks the mode variable and, if t,[1] enables the appropriate state bindings associated with it. It checks the `major-mode' variable too, so one could also modify/define major modes this way. In essence, state bindings become just another "property" that an Emacs mode can have. [1] Strictly speaking: unless nil.
Thanks for the insight!
You're welcome :) -- Vegard