@@ -169,17 +169,16 @@ This may be useful for debugging."
169169 dialect)
170170 dialect))
171171 (inf-buf (inferior-ess--get-proc-buffer-create temp-dialect))
172- (proc-name (buffer-local-value 'ess-local-process-name inf-buf))
173- (cur-dir (inferior-ess--maybe-prompt-startup-directory proc-name temp-dialect))
174- (default-directory cur-dir))
172+ (proc-name (buffer-local-value 'ess-local-process-name inf-buf)))
175173 (with-current-buffer inf-buf
176174 ; ; TODO: Get rid of this, we should rely on modes to set the
177175 ; ; variables they need.
178176 (ess-setq-vars-local customize-alist)
179177 (inferior-ess--set-major-mode ess-dialect)
180178 ; ; Set local variables after changing mode because they might
181179 ; ; not be permanent
182- (setq default-directory cur-dir)
180+ (setq default-directory
181+ (inferior-ess--maybe-prompt-startup-directory proc-name temp-dialect))
183182 (setq inferior-ess--local-data (cons inferior-ess-program start-args))
184183 ; ; Read the history file
185184 (when ess-history-file
@@ -204,7 +203,7 @@ This may be useful for debugging."
204203 (unless (and proc (eq (process-status proc) 'run ))
205204 (error " Process %s failed to start " proc-name))
206205 (when ess-setwd-command
207- (ess-set-working-directory cur-dir ))
206+ (ess-set-working-directory default-directory ))
208207 (setq-local font-lock-fontify-region-function #'inferior-ess-fontify-region )
209208 (setq-local ess-sl-modtime-alist nil )
210209 (run-hooks 'ess-post-run-hook )
@@ -623,11 +622,14 @@ process-less buffer because it was created with
623622; ;*;; Requester functions called at startup
624623(defun inferior-ess--get-startup-directory ()
625624 " Return a startup directory."
626- (let ((dir (or (and ess-directory-function
627- (funcall ess-directory-function))
625+ (let ((dir (or (when (boundp 'ess-startup-directory )
626+ (if (symbolp ess-startup-directory)
627+ (symbol-value ess-startup-directory)
628+ ess-startup-directory))
629+ (and ess-startup-directory-function
630+ (funcall ess-startup-directory-function))
628631 (when-let ((proj (project-current )))
629632 (ess--project-root proj))
630- ess-startup-directory
631633 default-directory)))
632634 (directory-file-name dir)))
633635
@@ -2430,7 +2432,7 @@ START-ARGS gets passed to the dialect-specific
24302432 ; ; Make sure we don't ask for directory again
24312433 ; ; Use current working directory as default
24322434 (let ((project-find-functions nil )
2433- (ess-directory-function nil )
2435+ (ess-startup- directory-function nil )
24342436 (ess-startup-directory (ess-get-process-variable 'default-directory ))
24352437 (ess-ask-for-ess-directory nil ))
24362438 (ess-quit 'no-save )
0 commit comments