GNU bug report logs - #60999
30.0.50; [PATCH] Add support for negative indices and index ranges in Eshell

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Sun, 22 Jan 2023 03:48:02 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Done: Jim Porter <jporterbugs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 60999 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 60999 <at> debbugs.gnu.org
Subject: Re: bug#60999: 30.0.50;
 [PATCH] Add support for negative indices and index ranges in Eshell
Date: Sun, 22 Jan 2023 08:29:20 +0200
> Date: Sat, 21 Jan 2023 19:47:47 -0800
> From: Jim Porter <jporterbugs <at> gmail.com>
> 
> Attached is a patch to do this. For the second suggestion, I took some 
> liberties and added range syntax, so that "$x[2..5]" returns elements 2, 
> 3, and 4 (zero-indexed) of x.
> 
> I have just one question though: this implementation treats ranges as 
> half-open, i.e. "M..N" is [M, N). I think that's the best way of doing 
> things (and it matches how 'seq-subseq' works). However, "M..N" is the 
> Bash syntax, which uses a closed range, [M, N]. Maybe this would be too 
> confusing for users? I'm open to using other tokens aside from ".." if 
> that would help. Maybe "M:N" would work? That's the Python syntax, which 
> behaves the same way as this patch. Any thoughts?

I think compatibility to other shells is an advantage.

> +(defcustom eshell-integer-regexp (rx (? "-") (+ digit))
> +  "Regular expression used to match integer arguments."
> +  :type 'regexp)

Why is this a defcustom? what alternative could a user possibly want?

Thanks.




This bug report was last modified 2 years and 116 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.