diff options
| author | Radon Rosborough <radon@intuitiveexplanations.com> | 2023-05-06 15:25:56 -0700 |
|---|---|---|
| committer | Radon Rosborough <radon@intuitiveexplanations.com> | 2023-05-06 15:26:17 -0700 |
| commit | 01f2f0da561e29b75c6b12933943a40850cf704c (patch) | |
| tree | b96d7c771adcca335546fe55f6c994ddebff650c | |
| parent | e9e595f003605a7e366776c7a1715dc7093e29d5 (diff) | |
Fix safe-local-variable for apheleia-formatter
| -rw-r--r-- | apheleia-core.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apheleia-core.el b/apheleia-core.el index b70450f..d4db718 100644 --- a/apheleia-core.el +++ b/apheleia-core.el @@ -995,8 +995,18 @@ function: %s" command))) (defvar-local apheleia-formatter nil "Name of formatter to use in current buffer, a symbol or nil. If non-nil, then `apheleia-formatters' should have a matching -entry. This overrides `apheleia-mode-alist'.") -(put 'apheleia-formatter 'safe-local-variable 'symbolp) +entry. This overrides `apheleia-mode-alist'. + +The value can also be a list of symbols to apply multiple +formatters in sequence.") + +(defun apheleia--formatter-safe-p (val) + "Return non-nil if VAL is a good value for `apheleia-formatter'." + (or (symbolp val) + (and (listp val) + (cl-every #'symbolp val)))) + +(put 'apheleia-formatter 'safe-local-variable #'apheleia--formatter-safe-p) (defun apheleia--ensure-list (arg) "Ensure ARG is a list of length at least 1. |
