From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: insert-file-content on windows and WSL Date: Sat, 20 Jan 2024 12:25:30 +0200 Message-ID: <838r4kti79.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17658"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 20 11:26:33 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rR8Yb-0004Nt-Km for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 20 Jan 2024 11:26:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rR8Xz-0008AN-SC; Sat, 20 Jan 2024 05:25:56 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rR8Xx-00088Z-Dr for help-gnu-emacs@gnu.org; Sat, 20 Jan 2024 05:25:53 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rR8Xv-0006tz-Tf for help-gnu-emacs@gnu.org; Sat, 20 Jan 2024 05:25:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zmrJkaNuRxS/wvULLcHxHxitRJHWqrI1OuTBAmm3i+Y=; b=XTQQpvxbsrt8 l5F7M5/Y4+IBt1vBbdHh7U8poH+y1RS9kRaiogTOnTnBJcskpDjyrsdXkcYp2DJZ20GLCBd8w4/4g EODrGZ7eI3JI5cPJKVA9x0lVPB5ZvJM+zHAzlpVuIleB5+sq2lGLbG8OvyZ7owJXb3qV1zROwgvIp 8TdKSwxLD9WVvPuSPIaJCvnT2JrElGRLM2ng7pdTecHvg8+1LAkuCSeZFEM6+xuNiKhS4c4p4zYCK aLJso2dHi8uRdWTCiLOqlg/zLIOBbBzgO+QIjOkdt/mredFF1vEnDSMfYU5T01UWmxaK3zVCAIeaB +GYSIej8Ar5wnKdcXUyWRg==; In-Reply-To: (message from samvid mistry on Sat, 20 Jan 2024 12:00:46 +0530) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145762 Archived-At: > From: samvid mistry > 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.