4

every time I try to open a python file I get the following message on the minibuffer:

File Mode Specification Error: (void-function nil)

I turned on the debug mode but I honestly don't understand what is going on or how to narrow down the error:

Debugger entered--Lisp error: (void-function nil)
nil()
run-hooks(change-major-mode-after-body-hook prog-mode-hook python-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook python-mode-hook))
run-mode-hooks(python-mode-hook)
python-mode()
set-auto-mode-0(python-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer flasktest.py> "~/tmp/flasktest.py" nil nil "~/data/tmp/flasktest.py" (8388619 2052))
find-file-noselect("/home/srp/tmp/flasktest.py" nil nil)
ido-file-internal(raise-frame)
ido-find-file()
call-interactively(ido-find-file nil nil)
command-execute(ido-find-file)

I went through my init.el but didn't find any suspicious with respect to python mode. Here are the relevant lines:

;; Package Management
(require 'package)
(add-to-list 'package-archives
         '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
...
...
;; PYTHON IDE
;; Install rope, flake8, importmagic, autopep8 via pip
(elpy-enable)
(require 'py-autopep8)
(add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
(autoload 'pylint "pylint")
(add-hook 'python-mode-hook 'pylint-add-menu-items)
(add-hook 'python-mode-hook 'pylint-add-key-bindings)
(add-hook 'python-mode-hook (highlight-indentation-mode 0))

Does anyone know how to fix that error?

6

This is your problem (at least one problem):

(add-hook 'python-mode-hook (highlight-indentation-mode 0))

What does (highlight-indentation-mode 0) return? (My guess is nil, not a function.)

What it returns is added as an element of python-mode-hook. Then that thing, whatever it is, is invoked as a function. In this case, Emacs tries to invoke nil as a function. No can do.

| improve this answer | |
  • Thanks for your reply. Indeed that was the problem, I think I'll have to go into elpy-modules in order to disable highlight-indentation. – Sergio Dec 3 '15 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.