Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec_time doesn't show in prompt #278

Closed
barnsza opened this issue Oct 21, 2019 · 2 comments
Closed

exec_time doesn't show in prompt #278

barnsza opened this issue Oct 21, 2019 · 2 comments
Assignees

Comments

@barnsza
Copy link

barnsza commented Oct 21, 2019

I've just started using geometry against the mnml branch and have found that even with geometry_exec_time in a prompt, it doesn't actually show for long running commands.

I don't know much about the internals of ZSH, but I think I've narrowed it down to the fact that the time_command_begin function doesn't fire (the preexec hook doesn't seem to load it). Further testing leads me to believe that this is caused by #273 because if I copy the appropriate few lines from the function file into geometry.zsh, it works.

@alxbl
Copy link
Collaborator

alxbl commented Oct 21, 2019

It's caused by the autoload -Uk flag which we opted for instead of the changes in #273. Since all ZSH hooks are evaluated in subshells due to the lazy loading, the top-level shell will never initialize the hooks. We're discussing in #272, and I think we're likely to revert the lazy loading for now until we can find a working approach to do it. For now you can change the line autoload -Uk $fun in geometry.zsh back to . $fun for a temporary fix... here's the diff:

diff --git a/geometry.zsh b/geometry.zsh
index dc4942d..f1f066d 100644
--- a/geometry.zsh
+++ b/geometry.zsh
@@ -12,7 +12,7 @@ typeset -gA GEOMETRY; GEOMETRY[ROOT]=${0:A:h}

 autoload -U add-zsh-hook

-function { local fun; for fun ("${GEOMETRY[ROOT]}"/functions/*) autoload -Uk $fun }
+function { local fun; for fun ("${GEOMETRY[ROOT]}"/functions/*) . $fun }

 (( $+functions[ansi] )) || ansi() { (($# - 2)) || echo -n "%F{$1}$2%f"; }

Sorry for the inconvenience. The changes will most likely be pushed today.

@jedahan
Copy link
Member

jedahan commented Oct 21, 2019

yeah we should switch back from lazy loading, I thought I tested exec_time but I guess I didn't.

Thanks for the report @barnsza and sorry for breaking it!

@alxbl alxbl self-assigned this Oct 21, 2019
@alxbl alxbl closed this as completed in 23dbb17 Oct 21, 2019
alxbl added a commit that referenced this issue Oct 21, 2019
fix: Reverted lazy loading for now. Closes #278.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants