branch: elpa/magit
commit 06f3ffa868f9aaa4ddeaf65811f315fdb6a4a626
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    Merge when-let and neighboring conditionals
---
 lisp/git-commit.el      | 22 ++++++-------
 lisp/magit-blame.el     |  6 ++--
 lisp/magit-branch.el    | 20 +++++------
 lisp/magit-diff.el      | 88 ++++++++++++++++++++++++-------------------------
 lisp/magit-fetch.el     | 10 +++---
 lisp/magit-git.el       | 17 +++++-----
 lisp/magit-log.el       | 56 +++++++++++++++----------------
 lisp/magit-mode.el      | 11 +++----
 lisp/magit-section.el   | 22 ++++++-------
 lisp/magit-submodule.el | 66 ++++++++++++++++++-------------------
 lisp/magit-wip.el       | 14 ++++----
 11 files changed, 166 insertions(+), 166 deletions(-)

diff --git a/lisp/git-commit.el b/lisp/git-commit.el
index 7a727c7e4e8..1a0eef7ceef 100644
--- a/lisp/git-commit.el
+++ b/lisp/git-commit.el
@@ -489,7 +489,7 @@ the redundant bindings, then set this to nil, before loading
 (defun git-commit-file-not-found ()
   ;; cygwin git will pass a cygwin path (/cygdrive/c/foo/.git/...),
   ;; try to handle this in window-nt Emacs.
-  (when-let
+  (when-let*
       ((file (and (or (string-match-p git-commit-filename-regexp
                                       buffer-file-name)
                       (and (boundp 'git-rebase-filename-regexp)
@@ -497,11 +497,11 @@ the redundant bindings, then set this to nil, before 
loading
                                            buffer-file-name)))
                   (not (file-accessible-directory-p
                         (file-name-directory buffer-file-name)))
-                  (magit-expand-git-file-name (substring buffer-file-name 
2)))))
-    (when (file-accessible-directory-p (file-name-directory file))
-      (let ((inhibit-read-only t))
-        (insert-file-contents file t)
-        t))))
+                  (magit-expand-git-file-name (substring buffer-file-name 2))))
+       ((file-accessible-directory-p (file-name-directory file)))
+       (inhibit-read-only t))
+    (insert-file-contents file t)
+    t))
 
 (when (eq system-type 'windows-nt)
   (add-hook 'find-file-not-found-functions #'git-commit-file-not-found))
@@ -747,11 +747,11 @@ With a numeric prefix ARG, go back ARG comments."
       ;; Unlike `log-edit-previous-comment' we save the current
       ;; non-empty and newly written comment, because otherwise
       ;; it would be irreversibly lost.
-      (when-let ((message (git-commit-buffer-message)))
-        (unless (ring-member log-edit-comment-ring message)
-          (ring-insert log-edit-comment-ring message)
-          (cl-incf arg)
-          (setq len (ring-length log-edit-comment-ring))))
+      (when-let* ((message (git-commit-buffer-message))
+                  ((not (ring-member log-edit-comment-ring message))))
+        (ring-insert log-edit-comment-ring message)
+        (cl-incf arg)
+        (setq len (ring-length log-edit-comment-ring)))
       ;; Delete the message but not the instructions at the end.
       (save-restriction
         (goto-char (point-min))
diff --git a/lisp/magit-blame.el b/lisp/magit-blame.el
index fe5a210a15d..f34bf20a94a 100644
--- a/lisp/magit-blame.el
+++ b/lisp/magit-blame.el
@@ -899,9 +899,9 @@ then also kill the buffer."
                                      #'previous-single-char-property-change
                                    #'next-single-char-property-change)
                                  pos 'magit-blame-chunk)))
-            (when-let ((o (magit-blame--overlay-at pos)))
-              (when (equal (oref (magit-blame-chunk-at pos) orig-rev) rev)
-                (setq ov o)))))
+            (when-let ((o (magit-blame--overlay-at pos))
+                       ((equal (oref (magit-blame-chunk-at pos) orig-rev) 
rev)))
+              (setq ov o))))
         (if ov
             (goto-char (overlay-start ov))
           (user-error "No more chunks from same commit")))
diff --git a/lisp/magit-branch.el b/lisp/magit-branch.el
index 3dc092687b4..ab03c4887f5 100644
--- a/lisp/magit-branch.el
+++ b/lisp/magit-branch.el
@@ -600,16 +600,16 @@ prompt is confusing."
        (setq branches
              (list (magit-read-branch-prefer-other
                     (if force "Force delete branch" "Delete branch")))))
-     (unless force
-       (when-let ((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")))))
+     (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"))))
      (list branches force)))
   (let* ((refs (mapcar #'magit-ref-fullname branches))
          (ambiguous (--remove it refs)))
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 9ac0f564505..50e5157a1a1 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -796,9 +796,9 @@ and `:slant'."
   (pcase-let ((`(,args ,files)
                (magit-diff--get-value 'magit-diff-mode
                                       magit-prefix-use-buffer-arguments)))
-    (unless (eq transient-current-command 'magit-dispatch)
-      (when-let ((file (magit-file-relative-name)))
-        (setq files (list file))))
+    (when-let ((not (eq transient-current-command 'magit-dispatch))
+               (file (magit-file-relative-name)))
+      (setq files (list file)))
     (oset obj value (if files `(("--" ,@files) ,args) args))))
 
 (cl-defmethod transient-init-value ((obj magit-diff-refresh-prefix))
@@ -830,13 +830,13 @@ and `:slant'."
            (eq major-mode mode))
       (setq args  magit-buffer-diff-args)
       (setq files magit-buffer-diff-files))
-     ((and (memq use-buffer-args '(always selected))
-           (when-let ((buffer (magit-get-mode-buffer
-                               mode nil
-                               (eq use-buffer-args 'selected))))
-             (setq args  (buffer-local-value 'magit-buffer-diff-args buffer))
-             (setq files (buffer-local-value 'magit-buffer-diff-files buffer))
-             t)))
+     ((when-let (((memq use-buffer-args '(always selected)))
+                 (buffer (magit-get-mode-buffer
+                          mode nil
+                          (eq use-buffer-args 'selected))))
+        (setq args  (buffer-local-value 'magit-buffer-diff-args buffer))
+        (setq files (buffer-local-value 'magit-buffer-diff-files buffer))
+        t))
      ((plist-member (symbol-plist mode) 'magit-diff-current-arguments)
       (setq args (get mode 'magit-diff-current-arguments)))
      ((when-let ((elt (assq (intern (format "magit-diff:%s" mode))
@@ -2793,25 +2793,25 @@ or a ref which is not a branch, then it inserts 
nothing."
         (magit--insert-related-refs
          magit-buffer-revision "--contains" "Contained"
          (memq magit-revision-insert-related-refs '(all mixed))))
-      (when (magit-revision-insert-related-refs-display-p 'follows)
-        (when-let ((follows (magit-get-current-tag magit-buffer-revision t)))
-          (let ((tag (car  follows))
-                (cnt (cadr follows)))
-            (magit-insert-section (tag tag)
-              (insert
-               (format "Follows:    %s (%s)\n"
-                       (propertize tag 'font-lock-face 'magit-tag)
-                       (propertize (number-to-string cnt)
-                                   'font-lock-face 'magit-branch-local)))))))
-      (when (magit-revision-insert-related-refs-display-p 'precedes)
-        (when-let ((precedes (magit-get-next-tag magit-buffer-revision t)))
-          (let ((tag (car  precedes))
-                (cnt (cadr precedes)))
-            (magit-insert-section (tag tag)
-              (insert (format "Precedes:   %s (%s)\n"
-                              (propertize tag 'font-lock-face 'magit-tag)
-                              (propertize (number-to-string cnt)
-                                          'font-lock-face 'magit-tag)))))))
+      (when-let (((magit-revision-insert-related-refs-display-p 'follows))
+                 (follows (magit-get-current-tag magit-buffer-revision t)))
+        (let ((tag (car  follows))
+              (cnt (cadr follows)))
+          (magit-insert-section (tag tag)
+            (insert
+             (format "Follows:    %s (%s)\n"
+                     (propertize tag 'font-lock-face 'magit-tag)
+                     (propertize (number-to-string cnt)
+                                 'font-lock-face 'magit-branch-local))))))
+      (when-let (((magit-revision-insert-related-refs-display-p 'precedes))
+                 (precedes (magit-get-next-tag magit-buffer-revision t)))
+        (let ((tag (car  precedes))
+              (cnt (cadr precedes)))
+          (magit-insert-section (tag tag)
+            (insert (format "Precedes:   %s (%s)\n"
+                            (propertize tag 'font-lock-face 'magit-tag)
+                            (propertize (number-to-string cnt)
+                                        'font-lock-face 'magit-tag))))))
       (insert ?\n))))
 
 (defun magit-revision-insert-related-refs-display-p (sym)
@@ -2854,21 +2854,21 @@ Refer to user option 
`magit-revision-insert-related-refs-display-alist'."
 (defun magit-insert-revision-gravatar (beg rev email regexp)
   (save-excursion
     (goto-char beg)
-    (when (re-search-forward regexp nil t)
-      (when-let ((window (get-buffer-window)))
-        (let* ((column   (length (match-string 0)))
-               (font-obj (query-font (font-at (point) window)))
-               (size     (* 2 (+ (aref font-obj 4)
-                                 (aref font-obj 5))))
-               (align-to (+ column
-                            (ceiling (/ size (aref font-obj 7) 1.0))
-                            1))
-               (gravatar-size (- size 2)))
-          (ignore-errors ; service may be unreachable
-            (gravatar-retrieve email #'magit-insert-revision-gravatar-cb
-                               (list gravatar-size rev
-                                     (point-marker)
-                                     align-to column))))))))
+    (when-let (((re-search-forward regexp nil t))
+               (window (get-buffer-window)))
+      (let* ((column   (length (match-string 0)))
+             (font-obj (query-font (font-at (point) window)))
+             (size     (* 2 (+ (aref font-obj 4)
+                               (aref font-obj 5))))
+             (align-to (+ column
+                          (ceiling (/ size (aref font-obj 7) 1.0))
+                          1))
+             (gravatar-size (- size 2)))
+        (ignore-errors ; service may be unreachable
+          (gravatar-retrieve email #'magit-insert-revision-gravatar-cb
+                             (list gravatar-size rev
+                                   (point-marker)
+                                   align-to column)))))))
 
 (defun magit-insert-revision-gravatar-cb (image size rev marker align-to 
column)
   (unless (eq image 'error)
diff --git a/lisp/magit-fetch.el b/lisp/magit-fetch.el
index 003d1e8ac3d..9ee04e95b02 100644
--- a/lisp/magit-fetch.el
+++ b/lisp/magit-fetch.el
@@ -178,11 +178,11 @@ with a prefix argument."
                  (list nil (transient-args 'magit-fetch-modules))))
   (if transient
       (transient-setup 'magit-fetch-modules)
-    (when (magit-git-version< "2.8.0")
-      (when-let ((value (transient-arg-value "--jobs=" args)))
-        (message "Dropping --jobs; not supported by Git v%s"
-                 (magit-git-version))
-        (setq args (remove (format "--jobs=%s" value) args))))
+    (when-let (((magit-git-version< "2.8.0"))
+               (value (transient-arg-value "--jobs=" args)))
+      (message "Dropping --jobs; not supported by Git v%s"
+               (magit-git-version))
+      (setq args (remove (format "--jobs=%s" value) args)))
     (magit-with-toplevel
       (magit-run-git-async "fetch" "--recurse-submodules" args))))
 
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 7dd26a225bc..b6af965102b 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -1649,10 +1649,10 @@ The amount of time spent searching is limited by
                           (magit-git-lines
                            "for-each-ref" "refs/heads"
                            "--format=%(refname:short)\t%(upstream:short)"))))
-    (when-let ((old (assoc oldname branches)))
-      (unless (assoc newname branches)
-        (magit-call-git "branch" "-m" oldname newname)
-        (setcar old newname)))
+    (when-let ((old (assoc oldname branches))
+               ((not (assoc newname branches))))
+      (magit-call-git "branch" "-m" oldname newname)
+      (setcar old newname))
     (let ((new (if (magit-branch-p newname)
                    newname
                  (concat remote "/" newname))))
@@ -2439,10 +2439,11 @@ and this option only controls what face is used.")
                     (expand-file-name "index.magit." (magit-gitdir))))))
        (unwind-protect
            (magit-with-toplevel
-             (when-let ((tree ,tree))
-               (unless (magit-git-success "read-tree" ,arg tree
-                                          (concat "--index-output=" ,file))
-                 (error "Cannot read tree %s" tree)))
+             (when-let* ((tree ,tree)
+                         ((not (magit-git-success
+                                "read-tree" ,arg tree
+                                (concat "--index-output=" ,file)))))
+               (error "Cannot read tree %s" tree))
              (with-environment-variables (("GIT_INDEX_FILE" ,file))
                ,@body))
          (ignore-errors
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index 6c304d00b6f..3663125f491 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -353,9 +353,9 @@ commits before and half after."
   (pcase-let ((`(,args ,files)
                (magit-log--get-value 'magit-log-mode
                                      magit-prefix-use-buffer-arguments)))
-    (unless (eq transient-current-command 'magit-dispatch)
-      (when-let ((file (magit-file-relative-name)))
-        (setq files (list file))))
+    (when-let ((not (eq transient-current-command 'magit-dispatch))
+               (file (magit-file-relative-name)))
+      (setq files (list file)))
     (oset obj value (if files `(("--" ,@files) ,args) args))))
 
 (cl-defmethod transient-init-value ((obj magit-log-refresh-prefix))
@@ -387,13 +387,13 @@ commits before and half after."
            (eq major-mode mode))
       (setq args  magit-buffer-log-args)
       (setq files magit-buffer-log-files))
