From 53da28e23bd7923ac19bdee66941403c70e1f26a Mon Sep 17 00:00:00 2001 From: Max Rietmann Date: Fri, 28 Aug 2015 14:10:19 +0200 Subject: [PATCH] Fixed `haskell-indentation-newline-and-indent` The "melpa-stable" release was correct, but I guess the recent refactoring effort created a regression. The new version did a newline before storing the current column/indentation. This fixes the behavior while following the new code style. (save column first, then newline, then reindent) --- haskell-indentation.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/haskell-indentation.el b/haskell-indentation.el index 136c6f64e..7a2837ddd 100644 --- a/haskell-indentation.el +++ b/haskell-indentation.el @@ -254,12 +254,19 @@ negative ARG. Handles bird style literate Haskell too." (defun haskell-indentation-newline-and-indent () "Insert newline and indent." (interactive) - (delete-horizontal-space) - (newline) - (unless (haskell-indentation-bird-outside-code-p) + ;; On RET (or C-j), we: + ;; - just jump to the next line if literate haskell, but outside code + (if (haskell-indentation-bird-outside-code-p) + (progn + (delete-horizontal-space) + (newline)) (catch 'parse-error + ;; - save the current column (let* ((ci (haskell-indentation-current-indentation)) (indentations (haskell-indentation-find-indentations-safe))) + ;; - jump to the next line and reindent to at the least same level + (delete-horizontal-space) + (newline) (when (haskell-indentation-bird-p) (insert "> ")) (haskell-indentation-reindent-to