 
 ;;;;; Live modification checking
 
+(defun straight-register-repo-modification (local-repo)
+  "Register a modification of the given LOCAL-REPO, a string.
+Always return nil, for convenience of usage."
+  (ignore
+   (unless (string-match-p "/" local-repo)
+     (make-directory (straight--modified-dir) 'parents)
+     (with-temp-file (straight--modified-file local-repo)))))
+
 (defun straight-register-file-modification ()
   "Register a modification of the current file.
 This function is placed on `before-save-hook' by
 `straight-live-modifications-mode'."
   (when buffer-file-name
     (when-let ((local-repo (straight--determine-repo buffer-file-name)))
-      (unless (string-match-p "/" local-repo)
-        (make-directory (straight--modified-dir) 'parents)
-        (with-temp-file (straight--modified-file local-repo))))))
+      (straight-register-repo-modification local-repo))))
 
 (define-minor-mode straight-live-modifications-mode
   "Mode that causes straight.el to check for modifications as you make them.

  "In LOCAL-REPO, check out COMMIT.
LOCAL-REPO is a string naming a local package repository. COMMIT
is a 40-character string identifying a Git commit."
  (while t
    (and (straight-vc-git--ensure-nothing-in-progress local-repo)
         (straight-vc-git--ensure-worktree local-repo)

      (local-repo branch)
    (let ((branch (or branch straight-vc-git-default-branch)))
      (and (straight-vc-git--ensure-remotes recipe)
           (or (and (straight-vc-git--ensure-nothing-in-progress local-repo)
                    (straight-vc-git--ensure-worktree local-repo)
                    (straight-vc-git--ensure-head local-repo branch))
               (straight-register-repo-modification local-repo))))))

;;;;;; API

