     '(("e" "Dired and open recursive edit"
        (lambda ()
          (dired (or straight--default-directory default-directory))
-         (let ((straight--default-directory nil))
-           (recursive-edit))))
+         (straight--recursive-edit)))
       ("g" "Magit and open recursive edit"
        (lambda ()
          (when (straight--magit-status
                 (or straight--default-directory default-directory))
-           (let ((straight--default-directory nil))
-             (recursive-edit)))))))))
+           (straight--recursive-edit))))))))
 
 (defmacro straight-vc-git--popup (prompt &rest actions)
   "Same as `straight--popup', but specialized for vc-git methods.

     ,@actions
     ("e" "Dired and open recursive edit"
      (dired (or straight--default-directory default-directory))
      ;; Don't mess up recursive straight.el operations. The wonderful
      ;; thing about using our own variable is that since it's not
      ;; buffer-local, a recursive binding to nil is actually able to
      ;; undo the effects of the ambient binding.
      (let ((straight--default-directory nil))
        (recursive-edit)))
     ("g" "Magit and open recursive edit"
      (when (straight--magit-status
             (or straight--default-directory default-directory))
        (let ((straight--default-directory nil))
          (recursive-edit))))))

(defun straight-vc-git--encode-url (repo host &optional protocol)
  "Generate a URL from a REPO depending on the value of HOST and PROTOCOL.

  (prog1 t
    (magit-status-setup-buffer directory)))

(defun straight--recursive-edit ()
  "Start a new recursive edit session.
Make sure that other packages such as `server.el' don't cause us
to loose our session."
  ;; Don't mess up recursive straight.el operations. The wonderful
  ;; thing about using our own variable is that since it's not
  ;; buffer-local, a recursive binding to nil is actually able to
  ;; undo the effects of the ambient binding.
  (cl-letf (((symbol-function 'top-level) #'ignore)
            (straight--default-directory nil))
    (recursive-edit)))

(defun straight-vc-git--popup-raw (prompt actions)
  "Same as `straight--popup-raw', but specialized for vc-git methods.
Two additional actions are inserted at the end of the list: \"e\"
