[ESS-bugs] "//" on the Macintosh

Steven McKinney @mck|nney @end|ng |rom bccrc@c@
Fri Dec 13 02:56:41 CET 2019


The double forward slash presents no problem to OS X's unix flavour:

$ ls -alF /var/folders/0n/7kqmtc1x45jfj5m20lnsmrkm0000gn/T//Rtmp9pY90F/ABCD46c85fb1120f.pdf
-rw-r--r--  1 stevenmckinney  staff  4576 12 Dec 17:30 /var/folders/0n/7kqmtc1x45jfj5m20lnsmrkm0000gn/T//Rtmp9pY90F/ABCD46c85fb1120f.pdf

and I've seen the same behaviour on other *nix flavours.  So this is a Dired thing, not a unix/linux/mac thing.

I notice if I do  Ctrl-x d   then paste in the double forward slash filepath that everything up to the first of the doubled slashes is greyed out (Emacs 25).

Since *nix flavours can handle this, I'd think Dired should similarly handle it, by just interpreting two forward slashes as one.  I don't have Emacs 27 at this point to see if Dired has been updated.

So workarounds for Emacs 25 include:

> tmp <- gsub("//", "/", tempfile("ABCD", fileext=".pdf"))
> tmp
[1] "/var/folders/0n/7kqmtc1x45jfj5m20lnsmrkm0000gn/T/Rtmp9pY90F/ABCD46c84ca515d2.pdf"
> 

or writing your own tempfile function to call the base tempfile function and do the gsub before returning the filepath.

(Even R's file.path doesn't fix the double slash

> tmp <- file.path(tempfile("ABCD", fileext=".pdf"))
> tmp
[1] "/var/folders/0n/7kqmtc1x45jfj5m20lnsmrkm0000gn/T//Rtmp9pY90F/ABCD46c810a56438.pdf"
> 
)



Steven McKinney

Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre


________________________________________
From: ESS-bugs <ess-bugs-bounces using r-project.org> on behalf of Alex Branham <alex.branham using gmail.com>
Sent: Thursday, December 12, 2019 5:17 PM
To: Richard M. Heiberger
Cc: ess-bugs
Subject: Re: [ESS-bugs] "//" on the Macintosh

Looks like / isn't a valid in a filename on Linux or Mac, so I'd suggest
changing that name

On Tue, Dec 10, 2019, 5:16 PM Richard M. Heiberger <rmh using temple.edu> wrote:

> I would appreciate if you can check.  I am still on emacs 25.1.1 and
> not interested in building a newer version.
>
> Rich
>
> On Tue, Dec 10, 2019 at 5:08 PM Alex Branham <alex.branham using gmail.com>
> wrote:
> >
> > Emacs upstream did some work about this recentlyish I think. See if it's
> fixed in Emacs 27 (you'll have to build from the git repo since it's not
> released yet). If not, M-x report-emacs-bug.
> >
> > If you can't build from source, let me know and I can test for you.
> >
> > Alex
> >
> >
> >
> > On Tue, Dec 10, 2019, 4:48 PM Richard M. Heiberger <rmh using temple.edu>
> wrote:
> >>
> >> > tempdir()
> >> [1] "/var/folders/vq/xl0j17pn29g52mgx7lqxl8d80000gn/T//RtmpB9dpQB"
> >> > tmp <- tempfile("ABCD", fileext=".pdf")
> >> > tmp
> >> [1]
> "/var/folders/vq/xl0j17pn29g52mgx7lqxl8d80000gn/T//RtmpB9dpQB/ABCD79804f1ca596.pdf"
> >> > pdf(tmp)
> >> > plot(1:10)
> >> > dev.off()
> >> quartz
> >>      2
> >>
> >> Note the "//" in the filepath tmp.
> >>
> >> The file is created as
> >>
> "/var/folders/vq/xl0j17pn29g52mgx7lqxl8d80000gn/T/RtmpB9dpQB/ABCD79804200fde4pdf"
> >>
> >> When I look for it in dired, it can't be found as dired stops at the
> >> "//" and interprets it as
> >> /RtmpB9dpQB/ABCD79804f1ca596.pdf
> >>
> >> In order to look for it in dired, I need to
> >> > gsub("//","/",tmp)
> >> [1]
> "/var/folders/vq/xl0j17pn29g52mgx7lqxl8d80000gn/T/RtmpB9dpQB/ABCD79804f1ca596.pdf"
> >>
> >> Can this be fixed by ESS, or by emacs?
> >>
> >> Rich
> >>
> >> _______________________________________________
> >> ESS-bugs ESS-bugs using r-project.org
> >> https://stat.ethz.ch/mailman/listinfo/ess-bugs
> >>
> >> _______________________________________________
> >> ESS-core list: https://stat.ethz.ch/mailman/listinfo/ess-core
>

        [[alternative HTML version deleted]]

_______________________________________________
ESS-bugs ESS-bugs using r-project.org
https://stat.ethz.ch/mailman/listinfo/ess-bugs



More information about the ESS-bugs mailing list