diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2025-09-18 09:09:01 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2025-09-18 09:09:01 +0200 |
| commit | f70d2f622f874acb32b368b397dfe3974eb2951c (patch) | |
| tree | 57988cfb10566c730eaded36eadb12ef17cf5334 /lisp | |
| parent | d3d0505b35c2354437e17411665f7f1b2e6a6fcb (diff) | |
Use cond-let and cond-let* more
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/magit-branch.el | 20 | ||||
| -rw-r--r-- | lisp/magit-log.el | 18 | ||||
| -rw-r--r-- | lisp/magit-status.el | 34 |
3 files changed, 37 insertions, 35 deletions
diff --git a/lisp/magit-branch.el b/lisp/magit-branch.el index 9455ceb..71d930d 100644 --- a/lisp/magit-branch.el +++ b/lisp/magit-branch.el @@ -595,16 +595,16 @@ prompt is confusing." (setq branches (list (magit-read-branch-prefer-other (if force "Force delete branch" "Delete branch"))))) - (when-let ((_(not force)) - (unmerged (seq-remove #'magit-branch-merged-p branches))) - (if (magit-confirm 'delete-unmerged-branch - "Delete unmerged branch %s" - "Delete %d unmerged branches" - 'noabort unmerged) - (setq force branches) - (or (setq branches - (cl-set-difference branches unmerged :test #'equal)) - (user-error "Abort")))) + (cond-let + (force) + [[unmerged (seq-remove #'magit-branch-merged-p branches)]] + ((magit-confirm 'delete-unmerged-branch + "Delete unmerged branch %s" + "Delete %d unmerged branches" + 'noabort unmerged) + (setq force branches)) + ((setq branches (cl-set-difference branches unmerged :test #'equal))) + ((user-error "Abort"))) (list branches force))) (let ((refs (mapcar #'magit-ref-fullname branches))) ;; If a member of refs is nil, that means that diff --git a/lisp/magit-log.el b/lisp/magit-log.el index 2244c3c..da22fd2 100644 --- a/lisp/magit-log.el +++ b/lisp/magit-log.el @@ -929,15 +929,15 @@ Like `magit-mode-bury-buffer' (which see) but with a negative prefix argument instead bury the revision buffer, provided it is displayed in the current frame." (interactive "p") - (if (< arg 0) - (let* ((buf (magit-get-mode-buffer 'magit-revision-mode)) - (win (and buf (get-buffer-window buf (selected-frame))))) - (if win - (with-selected-window win - (with-current-buffer buf - (magit-mode-bury-buffer (> (abs arg) 1)))) - (user-error "No revision buffer in this frame"))) - (magit-mode-bury-buffer (> arg 1)))) + (cond-let* + ((>= arg 0) + (magit-mode-bury-buffer (> arg 1))) + ([buf (magit-get-mode-buffer 'magit-revision-mode)] + [win (get-buffer-window buf (selected-frame))] + (with-selected-window win + (with-current-buffer buf + (magit-mode-bury-buffer (> (abs arg) 1))))) + ((user-error "No revision buffer in this frame")))) ;;;###autoload (defun magit-log-move-to-parent (&optional n) diff --git a/lisp/magit-status.el b/lisp/magit-status.el index 83e62f9..5aa0b7d 100644 --- a/lisp/magit-status.el +++ b/lisp/magit-status.el @@ -656,22 +656,24 @@ arguments are for internal use only." (magit-insert-section (branch target) (insert (format "%-10s" "Push: ")) (insert - (if (magit-rev-verify target) - (concat (and magit-status-show-hashes-in-headers - (concat (propertize (magit-rev-format "%h" target) - 'font-lock-face 'magit-hash) - " ")) - target " " - (magit-log--wash-summary (or (magit-rev-format "%s" target) - "(no commit message)"))) - (let ((remote (magit-get-push-remote branch))) - (if (magit-remote-p remote) - (concat target " " - (propertize "does not exist" - 'font-lock-face 'magit-branch-warning)) - (concat remote " " - (propertize "remote does not exist" - 'font-lock-face 'magit-branch-warning)))))) + (cond-let + ((magit-rev-verify target) + (concat (and magit-status-show-hashes-in-headers + (concat (propertize (magit-rev-format "%h" target) + 'font-lock-face 'magit-hash) + " ")) + target " " + (magit-log--wash-summary + (or (magit-rev-format "%s" target) + "(no commit message)")))) + [[remote (magit-get-push-remote branch)]] + ((magit-remote-p remote) + (concat target " " + (propertize "does not exist" + 'font-lock-face 'magit-branch-warning))) + ((concat remote " " + (propertize "remote does not exist" + 'font-lock-face 'magit-branch-warning))))) (insert ?\n)))) (defun magit-insert-tags-header () |
