max6166 <[email protected]> writes: > Thank you so much, Oscar. The above method is working great so far.
You're welcome. > I was thinking of adapting your code for other purposes, but I am concerned > about your warning. What are the potential problems with this code? The problem with advising `call-interactively' is that it is a core function that invokes all other interactive commands. When we call `evil-insert-state' from the advice, we are introducing side effects that can collide with the state created by the command invoked by `call-interactively'. One dumb example of this interaction is to add `evil-normal-state' to `maybe-enter-insert-mode-commands': the advice would revert the effect of `evil-normal-state' by calling `evil-insert-state' just afterwards. I can't think of a realistic case that could cause a problem, but the method makes me feel a bit uneasy anyways. You can ask on emacs-help about the risks of adivind `call-interactively', if you feel concerned. The Elisp experts there can also suggest better methods for achieving what you want. > For other readers, I think the last line is missing a hash and should be: > > (advice-add 'call-interactively :after #'maybe-enter-insert-mode) The hash is "more correct" in the sense that AFAIK it allows some checks (the byte compiler will warn if `maybe-enter-insert-mode' is not defined, for example) but otherwise it is not strictly required. _______________________________________________ implementations-list mailing list [email protected] https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
