Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Emacs Using 100% CPU

Historic 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)
Similarly, comment out line 294, but be sure to retain the final three closing braces:
      ;;GJW(semantic-idle-scheduler-setup-timer)
)))
Next, start up, as root, a new emacs and byte compile the package:
$ sudo emacs -nw -q
  M-x byte-compile-file <ret> 
  /usr/share/emacs/site-lisp/semantic/semantic-idle.el
  C-x C-c
As mentioned above, copy the byte copmiled version across to emacs-snapshot/site-lisp/semantic/semantic-idle.elc.

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.


Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.