From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10927 invoked by alias); 16 Sep 2016 21:30:26 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39367 Received: (qmail 8902 invoked from network); 16 Sep 2016 21:30:26 -0000 X-Qmail-Scanner-Diagnostics: from mail-pf0-f169.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.192.169):SA:0(0.0/5.0):. Processed in 0.772508 secs); 16 Sep 2016 21:30:26 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=xycT5/iaAaBr1NTIPiZRgL+xJyyO8h0IG/30itaFLpI=; b=LVm3MrFYsH1jlJ8BvgGPgyt8TLvFBmKbSFnlBA//+0Bagy5VH+LCr6STVe8SwZ5q9j FIQXaSatDV9dhfb/76snxz1oed+AWAIlobCobSmc5snAoferpvfyTJXr3JgpamDptpo8 crhQGTYQBx4oVsq0yG/4ye2Z1kMNZ/dxisbQ7C6dKsQjt6DiyVBY4pN1KP01R0Jizg2J GkIPltiPpHCWgpKgh0Xvr+yPYsxYLjPq3gBpIB4SNvccsJ7JUSYdd40HeOjrFcRj9bZn PMLo0dlzLPJ7nt0NaCx2n/FG7iygaH7FW6cW3e6KNxWVZfJVMqMLtpMdwmCnSG2RTCiH GaOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=xycT5/iaAaBr1NTIPiZRgL+xJyyO8h0IG/30itaFLpI=; b=KtbglFRyGxk3BePxi7+QdaK7wlihGOI0F3NdSZ7UGl0YL+kWVMEA50wqc/4YNxmetx HHecwNUI6rkt4BOiKEWqHjX6AkfyLSthYJs7w6OCjKxGflqdbqw/cZCYYYd2xiEGruuJ 3NdlNloZ//2NowxDwM/bEBkDSqMtfNrJ1YJSsPkHqD3/roJGHlyQV7BuUoBBYaRPWEd2 /edRVMk5uXvcsb55FMImV5HgiQ3TJWQlCFCE3GFR+wrNCxKBYfLlez2JuQevTlyP3WJO n9K0yN5pRNyJvO9g9ffnwpuGaRsXjmczwtPX/xyy66yFfKBIJrNhpsx8LsywNsuCjmDl /95A== X-Gm-Message-State: AE9vXwOLtOpXXkJN5lE4veEvxa9VoJuH0px1IBN/xyEgOy5s5rCqUVuPvVx1ew85k86eow== X-Received: by 10.98.149.82 with SMTP id p79mr26208435pfd.150.1474060952207; Fri, 16 Sep 2016 14:22:32 -0700 (PDT) From: Bart Schaefer Message-Id: <160916142248.ZM26196@torch.brasslantern.com> Date: Fri, 16 Sep 2016 14:22:48 -0700 In-Reply-To: <76020.1474058827@hydra.kiddle.eu> Comments: In reply to Oliver Kiddle "Re: Off-by-one with select-*-shell-word text object?" (Sep 16, 10:47pm) References: <160916102137.ZM11290@torch.brasslantern.com> <76020.1474058827@hydra.kiddle.eu> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Off-by-one with select-*-shell-word text object? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 16, 10:47pm, Oliver Kiddle wrote: } Subject: Re: Off-by-one with select-*-shell-word text object? } } Bart wrote: } > Noticed during recent zsh-users thread: } > } > torch% quote-this-word() { zle select-in-shell-word; zle quote-region } } > torch% zle -N quote-this-word } > torch% bindkey "''" quote-this-word } > torch% echo foo'' } > torch% echo' foo' } } The problem is that both select-in-shell-word and select-a-shell-word } are handled by a single function that tests the value of bindk to } see which widget it is running. Aha! Indeed, this works: quote-this-word() { zle select-in-shell-word -w ; zle quote-region } } For select-a-shell-word including the preceding space is intentional. That should probably be documented, then. Currently the doc says the adjacent blanks are selected for -a-blank-word and -a-word, but does not mention that for -a-shell-word. I suppose it could be inferred from name similarity, but that shouldn't be necessary. } Looking at execzlefunc, I can't see an alternative way to get the } actual widget being run. Have I missed anything? Although it's not ideal to have a built-in widget that requires the use of the -w flag when calling from a user-defined widget, it's also probably OK if properly documented. } Or it needs six small wrapper functions for the actual widgets. This would be in line with the way similar widgets with a common core have been implemented in the past. However: } Or a ZLE_ flag - actually two to cover } select-in-word/select-in-blank-word. I think one flag to force the equivalent of set_bindk = 1 would do? (zle_main.c:1358) I don't have a preference here, except: It occurs to me that using this same sort of flag on the menu-complete and reverse-menu-complete Thingys might have fixed the problem that you addressed a different way in workers/38043. It also occurs to me to wonder whether set_bindk = 0 *ever* makes sense for builtin widgets. Can somebody give me an example of a builtin that would care about the widget name of its user-defined caller?