It looks like this can be achieved by modifying the variable undo-tree-history-directory-alist, but I can't figure out how. I tried a number of lines, the last of which is

(setq undo-tree-history-directory-alist ("." ! "~/.emacs.d/undo"))

But this returns errors.


You most certainly want:

(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))

The docstring of this variable speaks of an alist aka association list. These are a list of pairs, where a pair is a cons cell. The short-hand syntax for a cons cell is (foo . 1) whereas the short-hand syntax for returning a list as is would be '(...), both combined result in '((foo . 1) ...)).

  • This gets rid of the error messages, but I see no undo files in the directory.
    – Toothrot
    Sep 11 '16 at 11:23
  • 2
    Maybe you need to pass that path through expand-file-name () first.
    – VanLaser
    Sep 11 '16 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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