> Just to be sure: So all these changes in your patch are guaranteed to *not* > change the path / file-paths anywhere *unless* our emacs & ESS run on an > Windows Cygwin platform?
That is my intention. Here is a slight "belt and suspenders" update, adding a specific test for Cygwin Emacs. If not, force ess-cygwin-prefix to nil. I have tested this in my environment. --- >From 9f64f41c09fed6161de841297239ad74a1c1448d Mon Sep 17 00:00:00 2001 From: Robert Lerche <rler...@pacificbiosciences.com> Date: Sun, 7 Jan 2024 10:01:22 -0800 Subject: [PATCH] For compatibility between Cygwin Emacs and R built for Windows add prefix to R initialization --- lisp/ess-custom.el | 6 ++++++ lisp/ess-inf.el | 2 +- lisp/ess-r-mode.el | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/ess-custom.el b/lisp/ess-custom.el index f631e04d..91d47b0e 100644 --- a/lisp/ess-custom.el +++ b/lisp/ess-custom.el @@ -2489,6 +2489,12 @@ Used to store the values for passing on to newly created buffers.") (defvar ess-STERM nil "Placeholder for dialect-specific STERM.") +(defvar ess-cygwin-prefix + (if (not (eq system-type (quote cygwin))) nil + (condition-case nil (nth 0 (process-lines "cygpath" "-m" "/")) + (error nil))) + "For Windows compatibility, prefix paths passed to R with this") + (make-obsolete-variable 'ess-S-loop-timeout "It is ignored." "ESS 18.10") (make-obsolete-variable 'ess-mode-load-hook "It is ignored." "ESS 18.10") (make-obsolete-variable 'ess-speedbar-use-p "It is ignored." "ESS 18.10") diff --git a/lisp/ess-inf.el b/lisp/ess-inf.el index 9ca3f455..9b611934 100644 --- a/lisp/ess-inf.el +++ b/lisp/ess-inf.el @@ -3046,7 +3046,7 @@ NO-ERROR prevents errors when this has not been implemented for path)) (lpath (if remote (with-parsed-tramp-file-name path v v-localname) - path))) + (concat ess-cygwin-prefix path)))) (ess-eval-linewise (format ess-setwd-command lpath)) (ess-set-process-variable 'default-directory (file-name-as-directory path))) diff --git a/lisp/ess-r-mode.el b/lisp/ess-r-mode.el index bd902710..1517d705 100644 --- a/lisp/ess-r-mode.el +++ b/lisp/ess-r-mode.el @@ -1572,7 +1572,7 @@ Source the etc/ESSR/.load.R file into the R process. The .ess.ESSR.load function sources all of the contents of the etc/ESSR/R directory into the ESSR environment and attaches the environment to the search path." - (let* ((src-dir (expand-file-name "ESSR/R" ess-etc-directory)) + (let* ((src-dir (concat ess-cygwin-prefix (expand-file-name "ESSR/R" ess-etc-directory))) (buf (ess-command (ess-r--load-ESSR-command src-dir)))) (with-current-buffer buf (let ((msg (buffer-string))) -- 2.42.1 -----Original Message----- From: Martin Maechler <maech...@stat.math.ethz.ch> Sent: Friday, January 5, 2024 7:58 AM To: Robert Lerche <rler...@pacificbiosciences.com> Cc: Sparapani, Rodney <rspar...@mcw.edu>; Tomas Kalibera <tomas.kalib...@gmail.com>; ess-help (ess-help@r-project.org) <ess-help@r-project.org> Subject: Re: [ESS] Following up, success! [was RE: [R-win] Difficulty installing R packages under Windows 11 / Cygwin] [EXTERNAL MESSAGE] Be mindful when clicking links or attachments >>>>> Robert Lerche via ESS-help >>>>> on Wed, 3 Jan 2024 22:58:00 +0000 writes: > Yes and thanks for responding. That is I think exactly what's needed and I have taken a shot at implementing it. [I'm glad my previous attached patch got filtered, I was a bit careless.] Here's a summary of what I've done: > ess-custom.el: extract prefix using cygpath, set to nil if error (i.e., no cygpath command indicates not in Cygwin) Just to be sure: So all these changes in your patch are guaranteed to *not* change the path / file-paths anywhere *unless* our emacs & ESS run on an Windows Cygwin platform? Martin ______________________________________________ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help