   (let ((func (intern (format "spacemacs//%s-on-exit" name))))
     (eval `(defun ,func ()
              "Function executed after each micro-state command."
-             (if (reduce (lambda (x y) (or x y))
-                         (mapcar (lambda (x)
-                                   (spacemacs//micro-state-stay? ',name x))
-                                 ',wrappers)
-                         :initial-value nil)
-                 't
-               ,@on-exit
-               (spacemacs//micro-state-close-window)
-               nil)))))
+             (let* ((cur-wrapper (spacemacs//get-current-wrapper
+                                  ',name ',wrappers))
+                    (exitp (if cur-wrapper (plist-get cur-wrapper :exit)
+                             ,(not persistent))))
+               (when exitp ,@on-exit (spacemacs//micro-state-close-window))
+               (not exitp))))))
 
-(defun spacemacs//micro-state-stay? (name wrapper)
-  "Return non nil if WRAPPER does not leave the micro-state."
-  (let ((micro-state-fun (spacemacs//micro-state-func-name name))
-        (key (car wrapper))
-        (func (cadr wrapper)))
-    (when (and (or (eq this-command micro-state-fun)
-                   (eq this-command func))
-               (equal (this-command-keys) (kbd key)))
-      (not (plist-get wrapper :exit)))))
+(defun spacemacs//get-current-wrapper (name wrappers)
+  "Return the wrapper being executed.
+Returns nil if no wrapper is being executed (i.e. an unbound key has been
+pressed)."
+  (let ((micro-state-fun (spacemacs//micro-state-func-name name)))
+    (catch 'found
+      (dolist (wrapper wrappers)
+        (let ((key (car wrapper))
+              (func (cadr wrapper)))
+          (if (and (or (eq this-command micro-state-fun)
+                       (eq this-command func))
+                   (equal (this-command-keys) (kbd key)))
+              (throw 'found wrapper))))
+      nil)))
 
 (defun spacemacs//micro-state-propertize-doc (doc)
   "Return a propertized doc string from DOC."

  (mapcar (lambda (x) `(define-key map ,(kbd (car x)) ',(cadr x)))
          wrappers))

(defun spacemacs//micro-state-create-exit-func (name wrappers on-exit)
  "Return a function to execute when leaving the micro-state.

The returned function returns nil if the executed command exits the


(defun spacemacs//micro-state-create-wrapper (name default-doc binding)
  "Create a wrapper of FUNC and return a tuple (key wrapper BINDING)."
  (let* ((key (car binding))
         (wrapped (cadr binding))
         (binding-doc (spacemacs/mplist-get binding :doc))
         (wrapper-name (intern (format "spacemacs//%s-%s-%s"
                                       (symbol-name name)
                                       (symbol-name wrapped)
                                       key)))
         (wrapper-func
          (eval `(defun ,wrapper-name ()
                   "Auto-generated function"
