From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: Emacs syntax for filenames to mean "absolute location on the current remote host"? Date: Fri, 01 Sep 2023 20:13:08 +0200 Message-ID: <874jkdrccr.fsf@gmx.de> References: <749b83b2-a8f8-76c5-83e8-2f4044476f74@gmail.com> <877cpeuwyi.fsf@gmx.de> <3ba84988-49d4-1a9f-471b-0436658c6ee2@gmail.com> <87o7injouu.fsf@gmx.de> <0585b415-4b54-95c3-4454-9317d7a79c61@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13356"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Jim Porter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 01 20:14:11 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 1qc8ep-0003J0-0l for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Sep 2023 20:14:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qc8dx-0005W2-7M; Fri, 01 Sep 2023 14:13:17 -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 1qc8dv-0005Vt-Bl for emacs-devel@gnu.org; Fri, 01 Sep 2023 14:13:15 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qc8ds-00086x-E7 for emacs-devel@gnu.org; Fri, 01 Sep 2023 14:13:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1693591989; x=1694196789; i=michael.albinus@gmx.de; bh=UtIEchhibQv6ob73RRLnhdG8/r0cJfpPGzKGD55hlvg=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=pCkDvCcrlzKneJlBa6BNs95chh/MYk2HXj+AYLp+6L9l2S7Zq/Gde/EKHgu+f741BN5eGER YtuLevwQ/NtqcwiUQe5zPC2+cUk1gR2aH8HdxGIzrDMlx9ThkafKmMNiDktUweAwS/hrgQr4D 2PdeN/G525RsR7QQUddf6PQN6SSUHLe6ZqlW8rd/IpFMiYLltX9gvKTnA+TP+AG6LMEdJxWcR F9Bs1oyRbcaRg9FLvmGCJNd7cNqRVITQfWDwJl3jMkpalkd4ab9AeucoT41vCDzzuc5PC8nWX AkS6HJ7xmPhsLkoO+VJ+0Qcq3wCB0wFKq/0NpHcI1q9igXWAuVxQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.16]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N79yQ-1pbcuv07WW-017VVD; Fri, 01 Sep 2023 20:13:09 +0200 In-Reply-To: <0585b415-4b54-95c3-4454-9317d7a79c61@gmail.com> (Jim Porter's message of "Fri, 1 Sep 2023 10:36:56 -0700") X-Provags-ID: V03:K1:TsZBbfh8pJkUiJ7mzS0cFTLmiUnSJdSvGBbcp0s2LaC3QEilR81 esoEc39E7R0xoo6Wn1IFPLvVNuY3Tih5Sx5T4TLEcQXCHzGejQOB1Z5Y9h2n1Ls3sTTd3e4 ghLqHCKrUeJhlQS0qrSeQgihbED942zZDbSQ9560ozKq3zVmeE5nDyeSS8ywyZcoquCeRdZ POxIKUKcKUa8YcgBueAFQ== UI-OutboundReport: notjunk:1;M01:P0:/W66NFkp268=;9j+OseDRaUK4rHROUnbXuiPpfKp dqLfir4viTcE491xa61XhaKNJdLqAozP7izUhcOh/rXzjmtPlqUHZf02yaSvcwHOwfoiNun1H Dwf7uj47YNASk7XUjzlV1wEbMIvLRDZQgL5NbFIm/mMKHFV4oSVmz1rT2KqEUfyRm5jY12Iqm jDOZHduLMUaUXK7AoAvi0X5ruRXIycXUFQX93QZdZCWJigG+AbIVUqIeG3+mkz+TIw62yf0IO 3YQza5572Y3wjwMgZxrRw34Ooarixz0IWJME2sEEQKoRflkpKvYB1VMTL5/jSudP8+Pkj40jc DqqKDQIB54eK368hppjQcMLNiVLXXliJ+XLUxSSJEwub3QmXyiQwiXZVG48H7M/6Arv/tPrRq CJFehf6/7F5M3ekEBOVo9sQbk4iGwq5iHkCq58JBWfiq38DO0hXCpSZ/9r3Fly6T3eu+g+av2 hORQSKXL/7gcKiJ4uOahKop2Xg+3dyk2xMblkq1cltJOCE6j7vobVpoUSq2vFY4EQKG8pCpdl jVwOwl76r/4EixQ4WBpSsC/2gwNKK+iK/eGg92QYcG4q0KCzHQ2rEdAvQedLlm9sEmjVdogui nA4+HhalEcmfom/7sHi/Ih6ZWHX+mkZ5SaIlSCiKHRqQoWEnewxwrKMruPW7NE3Ip9HfiyD31 DHNM1DtDPe+sm5XSQtO2MsONB9G8HeGhfWrqMFZaj//UL1o2zCKF0zRk4w6aUVEKpNCkPvbVV CkHu/2c7XsSde9WOCaWaGRRAvgwYPoCFqusYQ3pFlYYVfZ+Mvkj+oog4/ZEpvI8kd2VwnfE+ Received-SPF: pass client-ip=212.227.15.15; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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:309828 Archived-At: Jim Porter writes: Hi Jim, >>> The one edge case I'm not quite sure what to do about is: how should >>> we spell "the user's home directory on localhost"? Using "/:~" *could* >>> work (in that Eshell could recognize it and do the right thing), but >>> it's also the way that you spell "the file named ~" elsewhere in >>> Emacs. (Eshell would spell that \~ or '~'). Maybe that's not such a >>> big deal though: we can just document this corner case and hope users >>> don't get *too* confused. >> IIUC, "~" in a file name means always the home directory when it is >> the >> first character (of the local part in remote file names), or it comes >> after a slash like in "/~". See (info "(elisp) File Name Expansion") > > The main thing I'm worried about is this: if we say that in Eshell, > "/foo/bar" is relative to the current remote host, then the same > should be true for "~": it would refer to your remote homedir when > applicable. > > Then we'd want a way to refer to your *local* homedir no matter where > you are. If we use "/:/foo/bar" to refer to the always-local > "/foo/bar", then we might say "/:~" means your local homedir. But the > Emacs manual says: > >> =E2=80=98/:=E2=80=99 can also prevent =E2=80=98~=E2=80=99 from being tre= ated as a special character > for a user=E2=80=99s home directory. > > So according to that rule, "/:~" would mean "the file named tilde in > the current directory". Hmm, I've never stumbled over this sentence in the manual. And it is a little bit vague: "can also prevent". A short test shows that it doesn't if the tilde comes directly after the qu= oting: --8<---------------cut here---------------start------------->8--- M-x cd RET /net RET M-x pwd =3D> /net M-x cd RET /:~ RET M-x pwd =3D> /home/albinus M-x cd RET /:~user RET M-x pwd =3D> /home/user --8<---------------cut here---------------end--------------->8--- It even works for remote file names (although there are still some quirks): --8<---------------cut here---------------start------------->8--- C-x C-f /ssh:ford:/:~ RET =3D> dired buffer of remote user's home directory --8<---------------cut here---------------end--------------->8--- What doesn't work are file names like "/:/tmp/~hack", as said in the manual. > I *think* what we'd want to do is to say, "Eshell's quoted file names > work slightly differently from quoted filenames elsewhere in > Emacs. Since Eshell expands tildes in file names on its own, '/:~' > always means your local home directory. If you want to refer to a file > whose name is tilde, you can use Eshell's escape sequences (etc, > etc)." Perhaps it is sufficient to point to the above restriction? And in some Eshell commands, the local home directory is given simply by the absence of an argument, like in "cd". > I'll try to put together a patch that does this, and then people can > try it out and see if it makes sense. Yep. Best regards, Michael.