Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just started using emacs in Windows 7, and it is very jumpy. It seems not to be able to immediately read or write files. When I try to do it either with C-x C-f and write a path seconds after start, the minibuffer gives me something like

wrong type argument: stringp, (\, temporary-file-directory)

But if I wait for a couple of minutes or keep trying, eventually I get the file loaded.



This is my init.el file, emacs seems to run fine without it

;; ***My load path***
(cd "x:/PyStuff/")
(setenv "PYTHONPATH" "c:/Python27")
(add-to-list 'load-path "c:/Users/dmvianna/.emacs.d")

;; ***server stuff***
  (require 'server)
  (when (and (= emacs-major-version 23)
         (= emacs-minor-version 1)
         (equal window-system 'w32))
    ;; Suppress error "directory ~/.emacs.d/server is unsafe" on Windows.
    (defun server-ensure-safe-dir (dir) "Noop" t))
  (condition-case nil
     (let* ((server-dir (if server-use-tcp server-auth-dir server-socket-dir)))
       (when (and server-use-tcp
          (not (file-accessible-directory-p server-dir)))
      'server (format "Creating %S" server-dir) :warning)
     (make-directory server-dir t)

;; ***Miscellaneous inits***
(setq backup-directory-alist
'((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
'((".*" ,temporary-file-directory t)))
(setq delete-by-moving-to-trash t)
(setq inhibit-startup-screen t)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)

;;****Python stuff****
(require 'python-mode)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
;; *Python mode fixes*
(defun python-reinstate-current-directory ()
  "When running Python, add the current directory ('') to the head of sys.path.
For reasons unexplained, run-python passes arguments to the
interpreter that explicitly remove '' from sys.path. This means
that, for example, using 'python-send-buffer' in a buffer
visiting a module's code will fail to find other modules in the
same directory.

Adding this function to 'inferior-python-mode-hook' reinstates
the current directory in Python's search path."
  (python-send-string "sys.path[0:0] = ['']"))

(add-hook 'inferior-python-mode-hook 'python-reinstate-current-directory)
;;*End Python mode fixes*

(require 'lambda-mode)
(add-hook 'python-mode-hook #'lambda-mode 1)
(require 'ipython)
(require 'anything) (require 'anything-ipython)
  (when (require 'anything-show-completion nil t)
     (use-anything-show-completion 'anything-ipython-complete
                                   '(length initial-pattern)))
 (add-hook 'python-mode-hook #'(lambda ()
                                 (define-key py-mode-map (kbd "M-<tab>") 'anything-ipython-complete)))
 (add-hook 'ipython-shell-hook #'(lambda ()
                                 (define-key py-mode-map (kbd "M-<tab>") 'anything-ipython-complete)))

(require 'comint)
  (define-key comint-mode-map (kbd "M-") 'comint-next-input)
  (define-key comint-mode-map (kbd "M-") 'comint-previous-input)
  (define-key comint-mode-map [down] 'comint-next-matching-input-from-input)
  (define-key comint-mode-map [up] 'comint-previous-matching-input-from-input)

(require 'python-pep8)
(require 'python-pylint)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(provide 'emacs-init)
share|improve this question

migrated from Sep 23 '12 at 12:35

This question came from our site for professional and enthusiast programmers.

Try M-x toggle-debug-on-error (or checking "Enter Debugger on Error" in the Options menu) first. Also, what does C-h v temporary-file-directory report? – cjm Sep 21 '12 at 9:17
Run emacs with -q, so that your config file isn't read. Then see what happens – Squidly Sep 21 '12 at 10:07
up vote 1 down vote accepted

In this piece of code:

(setq backup-directory-alist
'((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
'((".*" ,temporary-file-directory t)))

You need to replace the 's with backticks, like so:

(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))

'x means (quote x) - return x without evaluating it. Using a backtick allows selective evaluation of list elements. In this case, that essentially means not treating temporary-file-directory as a literal.

"But if I wait for a couple of minutes or keep trying, eventually I get the file loaded."

Most likely what happens is you eventually manage to load a file without triggering an auto-save (and thus avoiding the error by not operating on the broken backup-directory-alist and auto-save-file-name-transforms). I'm not totally sure what situations cause auto-saves to trigger.

share|improve this answer

Your Answer


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.