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

Already on GitHub? Sign in to your account

add-zsh-hook: function definition file not found #748

Closed
wazum opened this Issue Dec 16, 2011 · 30 comments

Comments

Projects
None yet

wazum commented Dec 16, 2011

hiya!
after the last update I get

/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found

kind regards
Wolfgang

oshovah commented Dec 21, 2011

Same here

It seems add-zsh-hook was added since version 4.3.4. So, I am planning to upgrade zsh here.

Contributor

tjkirch commented Jan 9, 2012

Same problem here with zsh 4.2.6. Unfortunately I can't upgrade the version on some hosts I use.

robraux commented Jan 11, 2012

I have the same issue, and didn't have any problem with reverting the file back to it's original version (at least none that I am aware of after using it for a few hours).

https://github.com/robbyrussell/oh-my-zsh/blob/e3cede37a0ac1ef427fb07b6f79839b8c6a64780/lib/termsupport.zsh

iveney commented Feb 17, 2012

Same here with zsh 4.3.10. This should be fixed as the zsh is still old version in many of the servers.

febs commented Feb 29, 2012

Agree.

zalew commented Mar 1, 2012

same here. le fu.

@sorin-ionescu fork also doesn't solve it on 4.3.2

Contributor

sorin-ionescu commented Mar 1, 2012

@zalew How can my fork solve it when the minimum supported version of OMZ is 4.3.10?

zalew commented Mar 1, 2012

because you mentioned this issue in your comment as fixed. "The following issues have been fixed in my fork. [...] #748" so I assumed you did the backward compatibility or sth. sorry.

Contributor

sorin-ionescu commented Mar 1, 2012

My comment was in reference to failing to load the hook, not on the hook missing at all.

Same issue here on Centos

yeah, same here with 4.2.6 on CentOS. Would be great if this would be fixed...

Same here on SmartOS: http://smartos.org/

SunOS b3ac5f25-22a4-41d3-87c8-d0a60456be5f.local 5.11 joyent_20130405T010449Z i86pc i386 i86pc Solaris

/root/.oh-my-zsh/lib/termsupport.zsh:34: add-zsh-hook: function definition file not found
/root/.oh-my-zsh/lib/termsupport.zsh:35: add-zsh-hook: function definition file not found

adamatan commented May 7, 2013

Same on rhel6:

/home/adamatan/.oh-my-zsh/lib/termsupport.zsh:34: add-zsh-hook: function definition file not found
/home/adamatan/.oh-my-zsh/lib/termsupport.zsh:35: add-zsh-hook: function definition file not found

Conxz commented May 14, 2013

Same on CentOS 5.7
add-zsh-hook: function definition file not found

Janfy commented Jul 12, 2013

Same on RHEL 5.5 / ZSH 4.2.6

Getting the same error using zsh 4.3.12

Getting the same error on a brand new install on CentOS 5.9:

.oh-my-zsh/lib/termsupport.zsh:36: add-zsh-hook: function definition file not found
.oh-my-zsh/lib/termsupport.zsh:37: add-zsh-hook: function definition file not found

On RHEL 5, just installed. When opening a terminal I get

~/.oh-my-zsh/lib/termsupport.zsh:36: add-zsh-hook: function definition file not found
~/.oh-my-zsh/lib/termsupport.zsh:37: add-zsh-hook: function definition file not found

ZSH version
zsh 4.3.12 (x86_64-unknown-linux-gnu)

Collaborator

mcornella commented Mar 17, 2014

According to zsh's git repository, add-zsh-hook was added in version 4.3.4, all subsequent versions should work fine. If that's not your case drop me a hint.

For the rest, I think you should be able to add a hook without that function. Replace these lines in lib/termsupport.zsh

autoload -U add-zsh-hook
add-zsh-hook precmd  omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec

with these lines:

precmd_functions+=(omz_termsupport_precmd)
preexec_functions+=(omz_termsupport_preexec)

If that works and doesn't break anything I'll submit a PR.

@robbyrussell robbyrussell added the Bug label Mar 22, 2014

mztriz commented Apr 24, 2014

Same issue with RHEL 5.6
myserver~ # zsh --version
zsh --version
zsh 4.2.6 (x86_64-redhat-linux-gnu)

@mcornella adding those lines has appeared to fix it.

rfoust commented Apr 25, 2014

@mcornella - that seemed to fix the error for me, thanks.

Collaborator

mcornella commented Apr 25, 2014

Cool! Still, there are other plugins that rely on add-zsh-hook too, I'll make sure all of them are compatible in this case.

precmd_functions+=(omz_termsupport_precmd)
preexec_functions+=(omz_termsupport_preexec)

