1. Frank Fischer
  2. evil
  3. Issues
Issue #373 resolved

motion state interacts poorly with eval-last-sexp

Anonymous created an issue

This is the same issue as described here:

https://bitbucket.org/lyro/evil/issue/17/normal-state-interacts-poorly-with-eval

only applied to the motion state. For a quick example of the problem go into the info pages for the emacs lisp intro and try C-x C-e while on the last paren of a sexp.

I think the fix is easy, just change the advice for pp-last-sexp and preceding-sexp:

;; Eval last sexp
(defadvice preceding-sexp (around evil activate)
  "In normal-state, last sexp ends at point."
  (if (or (evil-normal-state-p) (evil-motion-state-p))
      (save-excursion
        (unless (or (eobp) (eolp)) (forward-char))
        ad-do-it)
    ad-do-it))

(defadvice pp-last-sexp (around evil activate)
  "In normal-state, last sexp ends at point."
  (if (or (evil-normal-state-p) (evil-motion-state-p))
      (save-excursion
        (unless (or (eobp) (eolp)) (forward-char))
        ad-do-it)
    ad-do-it))

Not sure where other evil states should really be a part of this too.

Comments (2)

  1. Log in to comment