I have emacs auto-save and backup to a single directory off in my home directory. For some reason, when I try to exit the variable name where I set the save directory is getting passed to ido-mode and it won't let me exit out of emacs. I have tried deleting old versions of my ido.last file (and the symbolic link .#ido.last), but this doesn't seem to consistently take care of the problem. I have full permissions and ownership of the directory the files are stored in and the files themselves. This happens on several systems that I work on covering emacs major versions 21, 22 and 24.
Here are the relevant parts of my emacs configuration:
(defvar home (concat (getenv "HOME") "/"))
(defvar emacs-dir (concat home ".emacs.d/"))
(defvar savedir (concat home ".saves/"))
(setq backup-directory-alist `((".*" . savedir)))
(setq auto-save-file-name-transforms `((".*" ,savedir t)))
(setq backup-by-copying t)
(setq delete-old-versions t
kept-new-versions 10
kept-old-versions 6
version-control t)
(setq ido-save-directory-list-file (concat emacs-dir "cache/ido.last"))
(ido-mode t)
(setq ido-enable-flex-matching t
ido-everywhere t)
This is what the debugger output looks like when the problem happens.
Debugger entered--Lisp error: (wrong-type-argument stringp savedir)
expand-file-name(savedir "/home/pinyaka/.emacs.d/cache/")
make-backup-file-name-1("/home/pinyaka/.emacs.d/cache/ido.last")
make-backup-file-name("/home/pinyaka/.emacs.d/cache/ido.last")
find-backup-file-name("/home/pinyaka/.emacs.d/cache/ido.last")
backup-buffer()
basic-save-buffer-2()
basic-save-buffer-1()
basic-save-buffer()
save-buffer()
write-file("/home/pinyaka/.emacs.d/cache/ido.last" nil)
ido-save-history()
ido-kill-emacs-hook()
run-hooks(kill-emacs-hook)
kill-emacs()
save-buffers-kill-emacs(nil)
call-interactively(save-buffers-kill-emacs)
You can see that for some reason ido has gotten a hold of savedir
even though I have never used that variable in connection with ido-mode (I have included everywhere that that variable is used as well as all the ido calls that I make). Why does ido do anything with savedir?
I think the problem is:
(setq backup-directory-alist `((".*" . savedir)))
Should be
(setq backup-directory-alist `((".*" . ,savedir)))
Explanation: When Emacs exits, Ido is trying ta save its history; the standard backup procedure of Emacs kicks in and try to backup that file. However you forget to unquote savedir
in the configuration for backup-directory-alist
, so the cons cell is a pair of string and symbol instead of a pair of strings as expected.