From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16781 invoked by alias); 1 Sep 2015 09:56:10 -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: 36362 Received: (qmail 18479 invoked from network); 1 Sep 2015 09:56:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1441101029; bh=YDFCaolRlzmKIWc2mxMNMLyAiGxAUmvWPqGcO0zEPaQ=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=GsF/A0NxHRjfwFYgKe3geHveHVp1YWnX7x7+OoXC45suc6GXNhnEo1x9+TbBB2v+uUm0b0phm1l2dOs0SbOm3o8nOEfTFz15tb6QGP8RKMGdDmi52YB3ZVp6PNOBrvLTCZ2FFkfOD+wnm+D0SYJ7bbK8V1Dc05pEejspstoELasgTLgMOhaJSPfBSqjQhMCz+6H7wcpp4FD3+44d8DbcvYGyTS9Mle3+Gso4zLqNS77Y0UwwkMNPHoFHgMyqks/p3nWnaIEVcwgpQxcOjPcymTwYmnxUT7NOOeP2JBrWQVS6QNjO9YYfiO5Sfq0kgtloGZXmqumVdIc4QN6QnFmVaw== X-Yahoo-Newman-Id: 999266.6460.bm@smtp139.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: NEs2P4oVM1m0xfGZS92fLeZNYehVdcZx7oD0B5iEAzf0FvQ qMsfLzfNay.TgFdH_85KYp3f4g2.aUyJ8yO94HsCLTL5pvwcgD4T5GNhAPFZ SXWU1vL3hcfE5vD0qlVvuu6tFWibysZNzESYB8WHqH38yJRD9L.tCLguOwHf oNjxiUXhzYyNuQVhJgNSLpvE56bcdpRU47kRQj8bEPSNAfcHtkcNOKLjTH30 LmGorEeLoHTi62rUqlC1K3_0aqXfUqJFTU791I5mVd7LbHFNYKzJqtKBnr5j pAnJIE93Umdld4ifP4wDnCNDN1YJkAd2_LEX1f0UFWFQgoiGOG6lF8ZQj0P4 qDejtSS5TXMprSc65n5.sll8s_0pjtkU51eVOntTMxN7YM8gF882a.tB3h1E Bdir2GRZVk8LffrdaYXJZY5sXexzBjfMPpRhmLBhkE5lPlDTrd1VabL_rXJy kzTFvVrQJbYiWRJNL6ZOC_dYAaee3sjSQ0PdLSs3VnPapLbQLy9cPxr9RvgT mdHcHZWoUs7lyFRbfkAW.4ex65cFhVg-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <1441087664-9081-1-git-send-email-mikachu@gmail.com> From: Oliver Kiddle References: <1441087664-9081-1-git-send-email-mikachu@gmail.com> To: zsh-workers@zsh.org Subject: Re: PATCH v2 (complete): Implement zle -P MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23176.1441101027.1@thecus.kiddle.eu> Date: Tue, 01 Sep 2015 11:50:27 +0200 Message-ID: <23177.1441101027@thecus.kiddle.eu> Mikael Magnusson wrote: > > Indeed, I'm not sure if a user can figure out which widgets are useful > to override in this way. Would it be more useful to just do what Wayne > did originally and let zle -N take some flags that specify which specific > flags the new widget should have after all? The advantage of this method > is that if we add more flags, users can wrap those widgets without us > remembering to add a new zle -N flag as well. I think that approach is better than the prototypes. Otherwise, users will end up needing to dig into the source code to find arbitrary widgets that happen to have the right combination of flags. It is a lot easier to document a list of flags. It would also make it easier to only offer a subset of the ZLE_ flags. Allowing a flag requires us to do the work of fully checking the implications of making that flag user-tweakable. It might also constrain us in the future as we preserve backward compatibility if we don't limit those that are available. If we do go down the route of allowing flags to be set for widgets, it needn't be specific to user-defined widgets. I currently use the following: vi-cmd-suffix-retain () { zle auto-suffix-retain zle vi-cmd-mode } That might just be zle -f auto-suffix-retain vi-cmd-mode That should not be possible for the dot variants - .vi-cmd-mode The opposite might also be needed with +f or a no- prefix. That could also lead to a way to make self-insert not clear the current region by making that behaviour a flag. See 33626 As Bart mentions in 28560, the auto-suffix-retain precedent would suggest that we should perhaps consider another yank-pop-enable widget (or perhaps hold-yank-state given that this now affects highlighting and not just yank-pop). An advantage of that approach over the flags is that the full implementation of the widget is contained within the function definition file. With the flags, we might end up needing something like #compdef so you can put #zledef -f yank as the first line of the function definition. Another possibility would be to try to make something like hold-yank-state automatic - assuming that hypothetical widget was called after every yank/yank-pop/vi-put-* in a user-defined widget. Either way, how can we be sure that yankb/yanke are even vaguely sensible after the user-defined widget has finished? Oliver