3bbc7a7d40
* core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com> |
||
---|---|---|
.. | ||
aprilfool | ||
banners | ||
gnupg | ||
info | ||
libs | ||
templates | ||
core-command-line.el | ||
core-compilation.el | ||
core-configuration-layer.el | ||
core-custom-settings.el | ||
core-customization.el | ||
core-debug.el | ||
core-display-init.el | ||
core-documentation.el | ||
core-dotspacemacs.el | ||
core-dumper.el | ||
core-early-funcs.el | ||
core-emacs-backports.el | ||
core-env.el | ||
core-fonts-support.el | ||
core-funcs.el | ||
core-hooks.el | ||
core-jump.el | ||
core-keybindings.el | ||
core-load-paths.el | ||
core-micro-state.el | ||
core-progress-bar.el | ||
core-release-management.el | ||
core-spacebind.el | ||
core-spacemacs-buffer.el | ||
core-spacemacs.el | ||
core-themes-support.el | ||
core-toggle.el | ||
core-transient-state.el | ||
core-use-package-ext.el | ||
core-versions.el |