 ;;
 
 ;;;###autoload
-(defun +format-buffer ()
+(defun +format-buffer (formatter mode-result)
   "Format the source code in the current buffer.
 
 Returns any of the following values:

(defun +format/buffer ()
  "Format the source code in the current buffer."
  (interactive)
  (pcase (+format-buffer)
    (`error (message "Failed to format buffer due to errors"))
    (`noop (message "Buffer was already formatted"))
    (_ (message "Formatted (%s)" (car (format-all-probe))))))

;;;###autoload
(defun +format/region (beg end)

  (add-hook 'before-save-hook #'+format|buffer nil t))

;;;###autoload
(defun +format|buffer ()
  "Format the source code in the current buffer with minimal feedback.

Meant for `before-save-hook'."
  (cl-destructuring-bind (formatter mode-result) (format-all-probe)
    (pcase (+format-buffer formatter mode-result)
      (`error (message "Failed to format buffer due to errors"))
      (`noop (message "Buffer was already formatted"))
      (_ (message "Formatted (%s)" formatter)))))

