Function: magit-wip-mode

magit-wip-mode is an autoloaded, interactive and byte-compiled function defined in magit-wip.el.

Signature

(magit-wip-mode &optional ARG)

Documentation

Automatically save uncommitted changes to work-in-progress refs.

This is a minor mode. If called interactively, toggle the Magit-Wip mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value \=magit-wip-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-wip.el
;;;###autoload
(define-minor-mode magit-wip-mode
  "Automatically save uncommitted changes to work-in-progress refs."
  :package-version '(magit . "2.90.0")
  :lighter magit-wip-mode-lighter
  :global t
  :set-after '(magit-wip-merge-branch)
  (cond
    (magit-wip-mode
     (add-hook 'after-save-hook #'magit-wip-commit-buffer-file)
     (add-hook 'magit-after-apply-functions #'magit-wip-commit)
     (add-hook 'magit-before-change-functions #'magit-wip-commit)
     (add-hook 'before-save-hook #'magit-wip-commit-initial-backup)
     (add-hook 'magit-common-git-post-commit-functions #'magit-wip-post-commit)
     (when (eq magit-wip-merge-branch 'immediately)
       (add-hook 'git-commit-post-finish-hook #'magit-wip-commit)))
    (t
     (remove-hook 'after-save-hook #'magit-wip-commit-buffer-file)
     (remove-hook 'magit-after-apply-functions #'magit-wip-commit)
     (remove-hook 'magit-before-change-functions #'magit-wip-commit)
     (remove-hook 'before-save-hook #'magit-wip-commit-initial-backup)
     (remove-hook 'magit-common-git-post-commit-functions #'magit-wip-post-commit)
     (remove-hook 'git-commit-post-finish-hook #'magit-wip-commit))))