            return (cadr choice)))
 
 ;;;###autodef
-(cl-defun set-formatter! (modes formatter &key
-                                name
-                                install
-                                filter
-                                ok-statuses
-                                error-regexp)
-  "Define a FORMATTER for MODES.
+(cl-defun set-formatter!
+    (modes-or-name formatter
+                   &key
+                   name
+                   modes
+                   install
+                   filter
+                   ok-statuses
+                   error-regexp)
+  "Define a formatter.
 
-MODES can be a major mode symbol, a list of major modes, or a list of
-two-element lists made up of (MAJOR-MODE FORM). FORM is evaluated when the
-buffer is formatted and its return value serves two roles:
+MODES-OR-NAME can either be a major mode symbol (or list thereof), a unique name
+for the formatter being defined (also a symbol), or a special list of
+two-element sublists with the structure: (MAJOR-MODE FORM).
 
-1. It is a predicate for this formatter. If it returns non-nil (and MAJOR-MODE
-   matches the current mode), that formatter is used.
-2. Its return value is stored in the `mode-result' variable for FORMATTER (if
-   it's a function).
+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.
 
 FORMATTER can be a function, string or nested list.
 

            first-diff)))"
  (declare (indent defun))
  (cl-check-type name (or symbol null))
  (let* ((command-list (cond ((stringp formatter)   ; shell command
                              (split-string formatter " " t))
                             ((listp formatter)     ; shell command in lists

                     ((car command-list) (intern (car command-list)))
                     ((symbolp formatter) formatter)
                     ((user-error "Anonymous formatter requires a :name"))))
         (formatter
          (cond ((commandp formatter)
                 `(format-all-buffer-thunk
                   (lambda (input)
                     (with-silent-modifications
                       (setq buffer-file-name ,(buffer-file-name (buffer-base-buffer))
                             default-directory ,default-directory)
                       (delay-mode-hooks (funcall ',major-mode))
                       (insert input)
                       (condition-case e
                           (progn (call-interactively #',formatter)
                                  (list nil ""))
                         (error (list t (error-message-string e))))))))
                ((functionp formatter)
                 `(format-all-buffer-thunk #',formatter))
                (`(let (args)
                    (dolist (arg ',command-list)
                      (cond ((stringp arg) (push arg args))
                            ((listp arg)
                             (catch 'skip
                               (let (subargs this)
                                 (while (setq this (pop arg))
                                   (cond ((not (stringp (car arg)))
                                          (let ((val (eval (pop arg) t)))
                                            (unless val (throw 'skip nil))
                                            (push (format this val) subargs)))
                                         ((stringp this)
                                          (push this subargs))))
                                 (setq args (append subargs args)))))))
                    (if ,(and (or ok-statuses error-regexp) t)
                        (apply #'format-all-buffer-hard
                               ',ok-statuses ,error-regexp
                               (reverse args))
                      (apply #'format-all-buffer-easy (reverse args)))))))
         (fn
          `(lambda (executable mode-result)
             (let ((result ,formatter))
               ,(if filter
                    `(apply #',filter result)
                  'result))))
         (install (cond ((null install) install)
                        ((listp install)
                         (cdr (assq (+format--resolve-system) install)))
                        (install))))
    (after! format-all
      (puthash name (eval fn t) format-all-format-table)
      (puthash name (car command-list) format-all-executable-table)
      (puthash name (or install (gethash name format-all-install-table))
               format-all-install-table)
      (dolist (mode (doom-enlist modes))
        (cl-destructuring-bind (m &optional probe)
            (doom-enlist mode)
