         (topp (save-excursion (or (ignore-errors
                                     (backward-up-list 1)
                                     (point))
-                                  (futhark-find-keyword-backward-raw "fun")
-                                  0)))
+                                  (max
+                                   (or (save-excursion
+                                         (futhark-find-keyword-backward-raw "fun"))
+                                       0)
+                                   (or (save-excursion
+                                         (futhark-find-keyword-backward-raw "entry"))
+                                       0))
+                                  )))
         (result nil)
         )
 

       ;; Otherwise, if the previous keyword is "fun", align to a single
       ;; indent level.
       (and
        (string= "fun" (save-excursion (futhark-first-keyword-backward)))
        futhark-indent-level)

       ;; Otherwise, align to the previous non-empty line.

            (current-column))

       ;; Align function definitions to column 0.
       (and (or (futhark-looking-at-word "fun")
                (futhark-looking-at-word "entry"))
            0)

       ;; Align closing parentheses and commas to opening