works

@zimbatm zimbatm referenced this issue in direnv/direnv Aug 5, 2014

Closed

Use add-zsh-hook #138

Contributor

jingweno commented Aug 21, 2014

I just hit this issue with RHEL 5:

~  zsh --version
zsh 4.2.6 (x86_64-redhat-linux-gnu)

I follow the fixes by @mcornella and it werks. But this cause local changes and blocks upgrade_oh_my_zsh. Should it be patched into master? I could help.

@jingweno jingweno added a commit to jingweno/oh-my-zsh that referenced this issue Aug 22, 2014

@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
dc9e176

@merwan merwan pushed a commit to merwan/oh-my-zsh that referenced this issue Sep 1, 2014

Merouane Atig Fix the "command not found: add-zsh-hook" error
Apply the same fix as for #748
adb9c3f

@harlanji harlanji added a commit to harlanji/oh-my-zsh that referenced this issue Sep 1, 2014

@jingweno @harlanji jingweno + harlanji Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
d84a647

zztczcx commented Sep 3, 2014

Replace these lines in lib/termsupport.zsh

autoload -U add-zsh-hook
add-zsh-hook precmd omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec
with these lines:

precmd_functions+=(omz_termsupport_precmd)
preexec_functions+=(omz_termsupport_preexec)

it make some theme donot work , for example : pygmalion. I think not replace just add it below, is ok

diraulo commented Sep 4, 2014

Also had the same issue as @zztczcx with the pygmalion theme. Added those lines back and it fixed it.

Contributor

jingweno commented Sep 4, 2014

@zztczcx @diraulo Are there any other solutions other than using add-zsh-hook?

@hoggarth hoggarth added a commit to hoggarth/oh-my-zsh that referenced this issue Sep 4, 2014

@jingweno @hoggarth jingweno + hoggarth Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
8379783

@swanandp swanandp added a commit to swanandp/oh-my-zsh that referenced this issue Sep 15, 2014

@jingweno @swanandp jingweno + swanandp Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
e84c6eb

@ArjenSchwarz ArjenSchwarz added a commit to ArjenSchwarz/oh-my-zsh that referenced this issue Sep 16, 2014

@jingweno @ArjenSchwarz jingweno + ArjenSchwarz Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
c636fd2

@Stibbons Stibbons added a commit to Stibbons/oh-my-zsh that referenced this issue Sep 17, 2014

@jingweno @Stibbons jingweno + Stibbons Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
c6f46c2

@lewg lewg added a commit to lewg/oh-my-zsh that referenced this issue Sep 17, 2014

@jingweno @lewg jingweno + lewg Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
183d323

@pangliang pangliang pushed a commit to pangliang/oh-my-zsh that referenced this issue Oct 13, 2014

@jingweno jingweno Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
585d2eb

@noj noj added a commit to noj/oh-my-zsh that referenced this issue Nov 4, 2014

@jingweno @noj jingweno + noj Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
d185e38

@benjaoming benjaoming added a commit to benjaoming/oh-my-zsh that referenced this issue Nov 28, 2014

@jingweno @benjaoming jingweno + benjaoming Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
82def2e

@devnall devnall pushed a commit to devnall/oh-my-zsh that referenced this issue Dec 9, 2014

@jingweno jingweno + Drew Nall Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
4f86b7e

@kenton kenton added a commit to kenton/oh-my-zsh that referenced this issue Jan 9, 2015

@jingweno @kenton jingweno + kenton Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
f0fd4a6

@kiwiupover kiwiupover pushed a commit to kiwiupover/dot-files that referenced this issue Jan 23, 2015

@jingweno jingweno + Dave Laird Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell/oh-my-zsh#748. This patch pulls in the changes suggested in robbyrussell/oh-my-zsh#748 (comment) by @mcornella and I have tested it on RHEL 5.
b3eef4a

@hbpoison hbpoison added a commit to hbpoison/oh-my-zsh that referenced this issue Aug 14, 2015

@jingweno @hbpoison jingweno + hbpoison Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
5f3a1cb

@NobbZ NobbZ added a commit to NobbZ/oh-my-zsh that referenced this issue May 15, 2016

@jingweno @NobbZ jingweno + NobbZ Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See robbyrussell#748. This patch pulls in the changes suggested in robbyrussell#748 (comment) by @mcornella and I have tested it on RHEL 5.
b5607b3

@ericlake ericlake pushed a commit to ericlake/oh-my-zsh that referenced this issue Feb 13, 2017

@sorin-ionescu sorin-ionescu [Fix #748] Set grep color for BSD and GNU ba351df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment