I often use subordinate shells within Emacs. (I instantiate these shells with
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
For what it’s worth, below is the hook code I use to put my subordinate shells under
;; 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)) ) )