Skip to content

Commit

Permalink
fixup! Validate .spacemacs variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
lebensterben authored and JAremko committed Mar 20, 2021
1 parent 3e156ec commit 5830e72
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/core-dotspacemacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ in `dotspacemacs-themes'.")
`hybrid state' with `emacs' key bindings. The value can also be a list
with `:variables' keyword (similar to layers). Check the editing styles
section of the documentation for details on available variables."
'(choice (const vim) (const emacs) (const hybrid))
'(choice (const vim (cons symbol sexp))
(const emacs (cons symbol sexp))
(const hybrid (cons symbol sexp)))
'spacemacs-dotspacemacs-init)

(spacemacs|defc dotspacemacs-startup-banner 'official
Expand Down Expand Up @@ -233,7 +235,7 @@ whenever you start Emacs."
"List of themes, the first of the list is loaded when spacemacs starts.
Press `SPC T n' to cycle to the next theme in the list (works great
with 2 themes variants, one dark and one light"
'(repeat symbol)
'(repeat (choice symbol (cons symbol sexp)))
'spacemacs-dotspacemacs-init)

(spacemacs|defc dotspacemacs-mode-line-theme '(spacemacs
Expand Down

3 comments on commit 5830e72

@syl20bnr
Copy link
Owner

@syl20bnr syl20bnr commented on 5830e72 Mar 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JAremko I added a fix with: 3d1b8865d

Do you know if it is possible to validate that the only valid sexps are of the form (vim :variables (cons symbol sexp) ?

@JAremko
Copy link
Collaborator

@JAremko JAremko commented on 5830e72 Mar 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JAremko I added a fix with: 3d1b886

Woops. Braces and sleep deprivation finally got me.

Do you know if it is possible to validate that the only valid sexps are of the form (vim :variables (cons symbol sexp) ?

@syl20bnr Yeah. I want to fork validate.el add a couple of new "ephemeral types" such as range (for percentage) and (plist with a head) not sure how to name it.. Headed plsit ?
My best name so far is (plist-for <head-type> <key> <value-type> ... <key> <value-type>) where validator will check type of value associated with every specified key. Another new type is a predicate - for the case if we can't figure out what to do, just run a function on a value and if it returns true - it's valid. Those types will be "ephemeral" in the sense that for emacs customization system they will look like more general ones. For example. plist-for will look like (cons <head-type> sexp))). This is needed for layer configs since they are available via customization menu.

@syl20bnr
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great ideas. The more accurate the schema, the better. In your example should it be (plist-for (cons <head-type> sexp)) instead ?

Please sign in to comment.