From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9337 invoked by alias); 24 Sep 2017 11:43:24 -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: X-Seq: 22900 Received: (qmail 8360 invoked by uid 1010); 24 Sep 2017 11:43:24 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.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(66.111.4.25):SA:0(-2.6/5.0):. Processed in 4.013538 secs); 24 Sep 2017 11:43:24 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=tJoFVA RbfiuGHjuZq6EO1K37tetzTR3LPFI2AjSc9fM=; b=ES3RptlqO0fTNhvBas2DKa 3DidHfccKCtPdDq06nJc2lWi5o2LYLyDSVUWj5lHkUVrAfJ5DgZnmYKNBDOVzYE2 3zDz6HgQi1Dx2cKIl7KH8NcScbffRliF+V2dRh5q8o7p3IEclB4AV8Zp7GJ+c/ZO FkLv9XSCzXYtcgUZqvJFu2QF+xi/JtAJW/E5bIhJdwilgkcaZLY4Hbz2pmDyKXZ5 a/AkGnLFW1c8IURzOcOGy/wrqbX8c6POCfqfnLogP3hBkKl/MiFuf/gvMu+SrRkN qTGAAWFNuZywhb6jXECMMQUfkaz8QpntgnMzW31IXYhgRElwU90V4Z0+/uIM0k9A == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=tJoFVA RbfiuGHjuZq6EO1K37tetzTR3LPFI2AjSc9fM=; b=UIt3SbcITomZO0C9aflIhc wOuD8wcp1MSh7lOqlio2of6hFpf8RKE7r4AfDcjJLuUqdNLQh8a18Zkzx1wnK1+f JAL++PTPvL5rYrVBQhfKnYlYRG3hapjwbPf5rd9q/ys0NzyJedM7RHgRhNZQkUP0 HOIjfW8aPJckrKXuotl5o0iK5jleV6jha4X7kkwqWZf3N1ausSpAIw4DlbCPHWEH hrpp+o1+pk5kJp1R+W7TV6JCnDHzca4ZtTbeC5R1xhBXvURbwfyHj9WBC+3ZBYSR frUcB/bSre2MrWzzBM0g9K9KC4fJaQ6D237fvJSRQsIHeZ7J69xbGO/I8TZgMWyw == X-ME-Sender: Message-Id: <1506252857.3027539.1116380512.53924863@webmail.messagingengine.com> From: Daniel Shahaf To: yegle , zsh-users@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-64b08692 Date: Sun, 24 Sep 2017 11:34:17 +0000 In-Reply-To: References: Subject: Re: gen-hg-bookmark-string hook in vcs_info is not very helpful yegle wrote on Fri, 22 Sep 2017 11:33 -0700: > Specifically, the issue with these lines: > https://github.com/zsh-users/zsh/blob/master/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg#L140-L142 > (Tangential: ) > if VCS_INFO_hook 'gen-hg-bookmark-string' "${hgbmarks[@]}"; then > # If there is an active bookmark, annotate it and put it first. > if [[ -n $curbm ]] ; then > hgbmarks[(i)$curbm]=() > hgbmarks[1,0]="${curbm}*" > fi > hgbmstring=${(j:, :)hgbmarks} > # Deannotate the array, in case later code expects it to be valid. > # (The order is not restored.) > [[ -n $curbm ]] && hgbmarks[1]=${${hgbmarks[1]}[1,-2]} > else > hgbmstring=${hook_com[hg-bookmark-string]} > fi > > Because the existing code append $curbm with *, it seems like I can just > modify curbm in my hook to add color escape string. You can't, for two reasons: 1. $curbm is private to VCS_INFO_get_data_hg; it is not part of the API. The API includes only what's in the manual, e.g., $hook_com and $ret. 2. The codepath you're quoting is the codepath for when there is no hook. You have a hook so you _should_ be taking the 'else' branch. The reason you don't is that your hook function neglects to set ret=1 before it returns (again, that's documented). tl;dr: Add "ret=1" in your hook function. > Can anyone propose a patch to fix this issue and make > gen-hg-bookmark-string more useful? I would be happy to send a PR if > the repo is hosted on Github or something more user friendly :-( For future reference, "save the output of 'git diff' to a *.txt file and attach it to an email".