Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :content-type;
        bh=vrCeV5tzv1Cd43VXHSRZKs0H+0d5P6Jv5ZWr4OWgxe0=;
        b=DgEvbHeaBAXpRX4E5OEQjrjooTZLihtbpr11C1zZiTHjOXoMHbylcnJEwLY/Fm8x3s
         lZhtNdBGBoG4Qiu/memozd5/MgUO5727jqiF/V50kbChTHwuDAH/tOpMZw4QspQJxUfI
         jdnKkbJ2CNqPWpl6zFqATWigAo0TdUtRzkNLdS5NVismdmO/+WmNcsitD34+JWVha4DD
         CxLWmasXu15ebGTuYgdNgkas8ASi3BZ2HeA14inHlP2U7iki+m0p1trfqG9Lr1JIw+vW
         OhZGES3c7XzOIdgMKPl0lhhKecm1IPY2wTQVTaFn/Pp12xgWwWEuNqhaOaK2hX6PzPAI
         VP3g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:content-type;
        bh=vrCeV5tzv1Cd43VXHSRZKs0H+0d5P6Jv5ZWr4OWgxe0=;
        b=ApGK6rgZWXGshinzCoGfsUQpwoWzFOD6wElb0U7XonqSYWw9xKAOpolokIqf+aQTeP
         elJylalaY0HyC0XiCd0SDixR4czq6dhRIJLYB9eoFOWbrTYQUHLfxEOD2c24S3/7TnoJ
         tzXZbj6eCePFGWWpDY9DxliZkWvCFrhKJubL3VZuUA7KbGtFJxSXwM/TIUUOPWepXoio
         vJwwD4gFrQSYIfTs8GL/HTZiom4MDX+h19lKevh5BKAjMPCzgLJu2tiFAUy932H1qYwC
         iOzPVALwRrSUVOBuaNiwop/6Ntkd6qxqfVh6ZKVJtMKcfBhbbQrmbpSAI+sBi24OYnJP
         laDQ==
X-Gm-Message-State: ALoCoQkpi7xohhyJ+bUMXpt6YkfPepHdSzL2Kj6vTXmqdSv35rwCwKStlMchRMjpaeqi8Ogtru9HIemQlNa+Qb7cD2WjvmNCrw==
X-Received: by 10.112.198.102 with SMTP id jb6mr907411lbc.44.1452768925856;
 Thu, 14 Jan 2016 02:55:25 -0800 (PST)
MIME-Version: 1.0
In-Reply-To: <CAKc7PVB07x5iLj0GrrzvLpc6nm7vpy1_Q66W74KWAm_OdMoKzA@mail.gmail.com>
References: <CAKc7PVCnEX1rEhNqhtx7spyUVKCWukz4Tzkqr27-OV9+4hVciQ@mail.gmail.com>
 <CAKc7PVDVR=B8SWX+gSiNvtODWZ-25LtDz7jXVDH8BtrcxMnjXQ@mail.gmail.com>
 <160111161501.ZM5305@torch.brasslantern.com> <CAKc7PVBCEM=46YmgmhPR==Rq+pSfY+hgr8bcOMLV=zLFm6THBg@mail.gmail.com>
 <160112113928.ZM9065@torch.brasslantern.com> <20160113010147.GA4699@tarsus.local2>
 <160112180141.ZM9984@torch.brasslantern.com> <CAKc7PVBz1nNueRmEfyz3157kvJjEgHW3wmSXraKM+-9P-i5Atw@mail.gmail.com>
 <CAKc7PVAdLiKGvay412eLo=0jCpRB9PktAkAVj08sE=gjZ=4nQw@mail.gmail.com> <CAKc7PVB07x5iLj0GrrzvLpc6nm7vpy1_Q66W74KWAm_OdMoKzA@mail.gmail.com>
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Date: Thu, 14 Jan 2016 11:55:06 +0100
Message-ID: <CAKc7PVD-0onr3=OXb7CmTFfob4UsSmWvSG_tppevnr1dtuicZw@mail.gmail.com>
Subject: Re: _history-complete-older problems with $(
To: Zsh hackers list <zsh-workers@zsh.org>
Content-Type: text/plain; charset=UTF-8
X-Seq: zsh-workers 37620

I have one idea. It's generally about detecting a syntax error that
makes shell word unbound. By appending " x" to shell word and running
(Z+n+) one can obtain either 1 or 2 elements and first signals a
syntax error. For such case, SUFFIX would consist only from a space
delimited part of the regular right part.

Best regards,
Sebastian Gniazdowski


On 14 January 2016 at 11:14, Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
> On 14 January 2016 at 10:52, Sebastian Gniazdowski
> <sgniazdowski@gmail.com> wrote:
>> PS. I used the "find LBUFFER myself" approach to handle following case
>> better ("|" is cursor):
>>
>> % $(( 0 |+ 1 ))
>>
>> Doing ${(z)LBUFFER} and then (z) on right part of BUFFER would produce
>> SUFFIX="+" instead of "+ 1 ))".  If I find the word in ${(z)BUFFER}
>
> That turned out to be not true, (z) isn't done on right part, instead
> words[CURRENT] is utilized and chopped to obtain right part of shell
> word.
>
>     local -a left=( "${(z)LBUFFER}" )
>     local right="${words[CURRENT]#${left[-1]}}"
>
> So still clarifying things, maybe it's good idea to do (z) on right
> part to obtain ${|a case behavior.
>
> Best regards,
> Sebastian Gniazdowski

