aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEivind Fonn <evfonn@gmail.com>2019-12-03 17:13:15 +0100
committerGitHub <noreply@github.com>2019-12-03 17:13:15 +0100
commit81032e0a2145c12709fd8e94cf8ea52e096e9e6b (patch)
treefcf952a2eda2a92fd1a9eaffbb59998726f14d34
parent926da832c3bf1edfe8f01c74b835c190dad7d755 (diff)
parent6b2758fb81a8ae5db0536f7dff433e115cd09cec (diff)
Merge pull request #931 from emacs-evil/evil-shift-empty-buffer
Handle empty buffer when shifting left/right
-rw-r--r--evil-commands.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/evil-commands.el b/evil-commands.el
index 4d9bf62..9036337 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -1812,6 +1812,12 @@ See also `evil-shift-left'."
(indent-to new-indent 0))
(delete-region (point) (progn (skip-chars-forward " \t") (point)))
(forward-line 1))))
+ ;; in case we're in an empty buffer first-shift is still unchanged
+ (unless first-shift
+ (if (< count 0)
+ (setq first-shift 0)
+ (setq first-shift (* count evil-shift-width))
+ (indent-to first-shift)))
;; assuming that point is in the first line, adjust its position
(if (called-interactively-p 'any)
(evil-first-non-blank)