Function: magit-maybe-define-global-key-bindings

magit-maybe-define-global-key-bindings is a byte-compiled function defined in magit.el.

Signature

(magit-maybe-define-global-key-bindings &optional FORCE)

Documentation

See variable magit-define-global-key-bindings.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit.el
;;;###autoload
(progn
  (defun magit-maybe-define-global-key-bindings (&optional force)
    "See variable `magit-define-global-key-bindings'."
    (when magit-define-global-key-bindings
      (let ((map (current-global-map)))
        (pcase-dolist (`(,key . ,def)
                       (cond ((eq magit-define-global-key-bindings 'recommended)
                              '(("C-x g"   . magit-status)
                                ("C-c g"   . magit-dispatch)
                                ("C-c f"   . magit-file-dispatch)))
                             ('(("C-x g"   . magit-status)
                                ("C-x M-g" . magit-dispatch)
                                ("C-c M-g" . magit-file-dispatch)))))
          ;; This is autoloaded and thus is used before `compat' is
          ;; loaded, so we cannot use `keymap-lookup' and `keymap-set'.
          (when (or force
                    (not (or (lookup-key map (kbd key))
                             (where-is-internal def (make-sparse-keymap) t))))
            (define-key map (kbd key) def))))))
  (if after-init-time
      (magit-maybe-define-global-key-bindings)
    (add-hook 'after-init-hook #'magit-maybe-define-global-key-bindings t)))