1

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.

WHAT IS GOING ON?!

EDIT:

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
      (server-start)
    (error
     (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)))
     (display-warning
      'server (format "Creating %S" server-dir) :warning)
     (make-directory server-dir t)
     (server-start))))
    )

;; ***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)
2
  • 1
    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, 2012 at 9:17
  • 1
    Run emacs with -q, so that your config file isn't read. Then see what happens
    – Squidly
    Sep 21, 2012 at 10:07

1 Answer 1

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .