GNU/Linux Desktop Survival Guide
by Graham Williams |
|||||
Emacs Using 100% CPU |
This seems to be a problem with emacs recently (late 2006 and into 2007). I eventually tracked down a solution that seems to fix emacs-snapshot on Debian, from http://forums.gentoo.org/viewtopic-t-501837-highlight-emacs+cpu.html. I followed the instructions but it started happening again, probably because the source code for the fix (as detailed below) is in a couple of places.
A quick fix is to set the Emacs variable semantic-idle-scheduler-idle-time to a large number (by default it is 2 seconds) so that the idle scheduler does not kick in (which is what is using all the CPU)!
The actual solution below edits the file semantic-idle.el and ensures all binary copies of it are replaced (including, for me, emacs-snapshot/site-lisp/semantic/semantic-idle.elc, which did not seem to have a source version).
So, first edit the file /usr/share/emacs/site-lisp/semantic/semantic-idle.el to comment out line 290:
;;GJW(semantic-idle-scheduler-kill-timer) |
;;GJW(semantic-idle-scheduler-setup-timer) ))) |
$ sudo emacs -nw -q M-x byte-compile-file <ret> /usr/share/emacs/site-lisp/semantic/semantic-idle.el C-x C-c |
Now start up Emacs and hopefully it won't consume all the CPU again!
Edward Garson reports (28 Apr 2007) that the same fix works for XP and Fedora 6.