From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 33489fdf for ; Sat, 11 Jan 2020 14:30:55 +0000 (UTC) Received: (qmail 22958 invoked by alias); 11 Jan 2020 14:30:48 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24644 Received: (qmail 2277 invoked by uid 1010); 11 Jan 2020 14:30:48 -0000 X-Qmail-Scanner-Diagnostics: from mail-il1-f194.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25684. spamassassin: 3.4.2. Clear:RC:0(209.85.166.194):SA:0(-1.0/5.0):. Processed in 1.669239 secs); 11 Jan 2020 14:30:48 -0000 X-Envelope-From: roman.perepelitsa@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.194 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XvaVyzAcDFjJIU9RVlB6DKnSpSxEhGgEuc576DkF0/o=; b=O5/P4b9PQJbDZWSgr4iAGfi3+FEqOjPAoBpNsanIPp09nFCDLyDeoHNaQ0HSCQy6ap rCcQjSPSN3XTzRZFz2MCTX8BwzuJZc0rx4BdY7Kwliso+ImFLsgBlmbfHDfWx5WZ4ECF JHlzHBc8WHAUMw2H2tfPBIs77+ze1rkXMC1vPpoLimuL5tj0QkbALtGoeRTIMNk52rOj QEONf2/P9S2o0V0vMsyCREI0ZTqPX719NEOIBbh5y+tzYylMvm+O8Vf7gKxClrALnfT7 1c7xHaIGlIiBaUxVDU3mhlhxvIF4jP7rmp9jaCLR0VuvngyvOo6yZrzRbyFl9anj+kW9 qdsA== X-Gm-Message-State: APjAAAU2PTnDXDrbr5p8R1ey0qounGasIUw/kV9emH7V6nmCKWcOg9a6 ERYmdBSpctLFknfhn+lyfPZAyHyOqrXSTV6ogYY= X-Google-Smtp-Source: APXvYqweNXQN+z3/HY2kvmElO/GL/X8GZssD0r8GWFkz9XHikpcRIjxRob1zrRy7Yz1a/0iIzujC60hkllKWxZFYPr0= X-Received: by 2002:a92:290a:: with SMTP id l10mr7374229ilg.151.1578753012606; Sat, 11 Jan 2020 06:30:12 -0800 (PST) MIME-Version: 1.0 References: <1578477603.6726.5.camel@samsung.com> <3e056cff-f690-f416-d8b6-89059c64187a@gmail.com> <20200110170639.uvdidtgwswjqanhh@tarpaulin.shahaf.local2> <2ee94482-d28f-460e-bc76-486f1c7014cf@www.fastmail.com> In-Reply-To: From: Roman Perepelitsa Date: Sat, 11 Jan 2020 15:30:01 +0100 Message-ID: Subject: Re: z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings) To: Sebastian Gniazdowski Cc: Daniel Shahaf , Zsh Users Content-Type: text/plain; charset="UTF-8" [moving ericdfreese@gmail.com to bcc as this isn't related to zsh-autosuggestions] On Sat, Jan 11, 2020 at 12:46 AM Sebastian Gniazdowski wrote: > Yes, it contains the code to extract the commands and also function > bodies from Zsh source. The code responsible for this starts at line > 186 of src/zsd-detect.main. The place in code to get the command is > line 325 of the file. Thanks, this is the hint I needed . $token at zsd-detect.main:325 is always a word in the command position, right? I'm looking for a parser that's a bit more precise. Here are a few examples of zsh code I want to be handled correctly: 2>&1 x x < /dev/null y c d The parser needs to be fast as I'm going to be calling it from zle. It shouldn't perform I/O (no file globbing) and must not have side effects. These constraints mean that correct parsing is impossible to implement. For example, there is no way to figure out what `*` does . I'm OK with it. Given the choice between false positives (parser says something is a command when it isn't) and false negatives (parser misses a command), I would prefer false positives. I'm not asking you (or anyone else) to build this for me. Just sharing to provide context. Roman.