Variable: global-git-commit-mode-hook

global-git-commit-mode-hook is a customizable variable defined in git-commit.el.

Value

nil

Documentation

Hook run after entering or leaving global-git-commit-mode(var)/global-git-commit-mode(fun).

No problems result if this variable is not bound. add-hook automatically binds it. (This is true for all hook variables.)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/git-commit.el
;;; Global Mode

(define-minor-mode global-git-commit-mode
  "Edit Git commit messages.

This global mode arranges for `git-commit-setup' to be called
when a Git commit message file is opened.  That usually happens
when Git uses the Emacsclient as $GIT_EDITOR to have the user
provide such a commit message.

Loading the library `git-commit' by default enables this mode,
but the library is not automatically loaded because doing that
would pull in many dependencies and increase startup time too
much.  You can either rely on `magit' loading this library or
you can load it explicitly.  Autoloading is not an alternative
because in this case autoloading would immediately trigger
full loading."
  :group 'git-commit
  :type 'boolean
  :global t
  :init-value t
  :initialize
  (lambda (symbol exp)
    (custom-initialize-default symbol exp)
    (when global-git-commit-mode
      (add-hook 'find-file-hook #'git-commit-setup-check-buffer)
      (remove-hook 'after-change-major-mode-hook
                   #'git-commit-setup-font-lock-in-buffer)))
  (cond
    (global-git-commit-mode
     (add-hook 'find-file-hook #'git-commit-setup-check-buffer)
     (add-hook 'after-change-major-mode-hook
               #'git-commit-setup-font-lock-in-buffer))
    (t
     (remove-hook 'find-file-hook #'git-commit-setup-check-buffer)
     (remove-hook 'after-change-major-mode-hook
                  #'git-commit-setup-font-lock-in-buffer))))