     string and ARG is both a predicate and argument for STRING. If ARG is nil,
     STRING will be omitted from the vector.
 
-NAME is a symbol that identifies this formatter. If NAME isn't specified and
-FORMATTER is a function symbol, the symbol's name is used. If FORMATTER is a
-string or list of strings, the executable is extracted from it and used as the
-NAME. If FORMATTER is a lambda, NAME is required and will error if omitted. Note
-that any formatters with the same NAME will be overwritten by FORMATTER.
-
-INSTALL is a string representing the shell command to install this formatter's
-dependencies. INSTALL can also be a two-element list: (OS COMMAND), or a list of
-these. OS can be windows, macos, linux, freebsd, openbsd or netbsd.
+MODES is a major mode, a list thereof, or a list of two-element sublists with
+the structure: (MAJOR-MODE FORM). FORM is evaluated when the buffer is formatted
+and its return value serves two purposes:
+
+  1. It is a predicate for this formatter. Assuming the MAJOR-MODE matches the
+     current mode, if FORM evaluates to nil, the formatter is skipped.
+  2. It's return value is made available to FORMATTER if it is a function or
+     list of shell arguments via the `mode-result' variable.
 
 FILTER is a function that takes three arguments: the formatted output, any error
 output and the position of the first change. This function must return these


Basic examples:

  (set-formatter! '(asm-mode nasm-mode) \"asmfmt\")
  (set-formatter! 'python-mode \"black -q -\" :install \"pip install black\")
  (set-formatter! 'tidy \"tidy -q -indent\" :modes '(html-mode web-mode))

Advanced examples:

  (set-formatter!
    '((c-mode \".c\")
      (c++-mode \".cpp\")
      (java-mode \".java\")
      (objc-mode \".m\")
      (protobuf-mode \".proto\"))
    '(\"clang-format\"
      (\"-assume-filename=%S\" (or buffer-file-name mode-result \"\")))
    :install '(macos \"brew install clang-format\"))

  (set-formatter!
    '(html-mode
      (web-mode (and (equal \"none\" web-mode-engine)
                     (car (member web-mode-content-type '(\"xml\" \"html\"))))))
    '(\"tidy\" \"-q\" \"-indent\"
      (\"-xml\" (memq major-mode '(nxml-mode xml-mode))))
    :ok-statuses '(0 1)
    :install '(macos \"brew install tidy-html5\"))

  (set-formatter! 'html-tidy  ; overwrite predefined html-tidy formatter
    '(\"tidy\" \"-q\" \"-indent\"

;;; editor/format/autoload/settings.el -*- lexical-binding: t; -*-

;; This must be redefined here because `format-all' only makes it available at
;; compile time.
(defconst +format-system-type
  (cl-case system-type
    (windows-nt 'windows)
