unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: insert-file-content on windows and WSL
Date: Sat, 20 Jan 2024 12:25:30 +0200	[thread overview]
Message-ID: <838r4kti79.fsf@gnu.org> (raw)
In-Reply-To: <CAO=nQuuGmLw7Bd+n_s_WSn3=Kb=L2z+dt6D2VLnJWYe0CyvVJA@mail.gmail.com> (message from samvid mistry on Sat, 20 Jan 2024 12:00:46 +0530)

> 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	other threads:[~2024-01-20 10:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-20  6:30 insert-file-content on windows and WSL samvid mistry
2024-01-20 10:25 ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=838r4kti79.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).