aboutsummaryrefslogtreecommitdiff
path: root/lisp/git-rebase.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2025-08-22 20:55:35 +0200
committerJonas Bernoulli <jonas@bernoul.li>2025-08-22 20:55:35 +0200
commit28f30e14036f567640f1cbfca94a67e5e2013303 (patch)
tree26b01bb3ca13133cb06d26cfd61643340b8dd255 /lisp/git-rebase.el
parent594723c6391fb1320a1a80d688edda7c96803f16 (diff)
Use cond-let and cond-let*
I've only recently implemented these forms, but before that I have been hoping they would be added to Emacs for a decade or so. Even so, I do not yet have any practice using them, and so my sense of when to use them, and when not, has yet to evolve.
Diffstat (limited to 'lisp/git-rebase.el')
-rw-r--r--lisp/git-rebase.el26
1 files changed, 13 insertions, 13 deletions
diff --git a/lisp/git-rebase.el b/lisp/git-rebase.el
index dc7c6d0..a2c89be 100644
--- a/lisp/git-rebase.el
+++ b/lisp/git-rebase.el
@@ -362,15 +362,15 @@ BATCH is non-nil, in which case nil is returned. Non-nil
BATCH also ignores commented lines."
(save-excursion
(goto-char (line-beginning-position))
- (if-let* ((re-start (if batch
- "^"
- (format "^\\(?99:%s\\)? *"
- (regexp-quote comment-start))))
- (type (seq-some (pcase-lambda (`(,type . ,re))
- (let ((case-fold-search nil))
- (and (looking-at (concat re-start re)) type)))
- git-rebase-line-regexps)))
- (git-rebase-action
+ (cond-let*
+ ([re-start (if batch
+ "^"
+ (format "^\\(?99:%s\\)? *" (regexp-quote comment-start)))]
+ [type (seq-some (pcase-lambda (`(,type . ,re))
+ (let ((case-fold-search nil))
+ (and (looking-at (concat re-start re)) type)))
+ git-rebase-line-regexps)]
+ (git-rebase-action
:action-type type
:action (and-let ((action (match-str 1)))
(or (cdr (assoc action git-rebase-short-options))
@@ -378,10 +378,10 @@ BATCH also ignores commented lines."
:action-options (match-str 2)
:target (match-str 3)
:trailer (match-str 5)
- :comment-p (and (match-str 99) t))
- (and (not batch)
- ;; Use empty object rather than nil to ease handling.
- (git-rebase-action)))))
+ :comment-p (and (match-str 99) t)))
+ ((not batch)
+ ;; Use empty object rather than nil to ease handling.
+ (git-rebase-action)))))
(defun git-rebase-set-action (action)
"Set action of commit line to ACTION.