From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6251 invoked by alias); 23 Mar 2013 14:55: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: 31173 Received: (qmail 4221 invoked from network); 23 Mar 2013 14:55:25 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: zsh-workers@zsh.org Subject: [PATCH 0/2] Custom init and finish hooks with vared Date: Sat, 23 Mar 2013 15:46:36 +0100 Message-Id: <1364049998-22603-1-git-send-email-ft@bewatermyfriend.org> X-Mailer: git-send-email 1.8.2.rc1 X-Df-Sender: [pbs]NDMwNDQ0 So, I wanted to write a function that helps me write commit messages with git from the command line, roughly like this: #+begin_src shell-script local msg name email name=$(git config --get user.name) email=$(git config --get user.email) msg=" Signed-off-by: $name <$email>" vared -p $' - type your commit message -\n' msg printf '%s\n' "$msg" | git commit -F- #+begin_src shell-script Of course, I wanted to have the cursor at the very beginning of the vared buffer after vared started up. I could have done it by using $CONTEXT and some other state-handling variables all within `zle-line-init', but I think being able to do it the way the second patch of this series implements is way more elegant. Documentation update coming up, unless someone screams "this has no chance of making it into the core!"... ;) Regards, Frank Frank Terbeck (2): zle: Make sure state changes are refreshed after init hook Let vared define custom init and finish hooks Src/Zle/zle_main.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) -- 1.8.2.rc1