Skip to content

Commit

Permalink
style: Consistently use _ for condition-case "don't care" var
Browse files Browse the repository at this point in the history
As opposed to using variously () or nil.
  • Loading branch information
greghendershott committed Dec 26, 2023
1 parent 8168082 commit 8ea73be
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion racket-collection.el
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ at the top, marked with \"->\".
candidates or (point-max)."
(save-excursion
(goto-char (point-min))
(condition-case ()
(condition-case _
(1- (re-search-forward "\n"))
(error (point-max)))))

Expand Down
6 changes: 3 additions & 3 deletions racket-common.el
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ flavor here."
;; Try to move up to outermost form, but stopping at or before any
;; module form.
(while
(condition-case nil
(condition-case _
(let ((prev (point)))
(goto-char (scan-lists (point) -1 1))
(if (looking-at racket-module-forms)
Expand All @@ -249,7 +249,7 @@ flavor here."
;; already at the module level, and just need to move to the
;; previous module-level item.
(unless (/= orig (point))
(condition-case nil (backward-sexp 1) (scan-error nil)))
(condition-case _ (backward-sexp 1) (scan-error nil)))
;; When we moved, also move before any preceding "#;".
(when (/= orig (point))
(when-let (sexp-comment-start
Expand Down Expand Up @@ -318,7 +318,7 @@ Ignores module forms nested (at any depth) in any sort of plain
or syntax quoting, because those won't be valid Racket syntax."
(save-excursion
(let ((xs nil))
(condition-case ()
(condition-case _
(progn
(racket--escape-string-or-comment)
(while t
Expand Down
6 changes: 3 additions & 3 deletions racket-complete.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

(defun racket--call-with-completion-prefix-positions (proc)
(if forward-sexp-function ;not necessarily sexp lang
(condition-case nil
(condition-case _
(save-excursion
(let ((beg (progn (forward-sexp -1) (point)))
(end (progn (forward-sexp 1) (point))))
Expand All @@ -22,7 +22,7 @@
(let ((beg (save-excursion (skip-syntax-backward "^-()>") (point))))
(unless (or (eq beg (point-max))
(member (char-syntax (char-after beg)) '(?\" ?\( ?\))))
(condition-case nil
(condition-case _
(save-excursion
(goto-char beg)
(forward-sexp 1)
Expand All @@ -38,7 +38,7 @@
(racket--escape-string-or-comment)
(let ((done nil)
(result nil))
(condition-case ()
(condition-case _
(while (not done)
(backward-up-list)
(when (looking-at-p (rx ?\( (or "require" "#%require")))
Expand Down
6 changes: 3 additions & 3 deletions racket-edit.el
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ point."
(let ((first-beg nil)
(requires nil))
(while
(condition-case nil
(condition-case _
(let ((end (progn (forward-sexp 1) (point)))
(beg (progn (forward-sexp -1) (point))))
(unless (equal end (point-max))
Expand All @@ -246,7 +246,7 @@ around point. This could be \"(point-min)\" if point is within no
module form, meaning the outermost, file module."
(save-excursion
(racket--escape-string-or-comment)
(condition-case ()
(condition-case _
(progn
(while (not (racket--looking-at-module-form))
(backward-up-list))
Expand Down Expand Up @@ -416,7 +416,7 @@ Only call F when the couple's sexprs are on the same line.
When LISTP is true, expects couples to be `[id val]`, else `id val`."
(save-excursion
(condition-case ()
(condition-case _
(while t
(when listp
(down-list))
Expand Down
2 changes: 1 addition & 1 deletion racket-eldoc.el
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
(and (racket--cmd-open-p)
(> (point) (point-min))
(save-excursion
(condition-case nil
(condition-case _
;; The char-before and looking-at-p checks below are to
;; skip when the sexp is quoted or when its first elem
;; couldn't be a Racket function name.
Expand Down
2 changes: 1 addition & 1 deletion racket-font-lock.el
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ similar, it will already be there."

(defun racket--inside-complete-sexp ()
"Return whether point is inside a complete sexp."
(condition-case ()
(condition-case _
(save-excursion (backward-up-list) (forward-sexp 1) t)
(error nil)))

Expand Down
2 changes: 1 addition & 1 deletion racket-imenu.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ If sexp at point is a Racket module form create a submenu."
(forward-sexp -1)))

(defun racket--imenu-goto-start-of-following-sexp ()
(condition-case nil
(condition-case _
(progn
(forward-sexp 1)
(let ((orig (point)))
Expand Down
4 changes: 2 additions & 2 deletions racket-indent.el
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ need."
(let ((indent-point (point))
(state nil))
(racket--escape-string-or-comment)
(condition-case nil (backward-up-list 1) (scan-error nil))
(condition-case _ (backward-up-list 1) (scan-error nil))
(while (< (point) indent-point)
(setq state (parse-partial-sexp (point) indent-point 0)))
(let ((strp (racket--ppss-string-p state))
Expand Down Expand Up @@ -366,7 +366,7 @@ Any additional, non-distinguished forms get normal indent."
(skip-chars-forward " \t\n")
(current-column)))
(count -1))
(condition-case nil
(condition-case _
(while (and (<= (point) indent-point)
(not (eobp)))
(forward-sexp 1)
Expand Down
2 changes: 1 addition & 1 deletion racket-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ Otherwise send to current-input-port of user program."

(defun racket--repl-complete-sexp-p ()
"Is there at least one complete sexp at REPL prompt?"
(condition-case nil
(condition-case _
(let* ((beg (racket--repl-prompt-mark-end))
(end (save-excursion
(goto-char beg)
Expand Down
4 changes: 2 additions & 2 deletions racket-visit.el
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The returned string has text properties:
an index of 0 for `get-text-property'."
(when (racket--in-require-form-p)
(save-excursion
(condition-case ()
(condition-case _
(progn
(forward-sexp 1)
(backward-sexp 1)
Expand All @@ -43,7 +43,7 @@ The returned string has text properties:
((and (pred identity) sexp)
(let* ((relative-p (stringp sexp))
(multi-in-prefix
(condition-case ()
(condition-case _
(progn
(backward-up-list 1)
(backward-sexp 2)
Expand Down

0 comments on commit 8ea73be

Please sign in to comment.