zsh-users
 help / color / mirror / code / Atom feed
* Somehow my prompt broke in 5.2
@ 2016-01-07  3:36 Jason L Tibbitts III
  2016-01-07  4:44 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Jason L Tibbitts III @ 2016-01-07  3:36 UTC (permalink / raw)
  To: zsh-users

I'm trying to understand why the current directory is missing from my
(left) prompt string in 5.2 but appears just fine in 5.1.1 and earlier.

Here is a minimal .zshrc which shows the problem:

-----
setopt Prompt_Subst
autoload -Uz vcs_info

function precmd {
    vcs_info 'prompt'
}

zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~"

function lprompt {
    local vcs='${vcs_info_msg_1_/$HOME/~}'
    PROMPT="%m:${vcs}> "
}

lprompt
-----

On 5.1.1 I see something like:

  foo:~>

but on 5.2 I just get:

  foo:>

However, if I change lprompt to:

function lprompt {
    PROMPT="%m:${vcs_info_msg_1_/$HOME/~}> "
}
  
(or just dispense with the function and set PROMPT directly) then 5.1.1
behaves the same way as 5.2.  I don't understand what's different about
these two cases.

Now, I can't really recall why I set things up this way; I've had it for
years and obviously copied it from somewhere without really
understanding it and then did my own tweaking over time.  I will work on
another way of doing it, but I'd still like to know what's changed in
5.2 to cause this to stop working.  (I didn't see anything relevant in
the release notes.)

 - J<


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Somehow my prompt broke in 5.2
  2016-01-07  3:36 Somehow my prompt broke in 5.2 Jason L Tibbitts III
@ 2016-01-07  4:44 ` Bart Schaefer
  2016-01-07  6:52   ` Jason L Tibbitts III
  2016-01-10  7:46   ` Sebastian Gniazdowski
  0 siblings, 2 replies; 5+ messages in thread
From: Bart Schaefer @ 2016-01-07  4:44 UTC (permalink / raw)
  To: zsh-users

On Jan 6,  9:36pm, Jason L Tibbitts III wrote:
} Subject: Somehow my prompt broke in 5.2
}
} I'm trying to understand why the current directory is missing from my
} (left) prompt string in 5.2 but appears just fine in 5.1.1 and earlier.

There is a bug in Functions/VCS_Info/VCS_INFO_nvcsformats in the 5.2
release -- a local variable got declared at the wrong scope when the
function was updated.

Delete line 7 ( local -a msgs ) from VCS_INFO_nvcsformats and you
should be good to go.  If you have problems with WARN_CREATE_GLOBAL,
add that same line to Functions/VCS_Info/vcs_info instead.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Somehow my prompt broke in 5.2
  2016-01-07  4:44 ` Bart Schaefer
@ 2016-01-07  6:52   ` Jason L Tibbitts III
  2016-01-10  7:46   ` Sebastian Gniazdowski
  1 sibling, 0 replies; 5+ messages in thread
From: Jason L Tibbitts III @ 2016-01-07  6:52 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

>>>>> "BS" == Bart Schaefer <schaefer@brasslantern.com> writes:

BS> There is a bug in Functions/VCS_Info/VCS_INFO_nvcsformats in the 5.2
BS> release -- a local variable got declared at the wrong scope when the
BS> function was updated.

Oh, cool.  I really couldn't figure out how to dig down that far, and
the fact that something seemed to care about exactly how I expanded
$vcs_info_msg_1_ really had me confused.

BS> Delete line 7 ( local -a msgs ) from VCS_INFO_nvcsformats and you
BS> should be good to go.  If you have problems with WARN_CREATE_GLOBAL,
BS> add that same line to Functions/VCS_Info/vcs_info instead.

I applied this fix and things are working well.  I'll go ahead and push
this to the Fedora package.  (5.2 is only in the development release at
this point.)

Thanks!

 - J<


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Somehow my prompt broke in 5.2
  2016-01-07  4:44 ` Bart Schaefer
  2016-01-07  6:52   ` Jason L Tibbitts III
@ 2016-01-10  7:46   ` Sebastian Gniazdowski
  2016-01-10 20:11     ` Bart Schaefer
  1 sibling, 1 reply; 5+ messages in thread
From: Sebastian Gniazdowski @ 2016-01-10  7:46 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users

On 7 January 2016 at 05:44, Bart Schaefer <schaefer@brasslantern.com> wrote:
> There is a bug in Functions/VCS_Info/VCS_INFO_nvcsformats in the 5.2
> release -- a local variable got declared at the wrong scope when the
> function was updated.
>
> Delete line 7 ( local -a msgs ) from VCS_INFO_nvcsformats and you
> should be good to go.  If you have problems with WARN_CREATE_GLOBAL,
> add that same line to Functions/VCS_Info/vcs_info instead.

Would be cool if this could be somehow workarounded in .zshrc, so that
one can have robust configuration that will work anywhere right after
install. The same I thought about the modification of
_history-complete-older you proposed. But doing what I write is
probably not possible. One could at least add a warning to .zshrc that
would somehow detect if modifications aren't in place for given zsh.

Best regards,
Sebastian Gniazdowski


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Somehow my prompt broke in 5.2
  2016-01-10  7:46   ` Sebastian Gniazdowski
@ 2016-01-10 20:11     ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2016-01-10 20:11 UTC (permalink / raw)
  To: Zsh Users

On Jan 10,  8:46am, Sebastian Gniazdowski wrote:
} Subject: Re: Somehow my prompt broke in 5.2
}
} On 7 January 2016 at 05:44, Bart Schaefer <schaefer@brasslantern.com> wrote:
} >
} > Delete line 7 ( local -a msgs ) from VCS_INFO_nvcsformats and you
} > should be good to go.  If you have problems with WARN_CREATE_GLOBAL,
} > add that same line to Functions/VCS_Info/vcs_info instead.
} 
} Would be cool if this could be somehow workarounded in .zshrc, so that
} one can have robust configuration that will work anywhere right after
} install.

This is the reason for $fpath and for the rigorous adherence to search
order that kept annoying Ray.  You make the fix to the function source,
put it in a directory under $HOME or in some well-known system location,
and make sure that directory appears in $fpath ahead of the standard
directory for the zsh install.

I personally have several such directories named with portions of the
zsh version string and sort fpath so that they're loaded in version
order.  That way I can add new functions at the version where the base
changes they require are present, and they're always in the fpath (just
later on) as new versions of the shell appear.

If you want something that works purely in .zshrc, you can do something
more fragile but along these lines:

autoload +X VCS_INFO_nvcsformats
functions[VCS_INFO_nvcsformats]=${functions[VCS_INFO_nvcsformats]/local -a msgs/}

(not thoroughly tested).

} One could at least add a warning to .zshrc that
} would somehow detect if modifications aren't in place for given zsh.

The problem is that every such modification would require its own bit of
custom test to detect, and some might not be detectable at all except
with user interaction.  Not only is it difficult to maintain all those
tests, it makes shell startup very slow.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-10 20:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07  3:36 Somehow my prompt broke in 5.2 Jason L Tibbitts III
2016-01-07  4:44 ` Bart Schaefer
2016-01-07  6:52   ` Jason L Tibbitts III
2016-01-10  7:46   ` Sebastian Gniazdowski
2016-01-10 20:11     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).