     (save-excursion
       (let ((thisLineIndent (zomp-current-line-indent)))
         (next-line)
-        (setq nextLineMoreIndented (< thisLineIndent (zomp-current-line-indent)))))
+        (setq nextLineIndentDiff (- (zomp-current-line-indent) thisLineIndent))))
 
     (save-excursion
       (back-to-indentation)


    (when (and isQuotation
               (not endQuotationAtNextLine)
               (not nextLineMoreIndented))
      (insert "end}")
      (indent-according-to-mode)
      (previous-line)

    (when (and (not isStar)
               (not isComment)
               (member wordAtLineBeginning zomp-indent-keywords)
               (not (and endAtNextLine (>= nextLineIndentDiff 0)))
               (<= nextLineIndentDiff 0)
               isAtEnd)
      (insert "end")
      (indent-according-to-mode)
