[ESS] Emacs taking over CPU

Frank Harrell f.harrell at Vanderbilt.Edu
Sat Sep 7 14:37:59 CEST 2013


After a long interactive R session using the latest ESS on Ubuntu, Emacs 
gets extremely sluggish and starts to take more of 98% of the CPU. 
Below is my .emacs file if relevant.  Thanks for any pointers - Frank

(defun make-backup-file-name (file)
(concat "~/tmp/" (file-name-nondirectory file) "~"))
(defun backup-file-name-p (file)
(string-match "\\~$" file))
(defun goto-matching-paren ()
     "Goto the matching parentesis of sexp after point (visually at point)."
     (interactive)
     (if (= (char-syntax (char-after (point))) ?\()
	(goto-char (1- (scan-sexps (point) 1)))
       (if (= (char-syntax (char-after (point))) ?\))
	  (goto-char (scan-sexps (1+ (point)) -1)))))
   (global-set-key "\M-p" 'goto-matching-paren)
(setq-default tab-width 4)

(require 'recentf)
(recentf-mode 1)
(setq comint-scroll-to-bottom-on-output 'others)
  (setq comint-scroll-show-maximum-output t)



(require 'tree-mode)
(autoload 'dirtree "dirtree" "Add directory to tree view" t)

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
  '(case-fold-search t)
  '(current-language-environment "UTF-8")
  '(default-input-method "rfc1345")
  '(dired-listing-switches "-loh")
  '(ess-R-font-lock-keywords (quote ((ess-R-fl-keyword:modifiers . t) 
(ess-R-fl-keyword:fun-defs . t) (ess-R-fl-keyword:keywords . t) 
(ess-R-fl-keyword:assign-ops . t) (ess-R-fl-keyword:constants . t) 
(ess-fl-keyword:fun-calls . t) (ess-fl-keyword:numbers . t) 
(ess-fl-keyword:operators . t) (ess-fl-keyword:delimiters . t) 
(ess-fl-keyword:= . t) (ess-R-fl-keyword:F&T . t))))
  '(inhibit-startup-screen t)
  '(org-agenda-files (quote ("/tmp/test.org")))
  '(tab-width 2)
  '(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
  '(transient-mark-mode t))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
  )
(setq lpr-command "gtklp")
(setq gnuserv-frame (selected-frame))
(server-start)

(put 'downcase-region 'disabled nil)

(require 'org-install)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(global-font-lock-mode 1) ; for all buffers
(add-hook 'org-mode-hook 'turn-on-font-lock) ; org-mode buffers only

(require 'ess-site)
(setq ess-ask-for-ess-directory nil)
(setq inferior-ess-same-window nil)
(setq ess-help-own-frame 'one)
(setq inferior-R-args "--no-restore --no-save")


(setq tabbar-buffer-groups-function (lambda () (list "All buffers")))
(setq tabbar-cycling-scope nil)
(setq tabbar-home-button (quote (("[Home]") "[x]")))
(setq tabbar-separator (quote (" ")))
(require 'tabbar)
(tabbar-mode)

; Make buffer names unique by prepending directory name
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)


; Make pdf window for viewing LaTeX auto update
;(require 'doc-view)    # CAN'T FIND UBUNTU PACKAGE THIS IS IN
;(add-hook 'doc-view-mode-hook 'auto-revert-mode)
; Do cntl x 3 to put pdf in right part of Emacs window, cntl c cntl c to 
compile
; Simply view the pdf file; in LaTeX panel typing cntl-c cntl-c will
;  open the pdf document if compiling unneeded.

(setq ess-default-style 'DEFAULT) ; site-start uses C++ which indents 4
(add-to-list 'auto-mode-alist '("\\.s\\'" . R-mode))

(require 'edit-server)
(edit-server-start)

(load "auctex.el" nil t t)
(require 'tex-site)

; Make default LaTeX output pdf; see 
http://blogisticreflections.wordpress.com
(setq TeX-PDF-mode t)

(add-hook 'TeX-mode-hook
           (lambda () (TeX-fold-mode 1))); Automatically activate 
TeX-fold-mode.


; Turn on RefTeX for AUCTeX, 
http://www.gnu.org/s/auctex/manual/reftex/reftex_5.html
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
; Make RefTeX interact with AUCTeX, 
http://www.gnu.org/s/auctex/manual/reftex/AUCTeX_002dRefTeX-Interface.html
(setq reftex-plug-into-AUCTeX t)

;(setq reftex-file-extensions
;      '(("tex" ".Rnw" ".nw" ".tex")
;        ("bib" ".bib")))
(setq reftex-file-extensions
       '(("tex" ".tex")
         ("bib" ".bib")))



More information about the ESS-help mailing list