spacemacs/layers/+lang/python/config.el
Miciah 6d8be7b381 python: Initialize inferior-python-mode variables
Fix SPC m c c (spacemacs/python-execute-file) and SPC m c C
(spacemacs/python-execute-file-focus), which were causing
the following errors:

    save-current-buffer: Symbol’s value as variable is void: python-shell--interpreter
    error in process filter: python-shell-comint-end-of-output-p: Wrong type argument: arrayp, nil
    error in process filter: Wrong type argument: arrayp, nil

This commit also fixes issue #9070: spacemacs/python-execute-file-focus
does not change focus.

The problem is that spacemacs/python-execute-file-focus invokes
spacemacs/python-execute-file, spacemacs/python-execute-file invokes
inferior-python-mode, and inferior-python-mode uses the variables
python-shell--interpreter and python-shell--interpreter-args, which
the python package declares but does not initialize.

To resolve this problem, this commit initializes both variables to nil.

* layers/+lang/python/config.el: Initialize python-shell--interpreter and
python-shell--interpreter-args to nil.
2018-08-03 06:53:02 +03:00

59 lines
1.8 KiB
EmacsLisp

;;; config.el --- Python Layer Configuration File for Spacemacs
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; variables
(spacemacs|define-jump-handlers python-mode)
(spacemacs|define-jump-handlers cython-mode anaconda-mode-goto)
(defvar python-backend 'anaconda
"The backend to use for IDE features. Possible values are `anaconda'
and `lsp'.")
(defvar python-enable-yapf-format-on-save nil
"If non-nil, automatically format code with YAPF on save.")
(defvar python-test-runner 'nose
"Test runner to use. Possible values are `nose' or `pytest'.")
(defvar python-save-before-test t
"If non nil, current buffer will be save before call a test function")
(defvar python-fill-column 79
"Fill column value for python buffers")
(defvar python-tab-width 4
"Tab width value for python buffers")
(defvar python-auto-set-local-pyenv-version 'on-visit
"Automatically set pyenv version from \".python-version\".
Possible values are `on-visit', `on-project-switch' or `nil'.")
(defvar python-auto-set-local-pyvenv-virtualenv 'on-visit
"Automatically set pyvenv virtualenv from \".venv\".
Possible values are `on-visit', `on-project-switch' or `nil'.")
(defvar python-sort-imports-on-save nil
"If non-nil, automatically sort imports on save.")
(defvar spacemacs--python-pyenv-modes nil
"List of major modes where to add pyenv support.")
(defvar spacemacs--python-pyvenv-modes nil
"List of major modes where to add pyvenv support.")
;; inferior-python-mode needs these variables to be defined. The python
;; package declares them but does not initialize them.
(defvar python-shell--interpreter nil)
(defvar python-shell--interpreter-args nil)