From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: Emacs syntax for filenames to mean "absolute location on the current remote host"? Date: Mon, 28 Aug 2023 20:51:56 -0700 Message-ID: <749b83b2-a8f8-76c5-83e8-2f4044476f74@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36692"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 29 05:53:02 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qapmn-0009La-S3 for ged-emacs-devel@m.gmane-mx.org; Tue, 29 Aug 2023 05:53:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qaplt-00010R-36; Mon, 28 Aug 2023 23:52:05 -0400 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 1qaplr-00010G-Ad for emacs-devel@gnu.org; Mon, 28 Aug 2023 23:52:03 -0400 Original-Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qapln-0005d5-6u for emacs-devel@gnu.org; Mon, 28 Aug 2023 23:52:03 -0400 Original-Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1bdb7b0c8afso22990935ad.3 for ; Mon, 28 Aug 2023 20:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693281117; x=1693885917; h=content-transfer-encoding:subject:from:to:content-language :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=yklrmYCykdshigmF5w+dxjyXF4ih8tWwn5SI0+gEZxo=; b=XGwTUROhqyTKS84IRiQJmtjxR7F9aZv1nq8GWWZsobu6U4oQcFFMvyuU/p1XVmJzea 2MsXWyLNszPZv1fpL/MSML6+3LJQb829N8KIH25wYkFnbS71+oNCBpNHr/ozoynPkGF2 Vc5/hH9djnKitnDaZs9tCTcfQGHQUCe3sYM1pg1iOQdF4pOsQ5NU7n/Hf+j72lRawCQz VhsZ4S/RU8QmqyGFl6wZSGF9dBDlCzPbk96eJ0Nl0yx0mzV38lDw8II9YfHIhc8OgOwN sc8vOgSUblFmlIOJjsSOXlnwJ/TtNUKI+er2GhX+pE6i18ngZ1aAIfTCjemSsaOPlwfi 78KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693281117; x=1693885917; h=content-transfer-encoding:subject:from:to:content-language :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=yklrmYCykdshigmF5w+dxjyXF4ih8tWwn5SI0+gEZxo=; b=RUFRlW5uGa393kbO95XW+zvjJ6HUlSLBhCmBLk7FoGZm2t4i5Kuzt2V2IfeQpKbBnD K0rtYId9zasDcActj0WbaFTqIg34eC4K1C1LCv5r5XZJDRH7LEItjA8O+OkSmM3hPhlj mJU6sRT+C/t1tY4YjGGyD88QTEWpGoHFb+gyWuoGv/Qi4XRtU3MbVoq9yUq/wTjk4R3P CnVd3v84XqGqvY6ls5K7uOza0IxwHKVVIRcgdPO7O5M3uW2LMWvzOuvQFYYOJiz3AwcY CRRGy5RF6JPUJ1CYNCe/E79Uo7uOfYspodGUWDfU6ZhbyRJXBeYwFz5jqOTP6cxb/rQG /MfA== X-Gm-Message-State: AOJu0YxIid0oRrA2NfYL5RVo7KwtzUIl4wSmSEwXA3zjHCD0Au8f4XBQ DRNfjza3JUvhUIq7C/QLwplSBi06DOI= X-Google-Smtp-Source: AGHT+IEJaeSGtk/N2+16knsRJO74k9cBc72dg8K0goWxO8Q7FOgkKwYfdo5aLi3SUKJcJOJAD3A9kQ== X-Received: by 2002:a17:902:6b0c:b0:1b7:f64b:378a with SMTP id o12-20020a1709026b0c00b001b7f64b378amr19630120plk.16.1693281117320; Mon, 28 Aug 2023 20:51:57 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id q10-20020a17090311ca00b001bdcc3a09c3sm8197636plh.256.2023.08.28.20.51.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Aug 2023 20:51:56 -0700 (PDT) X-Mozilla-News-Host: news://news.gmane.io:119 Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:309475 Archived-At: In Emacs, is there a way of spelling a file name to mean "an absolute name on the current remote host"? We have a way of spelling an absolute name on the local host ("/foo/bar"), and an absolute name on a specific remote ("/method:host:/foo/bar"), but I'm not aware of a way to make a string that means the equivalent of: (concat (file-name-remote-p default-directory) "/foo/bar") Do we have a syntax for this? If not, could we add one? Maybe something like "/.::/foo/bar"? That would be a remote file name with the method of "." - i.e. "the current method" and no hostname (it would be inferred from the current remote). ---------------------------------------- If you'd like to know why I'm asking, read on. But be warned: I'm still trying to reason through all the logic here myself, so this may be a bit confusing (it certainly is for me!). This is relevant for Eshell. In Eshell, you SSH into other hosts simply by using "cd /ssh:user@host:~". This is very convenient, but it produces some odd effects: when you're on a remote host like this, the meaning of "/foo/bar" is ambiguous. If you pass that to a command, it could mean: 1) "/foo/bar" on your local filesystem (when the command is an Emacs Lisp function) 2) "/foo/bar" on "host" (when the command is an external process) To make matters more confusing, some Eshell commands implemented in Lisp will fall back to an external process if the Lisp version can't do what you asked, meaning that you need to know Eshell *very* well to be sure what will happen in these cases.[1] To get around this, what if Eshell had a way of unambiguously referring to absolute file names, whether on your local system or the current remote host? For the local system, we already have a syntax available: quoted file names (e.g. "/:/foo/bar"). However, we'd need one for the current remote host too (see above). As an addendum: it would be nice to have "/foo/bar" be usable too (i.e. not have this weird inconsistency). However, I think we'd need to perform some translations in Eshell to make this work, and I think that'd need to be defined on a per-command basis, so there would end up being cases where that broke. Unambiguous syntaxes would let us avoid that in the general case (at the cost of more typing). [1] There's an optional Eshell module called "Electric Slash", but it doesn't handle this more-complex scenario.