anchor.diff:                                    key-chord))))
     (values))
   
  -;; TODO: If we move the global mode to root-mode, how do we make sure which one has priority?
  -;; What about reserving a prefix key for application mode and root mode?
   (defun consume-key-sequence-p (sender)
     (let* ((active-window (gethash sender (windows *interface*)))
            (active-buffer (active-buffer active-window))
  -         (local-map (if (minibuffer-active active-window)
  -                        (keymap (mode (minibuffer *interface*)))
  -                        (keymap (mode active-buffer))))
  -         ;; TODO: Shouldn't we give higher priority to the buffer keymap?
  -         (key-maps (list (root-mode-default-keymap) local-map)))
  -    (flet ((is-in-maps? (key-maps)
  -             (dolist (map key-maps)
  +         (keymaps (current-keymaps active-window active-buffer)))
  +    (flet ((is-in-maps? (keymaps)
  +             (dolist (map keymaps)
                  (when (look-up-key-chord-stack (key-chord-stack *interface*) map)
                    (return-from is-in-maps? map)))))
         (cond ((minibuffer-active active-window)
                (log:debug "Minibuffer active")
                t)
  -            ((is-in-maps? key-maps)
  +            ((is-in-maps? keymaps)
                (log:debug "~a found in map ~a" (mapcar #'serialize-key-chord (key-chord-stack *interface*))
  -                        (is-in-maps? key-maps))
  +                        (is-in-maps? keymaps))
                t)
               (t (setf (key-chord-stack *interface*) ()))))))
   
  
positive.code:                (return-from consume-key-sequence t)))))
      (log:debug "Not found in any keymaps")
      (setf (key-chord-stack *interface*) ())))
  
  (defun define-key (&rest key-command-pairs
                     &key mode keymap
  
negative.code: ;;; keymap.lisp --- lisp subroutines for key binding detection
  
  (in-package :next)
  
  