diff options
| author | Tom Dalziel <33435574+tomdl89@users.noreply.github.com> | 2021-10-16 20:32:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-16 20:32:34 +0200 |
| commit | 215c39d1c4312ce5a3a66c19bbba61374d029c86 (patch) | |
| tree | 3cc571698dc955b2cf293ed38fa6f085f3073d36 /evil-common.el | |
| parent | 44f75e93c6db89de882a0eb1d8bcc7c4ebb8e94e (diff) | |
Pull temporary goal column normalization into let (#1533)
Diffstat (limited to 'evil-common.el')
| -rw-r--r-- | evil-common.el | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/evil-common.el b/evil-common.el index 3977532..d843bda 100644 --- a/evil-common.el +++ b/evil-common.el @@ -1010,22 +1010,25 @@ This mostly copies the approach of Emacs' `line-move-1', but is modified so it is more compatible with evil's notions of eol & tracking." (declare (indent defun) (debug t)) - `(progn - (setq this-command 'next-line) - (if (consp temporary-goal-column) - (setq temporary-goal-column (+ (car temporary-goal-column) - (cdr temporary-goal-column)))) - (if (not (memq last-command '(next-line previous-line))) - (setq temporary-goal-column - (if (and evil-track-eol - (evil-eolp) - (memq real-last-command '(move-end-of-line evil-end-of-line))) - most-positive-fixnum - (current-column)))) - ,@body - (if evil-start-of-line - (evil-first-non-blank) - (line-move-to-column (truncate (or goal-column temporary-goal-column)))))) + (let ((normalize-temporary-goal-column + `(if (consp temporary-goal-column) + (setq temporary-goal-column (+ (car temporary-goal-column) + (cdr temporary-goal-column)))))) + `(progn + (setq this-command 'next-line) + ,normalize-temporary-goal-column + (if (not (memq last-command '(next-line previous-line))) + (setq temporary-goal-column + (if (and evil-track-eol + (evil-eolp) + (memq real-last-command '(move-end-of-line evil-end-of-line))) + most-positive-fixnum + (current-column)))) + ,@body + (if evil-start-of-line + (evil-first-non-blank) + ,normalize-temporary-goal-column + (line-move-to-column (truncate (or goal-column temporary-goal-column))))))) (defun evil-narrow (beg end) "Restrict the buffer to BEG and END. |
