unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Chunyang Xu <mail@xuchunyang.me>
Cc: 26055@debbugs.gnu.org
Subject: bug#26055: 25.1; Eshell dollar expansion $var[i] not working
Date: Fri, 09 Jun 2017 20:33:26 -0400	[thread overview]
Message-ID: <87mv9gwujt.fsf@users.sourceforge.net> (raw)
In-Reply-To: <87a88o7bet.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Tue, 14 Mar 2017 00:03:06 -0400")

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

tags 26055 patch
quit

npostavs@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 929 bytes --]

From bacbb41ab4d5539d284b1a540e70779a49c00e25 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@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


  reply	other threads:[~2017-06-10  0:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-11  9:35 bug#26055: 25.1; Eshell dollar expansion $var[i] not working Chunyang Xu
2017-03-14  4:03 ` npostavs
2017-06-10  0:33   ` npostavs [this message]
2017-06-17  4:17     ` npostavs

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=87mv9gwujt.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=26055@debbugs.gnu.org \
    --cc=mail@xuchunyang.me \
    /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).