Fix evil-open-above in auto-filled comments

If comment-auto-fill-only-comments is enabled, evil-open-above (O) can
break comments, e.g. in haskell

-- 1 :. 2 :. 3 :. Nil
-- |a
--

Becomes

-- 1 :. 2 :. 3 :. Nil
-- |
--
  a
--

Reported by @ar1a
This commit is contained in:
Henrik Lissner 2018-10-17 22:27:41 -04:00
parent 99b7b7f740
commit 09f9e12638
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -8,7 +8,8 @@
(funcall orig-fn count)
(cl-letf (((symbol-function 'evil-insert-newline-below)
(lambda ()
(let ((pos (save-excursion (beginning-of-line-text) (point))))
(let ((pos (save-excursion (beginning-of-line-text) (point)))
comment-auto-fill-only-comments)
(evil-narrow-to-field
(evil-move-end-of-line)
(require 'smartparens)
@ -31,7 +32,8 @@
(funcall orig-fn count)
(cl-letf (((symbol-function 'evil-insert-newline-above)
(lambda ()
(let ((pos (save-excursion (beginning-of-line-text) (point))))
(let ((pos (save-excursion (beginning-of-line-text) (point)))
comment-auto-fill-only-comments)
(evil-narrow-to-field
(require 'smartparens)
(if (save-excursion (nth 4 (sp--syntax-ppss pos)))