3

There is a directory created (I am assuming) by Eshell in the Emacs folder by the name of, "eshell" containing files "history, lastdir." Is there a way to specify a different path for these files? Say the ".cache" within the Emacs configs folder. I can't seem to find a variable.

1 Answer 1

3

Begin by setting eshell-directory-name, and then the following variables will use that same directory:

eshell-last-dir-ring-file-name

eshell-history-file-name

eshell-aliases-file

eshell-login-script

eshell-rc-script

The above-mentioned file-name variables, use the following code-snippet to determine their values: (expand-file-name "INSERT_FILE_NAME_HERE" eshell-directory-name)

4
  • So (setq eshell-directory-name ".cache") takes care of them all?
    – scribe
    Commented Mar 13, 2022 at 6:31
  • In the library esh-mode.el, there is a definition for eshell-directory-name. The code-snippet is (locate-user-emacs-file "eshell/" ".eshell/"). So by using only ".cache", how would Emacs know how to locate the directory ".cache" since it could be anywhere on the computer? I would suggest either an absolute path, or a similar approach to that contained within the aforementioned library.
    – lawlist
    Commented Mar 13, 2022 at 6:34
  • For most of my custom locations, I like to set the user-emacs-directory variable with a forward trailing slash at the end and then use a snippet like this: (concat user-emacs-directory ".0.eshell") In my setup, the user-emacs-directory is an absolute path with a forward trailing slash at the end. The value of user-emacs-directory is programmatically assigned when Emacs loads based upon the operating system.
    – lawlist
    Commented Mar 13, 2022 at 6:44
  • I went with (setq eshell-directory-name (concat user-emacs-directory ".cache/eshell/")), thanks stranger!
    – scribe
    Commented Mar 14, 2022 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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