 (defun factor--ppss-brackets-end ()
   (save-excursion
     (goto-char (factor--ppss-brackets-start))
-    (forward-sexp)
-    (1- (point))))
+    (condition-case nil
+        (progn (forward-sexp)
+               (1- (point)))
+      (error -1)))))
 
 (defsubst factor--indentation-at (pos)
   (save-excursion (goto-char pos) (current-indentation)))

(defsubst factor--looking-at-emptiness ()
  (looking-at "^[ \t]*$"))

(defsubst factor--at-end-of-def ()
  (or (looking-at factor--regex-definition-end)
      (looking-at factor--regex-single-liner)))

(defun factor--at-setter-line ()

(factor--define-key ?z 'switch-to-factor t)
(factor--define-key ?c 'comment-region)

(factor--define-auto-indent-key ?\])
(factor--define-auto-indent-key ?\})

(define-key factor-mode-map "\C-ch" 'factor-help)
(define-key factor-help-mode-map "\C-ch" 'factor-help)
(define-key factor-mode-map "\C-m" 'newline-and-indent)
