Skip to content

Commit 21160d3

Browse files
committed
Use ignore-errors where possible
1 parent aecd731 commit 21160d3

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

clojure-mode.el

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -868,13 +868,12 @@ highlighted region)."
868868
(setq docelt (funcall docelt)))
869869
(goto-char listbeg)
870870
(forward-char 1)
871-
(condition-case nil
872-
(while (and (> docelt 0) (< (point) startpos)
873-
(progn (forward-sexp 1) t))
874-
;; ignore metadata and type hints
875-
(unless (looking-at "[ \n\t]*\\(\\^[A-Z:].+\\|\\^?{.+\\)")
876-
(setq docelt (1- docelt))))
877-
(error nil))
871+
(ignore-errors
872+
(while (and (> docelt 0) (< (point) startpos)
873+
(progn (forward-sexp 1) t))
874+
;; ignore metadata and type hints
875+
(unless (looking-at "[ \n\t]*\\(\\^[A-Z:].+\\|\\^?{.+\\)")
876+
(setq docelt (1- docelt)))))
878877
(and (zerop docelt) (<= (point) startpos)
879878
(progn (forward-comment (point-max)) t)
880879
(= (point) (nth 8 state)))))
@@ -901,20 +900,17 @@ highlighted region)."
901900
Note that this means that there is no guarantee of proper font
902901
locking in def* forms that are not at top level."
903902
(goto-char point)
904-
(condition-case nil
905-
(beginning-of-defun)
906-
(error nil))
903+
(ignore-errors
904+
(beginning-of-defun))
907905

908906
(let ((beg-def (point)))
909907
(when (and (not (= point beg-def))
910908
(looking-at "(def"))
911-
(condition-case nil
912-
(progn
913-
;; move forward as much as possible until failure (or success)
914-
(forward-char)
915-
(dotimes (_ 4)
916-
(forward-sexp)))
917-
(error nil))
909+
(ignore-errors
910+
;; move forward as much as possible until failure (or success)
911+
(forward-char)
912+
(dotimes (_ 4)
913+
(forward-sexp)))
918914
(cons beg-def (point)))))
919915

920916
(defun clojure-font-lock-extend-region-def ()

0 commit comments

Comments
 (0)