From 09f9e12638500bc130c36f696c2c85851c18b6c6 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 17 Oct 2018 22:27:41 -0400 Subject: [PATCH] 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 --- modules/feature/evil/autoload/advice.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/feature/evil/autoload/advice.el b/modules/feature/evil/autoload/advice.el index 8f9a97158..114ff4192 100644 --- a/modules/feature/evil/autoload/advice.el +++ b/modules/feature/evil/autoload/advice.el @@ -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)))