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) ess-inf.el: add prefix to initial setcwd() ess-r-mode.el: add prefix to path sent to R for initialization (I know my change to ess-r--load-ESSR-local is right, I'm not sure about ess-r--fetch-ESSR-remote) --- diff --git a/lisp/ess-custom.el b/lisp/ess-custom.el index f631e04d..e4db36c0 100644 --- a/lisp/ess-custom.el +++ b/lisp/ess-custom.el @@ -2489,6 +2489,11 @@ 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 + (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..7c093763 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))) @@ -1614,7 +1614,7 @@ environment from GitHub and attaches it to the search path. If the file already exists on disk from a previous download then the download step is omitted. This function returns t if the ESSR load is successful, and nil otherwise." - (let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory))) + (let ((loader (ess-file-content (concat ess-cygwin-prefix (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory)))) (essr (or essr-version ;; FIXME: Hack: on MELPA essr-version is not set (lm-with-file (expand-file-name "ess.el" ess-lisp-directory) From: Sparapani, Rodney <rspar...@mcw.edu> Sent: Wednesday, January 3, 2024 11:45 AM To: Robert Lerche <rler...@pacificbiosciences.com>; Dirk Eddelbuettel <e...@debian.org>; Tomas Kalibera <tomas.kalib...@gmail.com> Cc: ess-help (ess-help@r-project.org) <ess-help@r-project.org> Subject: Re: Following up, success! [was RE: [ESS] [R-win] Difficulty installing R packages under Windows 11 / Cygwin] [EXTERNAL MESSAGE] Be mindful when clicking links or attachments Hi Robert: Looking this over. The issue appears to be that you need a prefix. It has been a long time since I used Cygwin. But I assume the prefix is something like "c:" or "/cygwin/c". In other words, the root is NOT "/"; rather something like $PREFIX/ Is that the issue? I'm trying to think of a way that we could easily adapt to this without hacking all over the places. Possibly, we could support PREFIX kind of like the way configure works. Thanks -- Rodney Sparapani, Associate Professor of Biostatistics, He/Him/His Vice President, Wisconsin Chapter of the American Statistical Association Institute for Health and Equity, Division of Biostatistics Medical College of Wisconsin, Milwaukee Campus From: Robert Lerche <mailto:rler...@pacificbiosciences.com> Date: Tuesday, January 2, 2024 at 7:00 PM To: Dirk Eddelbuettel <mailto:e...@debian.org>, Tomas Kalibera <mailto:tomas.kalib...@gmail.com> Cc: Sparapani, Rodney <mailto:rspar...@mcw.edu>, ess-help (mailto:ess-help@r-project.org) <mailto:ess-help@r-project.org> Subject: Following up, success! [was RE: [ESS] [R-win] Difficulty installing R packages under Windows 11 / Cygwin] ATTENTION: This email originated from a sender outside of MCW. Use caution when clicking on links or opening attachments. ________________________________ It turns out it was fairly easy to make ESS work in Cygwin Emacs with R built for Windows. The issue was of course path names. I attach a patch that works for me. Let me explain that I am using a company-provided and managed laptop and I have no choice but to run Windows. I am familiar with a number of Unix/Linux -like environments for Windows (Cygwin, MSYS, WSL). I have tried them all over a period of years. I use R primarily as a means for presenting data. It is not the main thrust of my work. Having spent considerable time making this laptop a comfortable working environment I am loathe to switch. ______________________________________________ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help