sinewalker / dotspacemacs

Personal Spacemacs configuration
MIT License
13 stars 0 forks source link

elisp meta-program the mjl--layers list #4

Open sinewalker opened 7 years ago

sinewalker commented 7 years ago

It should be possible to replace this block in init.el with something more general:

(cond ((eq system-type 'windows-nt)
         (setq mjl--layers (append mjl--layers mjl--windows-layers)))
        ((eq system-type 'darwin)
         (setq mjl--layers (append mjl--layers mjl--darwin-layers)))
        ((eq system-type 'gnu/linux)
         (setq mjl--layers (append mjl--layers mjl--gnu/linux-layers))))

(first I'll have to rename mjl--windows-layers to mjl--windows-nt-layers)

So that the system-type symbol is incorporated into the name of the list to be appended to mjl--layers. Something like (this is not quite right: it cons's `mjl--darwin-layers as a symbol):

 (setq mjl--layers (append mjl--layers
                                 (make-symbol
                                  (concat "mjl--" (symbol-name system-type) "--layers"))))

Maybe I'll need to use an Elisp Macro? That's why I've titled this Issue "meta-program"...

sinewalker commented 4 years ago

This tweet shows one way this might better be programmed:

dotspacemacs-configuration-layers
`(,(when (eq system-type 'darwin) 'osx)
 (,(when (eq system-type 'gnu/linux) 'exwm))