Next: , Previous: , Up: Interface Concepts   [Contents][Index]


4.4 Completion and Confirmation

Many commands read a value from the user. By default this is done using the built-in function completing-read, but Magit can instead use another completion framework.

User Option: magit-completing-read-function

The value of this variable is the function used to perform completion. Because functions intended to replace completing-read often are not fully compatible drop-in replacements, and also because Magit expects them to add the default choice to the prompt themselves, such functions should not be used directly. Instead a wrapper function has to be used.

Currently only the real completing-read and Ido are fully supported. More frameworks will be supported in the future.

Function: magit-builtin-completing-read prompt choices &optional predicate require-match initial-input hist def

Perform completion using completion-read.

Function: magit-ido-completing-read prompt choices &optional predicate require-match initial-input hist def

Perform completion using ido-completing-read+ from the package by the same name (which you have to explicitly install). Ido itself comes with a supposed drop-in replacement ido-completing-read, but that has too many deficits to serve our needs.

User Option: magit-list-refs-sortby

For many commands that read a ref or refs from the user, the value of this option can be used to control the order of the refs. Valid values include any key accepted by the --sort flag of git for-each-ref. By default, refs are sorted alphabetically by their full name (e.g., "refs/heads/master").

By default many commands that could potentially lead to data loss have to be confirmed. This includes many very common commands, so this can become annoying quickly. Many of these actions can be undone, provided magit-wip-before-change-mode is turned on (which it is not by default, due to performance concerns).

User Option: magit-no-confirm

The value of this option is a list of symbols, representing commands which do not have to be confirmed by the user before being carried out.

When the global mode magit-wip-before-change-mode is enabled then many commands can be undone. If that mode is enabled then adding safe-with-wip to this list has the same effect as adding discard, reverse, stage-all-changes, and unstage-all-changes.

(add-to-list 'magit-no-confirm 'safe-with-wip)

For a list of all symbols that can be added to the value of this variable, see the doc-string.

Note that there are commands that ignore this option and always require confirmation, or which can be told not to do so using another dedicated option. Also most commands, when acting on multiple sections at once always, require confirmation, even when they do respect this option when acting on a single section.


Next: , Previous: , Up: Interface Concepts   [Contents][Index]