Function: magit-wip-mode

magit-wip-mode is an interactive and natively 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 global 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

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/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
  (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))
    (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))))