   (beginning-of-line)
   (let ((ci (current-indentation)))
     (push-mark nil nil t)
-    (while (> (jade-next-line-indent) ci)
-      (next-line)
+    (while (> (jade-next-line-indentation) ci)
+      (forward-line)
       (end-of-line))))
 
 (defun jade-indent ()

;;; inspired by http://xahlee.org/emacs/elisp_syntax_coloring.html
(require 'font-lock)
(require 'js)

(defun jade-debug (string &rest args)
  "Prints a debug message"

             (and (jade-blank-line-p) (not (= (point-at-bol) (point-min))))))
    (let ((prev-line-indent (current-indentation)))
      prev-line-indent)))

(defun jade-next-line-indentation ()
  "Get the indentation of the next (non-blank) line (from point)."
  (interactive)
  (save-excursion

    ;; move down to the next non-blank line (or buffer end)
    (while (progn ;; progn used to get do...while control flow
             (forward-line 1)
             (message "cur line %d" (line-number-at-pos))
             (and (jade-blank-line-p) (not (= (point-at-eol) (point-max))))))
    (let ((next-line-indent (current-indentation)))
      next-line-indent)))

(defun jade-newline-and-indent ()
  "Insert newline and indent to parent's indentation level."
