help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: insert-file-content on windows and WSL


From: Eli Zaretskii
Subject: Re: insert-file-content on windows and WSL
Date: Sat, 20 Jan 2024 12:25:30 +0200

> From: samvid mistry <mistrysamvid@gmail.com>
> Date: Sat, 20 Jan 2024 12:00:46 +0530
> 
> I was playing with some code and found an unusual behaviour of
> insert-file-contents. I am running GNU Emacs 29.1 *on Windows*. When I am
> in a file/buffer that is within WSL, accessed using
> `//wsl.localhost/Ubuntu/...`, I can open WSL paths without the prefix,
> i.e., I can write `(insert-file-contents "/home/samvid/davmail.log")`
> instead of `(insert-file-contents
> "//wsl.localhost/Ubuntu/home/samvid/davmail.log")` and it will open the
> correct file. However, running `(insert-file-contents
> "/home/samvid/davmail.log")` when I am in a buffer/file on windows
> filesystem, it will run into this error
> 
> `(file-missing "Opening input file" "No such file or directory"
> "c:/home/samvid/davmail.log")`

Isn't this just normal prepending of the drive letter to a file name
that lacks it?  I'm guessing that when you are in a buffer whose name
begins with //wsl.localhost/Ubuntu/... Emacs prepends that to a file
name without a drive letter, whereas in a buffer on the C: drive, it
prepends C:/ instead.

Emacs on Windows doesn't consider file names that begin with a slash
as absolute file names, unless they have are in UNC format and begin
with two slashes.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]