Skip to content

Commit 1d9dcbe

Browse files
committed
prevent cross project inferior shell when 1 process exists
1 parent 3c8b648 commit 1d9dcbe

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

lisp/ess-inf.el

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,11 @@ to `ess-completing-read'."
858858
(if (or auto-started?
859859
(and (not ask-if-1)
860860
(= 1 num-processes)
861+
(equal (plist-get (ess-r-project-info) :name)
862+
(plist-get (with-current-buffer
863+
(get-buffer (car proc-buffers))
864+
ess-r-project--info-cache)
865+
:name))
861866
(message "Using process `%s'" (car proc-buffers))))
862867
(car pname-list)
863868
(unless (and ess-current-process-name

lisp/ess-r-mode.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,6 +2457,8 @@ state.")
24572457
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
24582458
(add-hook 'xref-backend-functions #'ess-r-xref-backend nil 'local)
24592459
(add-hook 'project-find-functions #'ess-r-project -90 'local)
2460+
;; project
2461+
(ess-r-project-info)
24602462
;; eldoc
24612463
(ess--setup-eldoc #'ess-r-eldoc-function)
24622464
;; auto-complete

lisp/ess-sesman.el

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,14 @@ Session will be named after the LANG inferior repl."
7474
"With ARG, do not offer to save the workspace.
7575
Additionally, remove sesman object."
7676
(let ((cmd (format "base::q('%s')\n" (if arg "no" "default")))
77-
(sprocess (ess-get-process ess-current-process-name)))
77+
(sprocess (ess-get-process ess-current-process-name))
78+
(buf (process-buffer sprocess)))
7879
(when (not sprocess) (error "No ESS process running"))
79-
(sesman-remove-object 'ESS nil (current-buffer) arg t)
80+
(sesman-remove-object 'ESS nil buf arg t)
8081
(ess-cleanup)
81-
(ess-send-string sprocess cmd)))
82+
(with-current-buffer buf
83+
(setq-local ess-r-project--info-cache nil))
84+
(ess-send-string sprocess cmd t)))
8285

8386
(cl-defgeneric ess-quit--override (arg &context (ess-dialect "julia"))
8487
"Stop the inferior process.
@@ -122,8 +125,8 @@ Additionally, remove sesman object."
122125

123126

124127
;; ensure sesman set for script buffers
125-
(add-hook 'ess-r-mode-hook #'ess--sesman-ensure-process-name)
126-
(add-hook 'ess-julia-mode-hook #'ess--sesman-ensure-process-name)
128+
(add-hook 'ess-r-mode-hook #'ess--sesman-ensure-process-name 95)
129+
(add-hook 'ess-julia-mode-hook #'ess--sesman-ensure-process-name 95)
127130

128131
;; ensure sesman set for repl buffers
129132
(advice-add #'inferior-ess--set-major-mode :after #'ess--sesman-init-repl)

0 commit comments

Comments
 (0)