1

Opening a small python file, with <10 buffers open, takes a long time. Here's a gist of the profile of trying to open this file (giving up with C-g after 2 minutes).

Deactivating ido-mode tells more or less the same story. See this gist for details.

Messages during the opening of the file:

CPU profiler started
Mark saved where search started [3 times]
Making python-shell-interpreter local to  *Python Internal [792caf12c778150badeeede64c068cee]* while let-bound!
Making python-shell-interpreter-args local to  *Python Internal [792caf12c778150badeeede64c068cee]* while let-bound!
Waiting for process to die...done
Quit

What's amazing is that after I quit the find-file with C-g, and re-open the same file with C-x C-f again, it loads, instantly. If, after this, I try to newly open another small python files, I have the exact same behavior - first time, emacs hangs, second time, emacs opens the file instantaneously.

None of the minor modes that are active seem threatening (I've removed all the cumbersome ones). Here are the minor modes that are activated in python mode (at least as captured when the file successfully opens the second time).

Version

GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-04-17 on lgw01-04, modified by Debian

Modes for buffer that's open while opening the file (same as the ones for the file that will be opened, except instead of *scratch*'s lisp-mode it'll be python for the *.py):

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Blink-Cursor Column-Number Electric-Indent File-Name-Shadow Font-Lock
Global-Font-Lock Line-Number Menu-Bar Mouse-Wheel Shell-Dirtrack
Tool-Bar Tooltip Transient-Mark

(Information about these minor modes follows the major mode info.)

Lisp Interaction mode defined in `lisp-mode.el':
  • start turning minor modes off until you figure out what the culprit is. – Ista Dec 17 '16 at 19:49
  • @Ista do you mean start turning off minor modes that would be started upon opening a python file? Turning off minor modes in the current buffer (from which I open the files) does nothing. – VF1 Dec 17 '16 at 20:22
  • yes, minor modes you turn on in python-mode. – Ista Dec 17 '16 at 20:24
  • @Ista I've tried it with everything that I manually enabled in my init file disabled. The ones above are automatically-added minor modes (so I can't remove any particular init line to turn them off). The issue persists. (See the post again for an update). – VF1 Dec 17 '16 at 20:51
  • 1
    what happens when you start emacs with emacs -q? – Ista Dec 17 '16 at 21:13
3

I have the same issue and dug a little more into it. Launching emacs with:

emacs -nw -Q

lets me load any python file instantly without issues (whereas emacs -q -nw still takes forever to load even an empty python file). I thus tried:

emacs -nw --no-site-file

and again had no issues. I then looked for the site-start.el file and found in /etc/emacs/site-start.d the file:

/etc/emacs/site-start.d/50pylint.el

removing this solved the issue. I then removed pylint from my system and again emacs worked correctly. Re-installing pylint had the issue re-appear. There is a related bug here. For me the issue started out of nowhere, I didn't re-install pylint (or anything else for that matters) and I still don't have a solution besides removing 50pylint.el.

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.