core: add support for interpreter-mode-alist to layer lazy installation
Update python lazy declaration as an example. Still need to update the auto-layer.el file for other modes.
This commit is contained in:
parent
220bbabd36
commit
1846984bd0
|
@ -949,7 +949,8 @@ USEDP if non-nil indicates that made packages are used packages."
|
||||||
"Configure auto-installation of layer with name LAYER-NAME."
|
"Configure auto-installation of layer with name LAYER-NAME."
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
(when (configuration-layer//lazy-install-p layer-name)
|
(when (configuration-layer//lazy-install-p layer-name)
|
||||||
(let ((extensions (spacemacs/mplist-get props :extensions)))
|
(let ((extensions (spacemacs/mplist-get props :extensions))
|
||||||
|
(interpreter (plist-get props :interpreter)))
|
||||||
(when (configuration-layer/layer-usedp layer-name)
|
(when (configuration-layer/layer-usedp layer-name)
|
||||||
(let* ((layer (configuration-layer/get-layer layer-name))
|
(let* ((layer (configuration-layer/get-layer layer-name))
|
||||||
(package-names (when layer (cfgl-layer-owned-packages layer))))
|
(package-names (when layer (cfgl-layer-owned-packages layer))))
|
||||||
|
@ -980,6 +981,15 @@ USEDP if non-nil indicates that made packages are used packages."
|
||||||
'auto-mode-alist
|
'auto-mode-alist
|
||||||
`(,ext . (lambda ()
|
`(,ext . (lambda ()
|
||||||
(configuration-layer//auto-mode
|
(configuration-layer//auto-mode
|
||||||
|
',layer-name ',mode))))
|
||||||
|
))
|
||||||
|
;; configure `interpreter-mode-alist'
|
||||||
|
(when interpreter
|
||||||
|
(let ((regex (car interpreter))
|
||||||
|
(mode (cadr interpreter)))
|
||||||
|
(add-to-list
|
||||||
|
'interpreter-mode-alist
|
||||||
|
`(,regex . (lambda () (configuration-layer//auto-mode
|
||||||
',layer-name ',mode)))))))))
|
',layer-name ',mode)))))))))
|
||||||
|
|
||||||
(defun configuration-layer//auto-mode (layer-name mode)
|
(defun configuration-layer//auto-mode (layer-name mode)
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
(configuration-layer/lazy-install 'python :extensions '("\\(\\.pyx\\'\\|\\.pxd\\'\\|\\.pxi\\'\\)" cython-mode))
|
(configuration-layer/lazy-install 'python :extensions '("\\(\\.pyx\\'\\|\\.pxd\\'\\|\\.pxi\\'\\)" cython-mode))
|
||||||
(configuration-layer/lazy-install 'python :extensions '("\\(\\.hy\\'\\)" hy-mode))
|
(configuration-layer/lazy-install 'python :extensions '("\\(\\.hy\\'\\)" hy-mode))
|
||||||
(configuration-layer/lazy-install 'python :extensions '("\\(\\.pip\\'\\|requirements\\(?:.\\|\n\\)*\\.txt\\'\\)" pip-requirements-mode))
|
(configuration-layer/lazy-install 'python :extensions '("\\(\\.pip\\'\\|requirements\\(?:.\\|\n\\)*\\.txt\\'\\)" pip-requirements-mode))
|
||||||
(configuration-layer/lazy-install 'python :extensions '("\\(\\.py\\'\\)" python-mode))
|
(configuration-layer/lazy-install 'python :extensions '("\\(\\.py\\'\\)" python-mode) :interpreter '("python[0-9.]*" python-mode))
|
||||||
|
|
||||||
(configuration-layer/lazy-install 'racket :extensions '("\\(\\.rkt[dl]?\\'\\)" racket-mode))
|
(configuration-layer/lazy-install 'racket :extensions '("\\(\\.rkt[dl]?\\'\\)" racket-mode))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue