From 0022a2cfbc78d853800768b374329b57a852d02b Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sun, 29 Mar 2026 23:16:44 +0200 Subject: Use Cond-Let's when$ --- lisp/git-commit.el | 4 ++-- lisp/magit-apply.el | 4 ++-- lisp/magit-branch.el | 4 ++-- lisp/magit-files.el | 4 ++-- lisp/magit-gitignore.el | 4 ++-- lisp/magit-section.el | 4 ++-- lisp/magit-sequence.el | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lisp/git-commit.el b/lisp/git-commit.el index 4989d83..310a752 100644 --- a/lisp/git-commit.el +++ b/lisp/git-commit.el @@ -587,9 +587,9 @@ Used as the local value of `header-line-format', in buffer using (with-demoted-errors "Error running git-commit-setup-hook: %S" (run-hooks 'git-commit-setup-hook)) (set-buffer-modified-p nil) - (when-let ((format git-commit-header-line-format)) + (when$ git-commit-header-line-format (setq header-line-format - (if (stringp format) (substitute-command-keys format) format))) + (if (stringp $) (substitute-command-keys $) $))) (when git-commit-usage-message (setq with-editor-usage-message git-commit-usage-message)) (with-editor-usage-message)) diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el index 990dba1..5fa6bc5 100644 --- a/lisp/magit-apply.el +++ b/lisp/magit-apply.el @@ -644,8 +644,8 @@ of a side, then keep that side without prompting." (let ((orig (cadr (assoc file status)))) (if (file-exists-p file) (progn - (when-let ((path (file-name-directory orig))) - (make-directory path t)) + (when$ (file-name-directory orig) + (make-directory $ t)) (magit-call-git "mv" file orig)) (magit-call-git "rm" "--cached" "--" file) (magit-call-git "reset" "--" orig))))) diff --git a/lisp/magit-branch.el b/lisp/magit-branch.el index ea5c967..603576b 100644 --- a/lisp/magit-branch.el +++ b/lisp/magit-branch.el @@ -511,8 +511,8 @@ from the source branch's upstream, then an error is raised." (if checkout (magit-call-git "checkout" "-b" branch current) (magit-call-git "branch" branch current))) - (when-let ((upstream (magit-get-indirect-upstream-branch current))) - (magit-call-git "branch" "--set-upstream-to" upstream branch)) + (when$ (magit-get-indirect-upstream-branch current) + (magit-call-git "branch" "--set-upstream-to" $ branch)) (when (and tracked (setq base (if from diff --git a/lisp/magit-files.el b/lisp/magit-files.el index ca45f3a..1a2ee60 100644 --- a/lisp/magit-files.el +++ b/lisp/magit-files.el @@ -344,8 +344,8 @@ is done using `magit-find-index-noselect'." (set-buffer-modified-p nil) (magit-run-after-apply-functions file "un-/stage")) (message "Abort"))) - (when-let ((buffer (magit-get-mode-buffer 'magit-status-mode))) - (with-current-buffer buffer + (when$ (magit-get-mode-buffer 'magit-status-mode) + (with-current-buffer $ (magit-refresh))) t) diff --git a/lisp/magit-gitignore.el b/lisp/magit-gitignore.el index 5267038..a49a8fb 100644 --- a/lisp/magit-gitignore.el +++ b/lisp/magit-gitignore.el @@ -97,8 +97,8 @@ Rules that are defined in that file affect all local repositories." (magit-refresh)) (defun magit--gitignore (rule file) - (when-let ((directory (file-name-directory file))) - (make-directory directory t)) + (when$ (file-name-directory file) + (make-directory $ t)) (with-temp-buffer (when (file-exists-p file) (insert-file-contents file)) diff --git a/lisp/magit-section.el b/lisp/magit-section.el index d802ee4..59acff5 100644 --- a/lisp/magit-section.el +++ b/lisp/magit-section.el @@ -936,8 +936,8 @@ With a prefix argument also expand it." heading) (oset section hidden nil) (magit-section--opportunistic-wash section) (magit-section--opportunistic-paint section) - (when-let ((beg (oref section content))) - (remove-overlays beg (oref section end) 'invisible t)) + (when$ (oref section content) + (remove-overlays $ (oref section end) 'invisible t)) (magit-section-maybe-update-visibility-indicator section) (magit-section-maybe-cache-visibility section) (dolist (child (oref section children)) diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el index 788a8df..20c3383 100644 --- a/lisp/magit-sequence.el +++ b/lisp/magit-sequence.el @@ -289,8 +289,8 @@ the process manually." (unless (magit-branch-p dst) (let ((magit-process-raise-error t)) (magit-call-git "branch" dst start-point)) - (when-let ((upstream (magit-get-indirect-upstream-branch start-point))) - (magit-call-git "branch" "--set-upstream-to" upstream dst))) + (when$ (magit-get-indirect-upstream-branch start-point) + (magit-call-git "branch" "--set-upstream-to" $ dst))) (unless (equal dst current) (let ((magit-process-raise-error t)) (magit-call-git "checkout" dst))) -- cgit v1.0