-     ((and (memq use-buffer-args '(always selected))
-           (when-let ((buffer (magit-get-mode-buffer
-                               mode nil
-                               (eq use-buffer-args 'selected))))
-             (setq args  (buffer-local-value 'magit-buffer-log-args buffer))
-             (setq files (buffer-local-value 'magit-buffer-log-files buffer))
-             t)))
+     ((when-let (((memq use-buffer-args '(always selected)))
+                 (buffer (magit-get-mode-buffer
+                          mode nil
+                          (eq use-buffer-args 'selected))))
+        (setq args  (buffer-local-value 'magit-buffer-log-args buffer))
+        (setq files (buffer-local-value 'magit-buffer-log-files buffer))
+        t))
      ((plist-member (symbol-plist mode) 'magit-log-current-arguments)
       (setq args (get mode 'magit-log-current-arguments)))
      ((when-let ((elt (assq (intern (format "magit-log:%s" mode))
@@ -1888,15 +1888,15 @@ in the pushremote case."
 (defun magit-insert-unpulled-from-pushremote ()
   "Insert commits that haven't been pulled from the push-remote yet."
   (when-let* ((target (magit-get-push-branch))
-              (range  (concat ".." target)))
-    (when (magit--insert-pushremote-log-p)
-      (magit-insert-section (unpulled range t)
-        (magit-insert-heading
-          (format (propertize "Unpulled from %s."
-                              'font-lock-face 'magit-section-heading)
-                  (propertize target 'font-lock-face 'magit-branch-remote)))
-        (magit--insert-log nil range magit-buffer-log-args)
-        (magit-log-insert-child-count)))))
+              (range  (concat ".." target))
+              ((magit--insert-pushremote-log-p)))
+    (magit-insert-section (unpulled range t)
+      (magit-insert-heading
+        (format (propertize "Unpulled from %s."
+                            'font-lock-face 'magit-section-heading)
+                (propertize target 'font-lock-face 'magit-branch-remote)))
+      (magit--insert-log nil range magit-buffer-log-args)
+      (magit-log-insert-child-count))))
 
 (cl-defmethod magit-section-ident-value ((section magit-unpushed-section))
   "\"..@{push}\" cannot be used as the value because that is
@@ -1968,15 +1968,15 @@ Show the last `magit-log-section-commit-count' commits."
 (defun magit-insert-unpushed-to-pushremote ()
   "Insert commits that haven't been pushed to the push-remote yet."
   (when-let* ((target (magit-get-push-branch))
-              (range  (concat target "..")))
-    (when (magit--insert-pushremote-log-p)
-      (magit-insert-section (unpushed range t)
-        (magit-insert-heading
-          (format (propertize "Unpushed to %s."
-                              'font-lock-face 'magit-section-heading)
-                  (propertize target 'font-lock-face 'magit-branch-remote)))
-        (magit--insert-log nil range magit-buffer-log-args)
-        (magit-log-insert-child-count)))))
+              (range  (concat target ".."))
+              ((magit--insert-pushremote-log-p)))
+    (magit-insert-section (unpushed range t)
+      (magit-insert-heading
+        (format (propertize "Unpushed to %s."
+                            'font-lock-face 'magit-section-heading)
+                (propertize target 'font-lock-face 'magit-branch-remote)))
+      (magit--insert-log nil range magit-buffer-log-args)
+      (magit-log-insert-child-count))))
 
 (defun magit--insert-pushremote-log-p ()
   (magit--with-refresh-cache
diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index c347db87a75..9fd5cc5fe0b 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -1132,12 +1132,11 @@ Note that refreshing a Magit buffer is done by 
re-creating its
 contents from scratch, which can be slow in large repositories.
 If you are not satisfied with Magit's performance, then you
 should obviously not add this function to that hook."
-  (when (and (not magit--disable-save-buffers)
-             (magit-inside-worktree-p t))
-    (when-let ((buffer (ignore-errors
-                         (magit-get-mode-buffer 'magit-status-mode))))
-      (add-to-list 'magit-after-save-refresh-buffers buffer)
-      (add-hook 'post-command-hook #'magit-after-save-refresh-buffers))))
+  (when-let (((and (not magit--disable-save-buffers)
+                   (magit-inside-worktree-p t)))
+             (buf (ignore-errors (magit-get-mode-buffer 'magit-status-mode))))
+    (add-to-list 'magit-after-save-refresh-buffers buf)
+    (add-hook 'post-command-hook #'magit-after-save-refresh-buffers)))
 
 (defun magit-maybe-save-repository-buffers ()
   "Maybe save file-visiting buffers belonging to the current repository.
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 926b5a2bbf1..61eb221aa32 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -631,17 +631,17 @@ with SECTION, otherwise return a list of section types."
         `(menu-item
           ,(if (oref section hidden) "Expand section" "Collapse section")
           magit-section-toggle))
-      (unless (oref section hidden)
-        (when-let ((children (oref section children)))
-          (when (seq-some #'magit-section-content-p children)
-            (when (seq-some (lambda (c) (oref c hidden)) children)
-              (keymap-set-after menu "<magit-section-show-children>"
-                `(menu-item "Expand children"
-                            magit-section-show-children)))
-            (when (seq-some (lambda (c) (not (oref c hidden))) children)
-              (keymap-set-after menu "<magit-section-hide-children>"
-                `(menu-item "Collapse children"
-                            magit-section-hide-children))))))
+      (when-let (((not (oref section hidden)))
+                 (children (oref section children)))
+        (when (seq-some #'magit-section-content-p children)
+          (when (seq-some (lambda (c) (oref c hidden)) children)
+            (keymap-set-after menu "<magit-section-show-children>"
+              `(menu-item "Expand children"
+                          magit-section-show-children)))
+          (when (seq-some (lambda (c) (not (oref c hidden))) children)
+            (keymap-set-after menu "<magit-section-hide-children>"
+              `(menu-item "Collapse children"
+                          magit-section-hide-children)))))
       (keymap-set-after menu "<separator-magit-1>" menu-bar-separator))
     (keymap-set-after menu "<magit-describe-section>"
       `(menu-item "Describe section" magit-describe-section))
diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el
index 79e34c1c080..0a4e70880ed 100644
--- a/lisp/magit-submodule.el
+++ b/lisp/magit-submodule.el
@@ -590,39 +590,39 @@ These sections can be expanded to show the respective 
commits."
 
 (defun magit--insert-modules-logs (heading type range)
   "For internal use, don't add to a hook."
-  (unless (magit-ignore-submodules-p)
-    (when-let ((modules (magit-list-module-paths)))
-      (magit-insert-section ((eval type) nil t)
-        (string-match "\\`\\(.+\\) \\([^ ]+\\)\\'" heading)
-        (magit-insert-heading
-          (propertize (match-string 1 heading)
-                      'font-lock-face 'magit-section-heading)
-          " "
-          (propertize (match-string 2 heading)
-                      'font-lock-face 'magit-branch-remote)
-          ":")
-        (dolist (module modules)
-          (when-let* ((default-directory (expand-file-name module))
-                      ((file-exists-p (expand-file-name ".git")))
-                      (lines (magit-git-lines "-c" "push.default=current"
-                                              "log" "--oneline" range))
-                      (count (length lines))
-                      ((> count 0)))
-            (magit-insert-section
-                ( module module t
-                  :range range)
-              (magit-insert-heading count
-                (propertize module 'font-lock-face 'magit-diff-file-heading))
-              (dolist (line lines)
-                (string-match magit-log-module-re line)
-                (let ((rev (match-string 1 line))
-                      (msg (match-string 2 line)))
-                  (magit-insert-section (module-commit rev t)
-                    (insert (propertize rev 'font-lock-face 'magit-hash) " "
-                            (funcall magit-log-format-message-function rev msg)
-                            "\n")))))))
-        (magit-cancel-section 'if-empty)
-        (insert ?\n)))))
+  (when-let (((not (magit-ignore-submodules-p)))
+             (modules (magit-list-module-paths)))
+    (magit-insert-section ((eval type) nil t)
+      (string-match "\\`\\(.+\\) \\([^ ]+\\)\\'" heading)
+      (magit-insert-heading
+        (propertize (match-string 1 heading)
+                    'font-lock-face 'magit-section-heading)
+        " "
+        (propertize (match-string 2 heading)
+                    'font-lock-face 'magit-branch-remote)
+        ":")
+      (dolist (module modules)
+        (when-let* ((default-directory (expand-file-name module))
+                    ((file-exists-p (expand-file-name ".git")))
+                    (lines (magit-git-lines "-c" "push.default=current"
+                                            "log" "--oneline" range))
+                    (count (length lines))
+                    ((> count 0)))
+          (magit-insert-section
+              ( module module t
+                :range range)
+            (magit-insert-heading count
+              (propertize module 'font-lock-face 'magit-diff-file-heading))
+            (dolist (line lines)
+              (string-match magit-log-module-re line)
+              (let ((rev (match-string 1 line))
+                    (msg (match-string 2 line)))
+                (magit-insert-section (module-commit rev t)
+                  (insert (propertize rev 'font-lock-face 'magit-hash) " "
+                          (funcall magit-log-format-message-function rev msg)
+                          "\n")))))))
+      (magit-cancel-section 'if-empty)
+      (insert ?\n))))
 
 ;;; List
 
diff --git a/lisp/magit-wip.el b/lisp/magit-wip.el
index 3cbdeeec765..4c13e3bc9e7 100644
--- a/lisp/magit-wip.el
+++ b/lisp/magit-wip.el
@@ -186,13 +186,13 @@ variant `magit-wip-after-save-mode'."
 Also see `magit-wip-after-save-mode' which calls this function
 automatically whenever a buffer visiting a tracked file is saved."
   (interactive (list "wip-save %s after save"))
-  (unless magit--wip-inhibit-autosave
-    (when-let ((ref (magit-wip-get-ref)))
-      (magit-with-toplevel
-        (let ((file (file-relative-name buffer-file-name)))
-          (magit-wip-commit-worktree
-           ref (list file)
-           (format (or msg "autosave %s after save") file)))))))
+  (when-let (((not magit--wip-inhibit-autosave))
+             (ref (magit-wip-get-ref)))
+    (magit-with-toplevel
+      (let ((file (file-relative-name buffer-file-name)))
+        (magit-wip-commit-worktree
+         ref (list file)
+         (format (or msg "autosave %s after save") file))))))
 
 ;;;###autoload
 (define-minor-mode magit-wip-after-apply-mode

Reply via email to