     (define-key map [remap evil-window-move-far-right]   'ignore)
     (define-key map [remap evil-window-split]  'ignore)
     (define-key map [remap evil-window-vsplit] 'ignore)
+    (define-key map [remap evil-force-normal-state] 'doom/popup-close-maybe)
+    (define-key map [escape] 'doom/popup-close-maybe)
+    (define-key map (kbd "ESC") 'doom/popup-close-maybe)
     map)
    "Active keymap in popup windows.")
-
-(defvar doom-popup-mode-local-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [remap evil-force-normal-state] 'doom/popup-close)
-    (define-key map [escape] 'doom/popup-close)
-    (define-key map (kbd "ESC") 'doom/popup-close)
-    map)
-  "Active keymap in popup windows with ESC bindings.")
 
 (advice-add 'doom/evil-window-move :around 'doom*popup-window-move)
 

    (unless dont-redraw (redraw-frame))))

;;;###autoload
(defun doom/popup-close-all (&optional dont-kill dont-redraw)
  "Closes all popups (kill them if DONT-KILL-BUFFERS is non-nil). Then redraw
the display (unless DONT-REDRAW is non-nil)."

                          (cdr it)))
                      doom-popup-rules)))
    (setq doom-last-popup (current-buffer))
    (setq-local doom-popup-rule rules)))

(provide 'defuns-popups)
;;; defuns-popups.el ends here
