In the spacemace python layer, the following function overrides my customizations for the variable company-minimum-prefix-length
python layer
(defun python/post-init-company ()
;; backend specific
(add-hook 'python-mode-local-vars-hook #'spacemacs//python-setup-company)
(spacemacs|add-company-backends
:backends (company-files company-capf)
:modes inferior-python-mode
:variables
company-minimum-prefix-length 0
company-idle-delay 0.5)
(when (configuration-layer/package-used-p 'pip-requirements)
(spacemacs|add-company-backends
:backends company-capf
:modes pip-requirements-mode)))
I've tried setting this variable to 2 with a mode hook as well as by using M-x customize
This hook in my init file has zero effect (maybe I'm doing something wrong):
(add-hook 'inferior-python-mode-hook
(lambda ()
(setq-local company-minimum-prefix-length 2)))
M-x customize-variable
also has zero effect in the python buffer although it works in other buffers. After save and apply in the customize-variable buffer M-x describe-variable
yields this:
Its value is 0
Original value was 3
Local in buffer *Python*; global value is 2
The minimum prefix length for idle completion.
Automatically becomes buffer-local when set.
You can customize this variable.
[back]
The only way I can change the variable is by using M-x set-variable
after the buffer loads. This change is overridden if I restart the buffer with M-x python-shell-restart
. Is there any way I can write a hook that will set the variable after all other mode hooks?
M-x set-variable
every time I open an inferior-python buffer.