unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 54470@debbugs.gnu.org
Subject: bug#54470: 29.0.50; [PATCH] Add documentation/tests for Eshell argument expansion
Date: Fri, 15 Apr 2022 21:57:02 -0700	[thread overview]
Message-ID: <25d222b3-9633-708e-6ac7-568c7a89e806@gmail.com> (raw)
In-Reply-To: <83zgkm1p4v.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1587 bytes --]

On 4/15/2022 5:56 AM, Eli Zaretskii wrote:
>> Cc: 54470@debbugs.gnu.org
>> From: Jim Porter <jporterbugs@gmail.com>
>> Date: Fri, 1 Apr 2022 22:10:07 -0700
>>
>>> @kbd is right for things that are meant specifically and only as
>>> keyboard input.
>>
>> Thanks for the explanation.
>>
>> Having thought this over further, I think Eli's suggestion to use @samp
>> makes sense for both the globs and the predicates/modifiers, so I've
>> updated my patches to do this.
> 
> Thanks.  I was about to install these, but then I saw that some of
> the tests you added fail on my system:
[snip]

Thanks for testing. I think this is because `eshell-file-attributes' 
calls `expand-file-name' on the FILE argument, which prepends a drive 
letter on MS Windows. That makes my code in `eshell-partial-let-func' 
(in em-pred-tests.el) fail to identify the fake files.

Can you try the attached patch to see if the tests pass? If it works, 
I'll fold it into the previous patches and resubmit them. (It works for 
me on an MS Windows system, but I don't have build tools on it, so I 
just used the binary release of 28.1 with some of the bits copied from 
my patches to test it out.)

There are a few other ways I could fix this, but this seemed like the 
best. Now, if `eshell-file-attributes' calls `file-attributes', it 
always forwards the FILE argument unchanged, so the wrapping is more 
"transparent" in that case. (Note: I'm not sure `eshell-file-attributes' 
is even necessary anymore; maybe Tramp handles that for us? I haven't 
tested this enough to be confident we can remove it though...)

[-- Attachment #2: fix-ms-windows-tests.patch --]
[-- Type: text/plain, Size: 907 bytes --]

diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index 8089d4d74b..3da712c719 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -592,11 +592,11 @@ eshell-file-attributes
 The optional argument ID-FORMAT specifies the preferred uid and
 gid format.  Valid values are `string' and `integer', defaulting to
 `integer'.  See `file-attributes'."
-  (let* ((file (expand-file-name file))
+  (let* ((expanded-file (expand-file-name file))
 	 entry)
-    (if (string-equal (file-remote-p file 'method) "ftp")
-	(let ((base (file-name-nondirectory file))
-	      (dir (file-name-directory file)))
+    (if (string-equal (file-remote-p expanded-file 'method) "ftp")
+	(let ((base (file-name-nondirectory expanded-file))
+	      (dir (file-name-directory expanded-file)))
 	  (if (string-equal "" base) (setq base "."))
 	  (unless entry
 	    (setq entry (eshell-parse-ange-ls dir))

  reply	other threads:[~2022-04-16  4:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-20  1:34 bug#54470: 29.0.50; [PATCH] Add documentation/tests for Eshell argument expansion Jim Porter
2022-03-20  7:05 ` Eli Zaretskii
2022-03-20 20:57   ` Jim Porter
2022-03-28  2:29     ` Jim Porter
2022-03-30  4:47     ` Jim Porter
2022-03-31  7:19     ` Eli Zaretskii
2022-04-01  4:11       ` Richard Stallman
2022-04-02  5:10         ` Jim Porter
2022-04-15 12:56           ` Eli Zaretskii
2022-04-16  4:57             ` Jim Porter [this message]
2022-04-16 10:30               ` Eli Zaretskii
2022-04-16 17:14                 ` Jim Porter
2022-04-17  7:32                   ` Eli Zaretskii
2022-04-17 18:38                     ` Jim Porter

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=25d222b3-9633-708e-6ac7-568c7a89e806@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=54470@debbugs.gnu.org \
    --cc=eliz@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).