Tom Kealy
Tom Kealy

Reputation: 2669

Emacs setting up a temporary file directory

I'm trying to set up Emacs on my computer and have all backups in a temporary folder, with the following in my .emacs file:

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

However, I keep on getting the error:

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

Which I think is an artefact of the \ / differences between Windows and Unix.

How do I go about stopping this?

Upvotes: 2

Views: 3277

Answers (2)

cefstat
cefstat

Reputation: 2406

Are you sure that you are using a backquote and not a quote? My guess would be that you have

(setq backup-directory-alist '((".*" . ,temporary-file-directory)))

instead of

(setq backup-directory-alist `((".*" . ,temporary-file-directory)))

Upvotes: 3

Drew
Drew

Reputation: 30718

I think you need to show more about the error context -- where it is raised etc. There is nothing wrong with the backquote sexp you show, AFAICT. And no relation, I expect, with differences between MS Windows and Unix. The question is how the resulting new values for those variables are used. IOW, check (a) whether the new values are what you intended, and if so (b) why they do not seem to be what the code that uses them expects.

Start by setting debug-on-error to t, to see where the error is raised and why. Load the *.el code for that file (defining the function where the error is raised) to improve the debugger backtrace.

But the complaint seems to come from the backquote-processing itself. What happens when you evaluate one of those setq sexps on its own, e.g. using M-: or buffer *scratch*? Do you get the error then? If not, what is the resulting new value of the variable?

Another thing to try, if you get the error even outside your .emacs, is to wrap your setq sexp in (macroexpand ...) and see what the result is.

Upvotes: 1

Related Questions