diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index ce24421ce..719232618 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -949,7 +949,8 @@ USEDP if non-nil indicates that made packages are used packages." "Configure auto-installation of layer with name LAYER-NAME." (declare (indent 1)) (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) (let* ((layer (configuration-layer/get-layer layer-name)) (package-names (when layer (cfgl-layer-owned-packages layer)))) @@ -980,7 +981,16 @@ USEDP if non-nil indicates that made packages are used packages." 'auto-mode-alist `(,ext . (lambda () (configuration-layer//auto-mode - ',layer-name ',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))))))))) (defun configuration-layer//auto-mode (layer-name mode) "Auto mode support of lazily installed layers." diff --git a/layers/auto-layer.el b/layers/auto-layer.el index 23f692d48..078dab72f 100644 --- a/layers/auto-layer.el +++ b/layers/auto-layer.el @@ -87,7 +87,7 @@ (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 '("\\(\\.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))