Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I run Emacs on Windows 7 and whenever I close it, it usually takes at least 5 seconds for the window to actually close. It doesn't seem to matter what sort of buffers I have open or what modes I am in. Meanwhile the status bar at the bottom normally says:

(No files need saving)

Is there any way I can get an idea of what it taking so long, like a log file or debug message?

Here are the custom variables from my init file in case anyone can recognize something that would cause such a delay.

(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.
 '(TeX-PDF-mode t)
 '(TeX-engine (quote xetex))
 '(ac-ignores (quote ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")))
 '(ac-modes (quote (emacs-lisp-mode lisp-interaction-mode c-mode cc-mode c++-mode java-mode clojure-mode scala-mode scheme-mode ocaml-mode tuareg-mode perl-mode cperl-mode python-mode ruby-mode ecmascript-mode javascript-mode js-mode js2-mode php-mode css-mode makefile-mode sh-mode fortran-mode f90-mode ada-mode xml-mode sgml-mode org-mode)))
 '(ac-user-dictionary (quote ("")))
 '(ansi-color-names-vector ["#3f3f3f" "#cc9393" "#7f9f7f" "#f0dfaf" "#8cd0d3" "#dc8cc3" "#93e0e3" "#dcdccc"])
 '(custom-enabled-themes (quote (deeper-blue)))
 '(custom-safe-themes (quote ("bf7ed640479049f1d74319ed004a9821072c1d9331bc1147e01d22748c18ebdf" default)))
 '(default-major-mode (quote text-mode) t)
 '(fci-rule-color "#383838")
 '(fill-column 70)
 '(global-auto-complete-mode t)
 '(global-visual-line-mode t)
 '(inhibit-startup-screen t)
 '(make-backup-files nil)
 '(org-agenda-files (quote ("e:/org-mode/diary.org" "e:/org-mode/gtd.org")))
 '(org-agenda-show-inherited-tags t)
 '(org-agenda-sorting-strategy (quote ((agenda habit-down time-up priority-down category-keep) (todo todo-state-up priority-down category-keep) (tags priority-down category-keep) (search category-keep))))
 '(org-capture-templates (quote (("d" "Diary" entry (file+datetree "E:\\org-mode\\diary.org") "* %? %i %a %^g %U") ("t" "Task" entry (file+headline "E:\\org-mode\\gtd.org" "Tasks") "* TODO %? %i %a %^g %U") ("r" "Reference to find" entry (file+headline "e:\\org-mode\\ToFind.org" "Incoming") ""))))
 '(org-mode-hook (quote (#[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-show-block-all append local] 5] #[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes org-mode-reftex-setup)) t)
 '(org-modules (quote (org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-habit org-mew org-mhe org-rmail org-vm org-wl org-w3m)))
 '(org-refile-targets (quote ((org-agenda-files :tag . "") (nil :maxlevel . 3))))
 '(org-startup-indented t)
 '(org-support-shift-select t)
 '(org-todo-keywords (quote ((sequence "NEXT(n)" "TODO(t)" "WAITING(w)" "|" "SOMEDAY(s)" "MAYBE(m)" "CANCELLED(c)" "DONE(d)"))))
 '(package-archives (quote (("MELPA" . "http://melpa.milkbox.net/packages/") ("gnu" . "http://elpa.gnu.org/packages/"))))
 '(save-place t nil (saveplace))
 '(text-mode-hook (quote (text-mode-hook-identify))))
share|improve this question
1  
I assume the same way you'd diagnose a slow shutdown for any operating system. –  ta.speot.is May 26 '13 at 3:41
    
It's not my OS that is the problem, just closing this particular program. I changed the title and some of the content to clarify. –  Brian Z May 26 '13 at 6:09
    
Whoosh. –  ta.speot.is May 26 '13 at 6:15
1  
Gotcha. That's not much help though! –  Brian Z May 26 '13 at 6:47
1  
Don't think so. But I have a lot of customized options in my init.el, many of which I don't actually understand. I hope I don't have to test them all out one by one. Are there certain kinds of custom variables or commands to look for? –  Brian Z May 28 '13 at 1:17

1 Answer 1

up vote 1 down vote accepted

Unfortunately, there doesn't seem to be an easy way to get a useful log of what is happening as Emacs shuts down.

In the end, I resolved this problem by building a new .emacs file from scratch. I am re-adding things as I need them, and so far have had no problems.

share|improve this answer
1  
Instead of re-adding things one by one, you can try recursively bisecting the contents of your original .emacs, to locate any problematic code. That's a binary search, which is very quick. Of course if your original .emacs is very small then there is no need (and you have probably already finished by now ;-)). –  Drew Sep 1 '13 at 20:48
    
Can you explain this a little more? I'm not sure what "recursively bisecting" means or how I would try it? –  Brian Z Sep 2 '13 at 21:49
1  
Bisect your init file, e.g., by commenting out half of it. You can use command comment-region to do that (I bind it to C-x ;.) That will tell you which half of the file is problematic. Then uncomment (C-u with comment-region uncomments the region), and instead comment only one quarter of the file (half of the half that you found to be problematic). And so on: 1/2, 1/4, 1/8, 1/16,... This very quickly will tell you exactly where the problem is. If the problem is in a file that you load, then do the same thing for that file: bisect it to find out where the problem is... –  Drew Sep 2 '13 at 23:43
    
Got it... That's a very helpful tip, thanks! –  Brian Z Sep 4 '13 at 23:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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