GNU bug report logs - #26055
25.1; Eshell dollar expansion $var[i] not working

Previous Next

Package: emacs;

Reported by: Chunyang Xu <mail <at> xuchunyang.me>

Date: Sat, 11 Mar 2017 09:36:02 UTC

Severity: minor

Tags: confirmed, fixed, patch

Found in version 25.1

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


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

From: npostavs <at> users.sourceforge.net
To: Chunyang Xu <mail <at> xuchunyang.me>
Cc: 26055 <at> debbugs.gnu.org
Subject: Re: bug#26055: 25.1; Eshell dollar expansion $var[i] not working
Date: Fri, 09 Jun 2017 20:33:26 -0400
[Message part 1 (text/plain, inline)]
tags 26055 patch
quit

npostavs <at> users.sourceforge.net writes:

> Since this apparently never worked it's hard to say what's supposed to
> happen, but it looks like a 'number' property is added and then ignored.
> Maybe something like this should be applied?

Since `eshell-lisp-command' does the conversion of strings marked with
'number', I think it's correct to make eshell-index-value do so as well.

[v1-0001-Handle-integer-indices-for-eshell-variables-Bug-2.patch (text/x-diff, inline)]
From bacbb41ab4d5539d284b1a540e70779a49c00e25 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Fri, 9 Jun 2017 19:40:38 -0400
Subject: [PATCH v1] Handle integer indices for eshell variables (Bug#26055)

* lisp/eshell/esh-var.el (eshell-index-value): Convert index to number
if it's been marked as one, just like `eshell-lisp-command' does.
---
 lisp/eshell/esh-var.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index fe1f1188c8..cdd05bd7e9 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -563,6 +563,8 @@ (defun eshell-apply-indices (value indices)
 
 (defun eshell-index-value (value index)
   "Reference VALUE using the given INDEX."
+  (when (and (stringp index) (get-text-property 0 'number index))
+    (setq index (string-to-number index)))
   (if (stringp index)
       (cdr (assoc index value))
     (cond
-- 
2.11.1


This bug report was last modified 7 years and 337 days ago.

Previous Next


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