I often use subordinate shells within Emacs. (I instantiate these shells with M-x shell.)
I put all these shells under auto-save-mode (through my shell-mode-hook; see below).
Is there some way that I can have Emacs set an environment variable in a subordinate shell equal to the value of buffer-auto-save-file-name?
For what it's worth, below is the hook code I use to put my subordinate shells under auto-save-mode:
;; NB: I define the global variable auto-saves-dir elsewhere in my init file. (defun cd-to-auto-saves-dir () (unless (file-directory-p auto-saves-dir) (make-directory auto-saves-dir t)) (cd auto-saves-dir)) (add-hook 'shell-mode-hook (lambda () ;; the silliness with cd-ing to/fro auto-saves-dir is the ;; only way I've found to trick Emacs into putting the ;; auto-save'd file in auto-saves-dir (let ((orig-dir default-directory)) (cd-to-auto-saves-dir) (auto-save-mode) (cd orig-dir)) ) )
comint-exec-1to create a custom buffer-localprocess-environmentcontaining the environmental variables that I like. You might want to consider doing something similar.(let ((default-directory auto-saves-dir)) (auto-save-mode))should work fine, assumingauto-saves-direxists.