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

Neomake configure commands don't work when using vim's native package loading #2482

Open
tompreston opened this issue Apr 24, 2020 · 4 comments

Comments

@tompreston
Copy link

tompreston commented Apr 24, 2020

I am using vim/neovim's native package loading. Does this require any extra steps to get neomake#configure commands working?

This issue appears to be similar, but I have no idea how it was solved.

Expected behavior

When I add the following line to init.vim, I expect neovim to start without an error and the Neomake command to run on save, but it doesn't.

call neomake#configure#automake('w')

I see the following error on startup:

E117: Unknown function: neomake#configure#automake

Without the neomake#configure#automake('w') command, neovim starts and I can run :Neomake manually with some success (the log window hangs and I have to press enter before it shows me any linting).

Steps to reproduce

git clone https://github.com/neomake/neomake.git ~/.local/share/nvim/site/pack/tpreston/start/neomake
echo "call neomake#configure#automake('w')" >> ~/.config/nvim/init.vim
nvim

The only line I see in /tmp/neomake.log is this when I close neovim:

08:36:07 893273 [D      ] Calling VimLeave.

When I use the minimal.init.vim, there are no errors (expected - this issue only appears when I add config) and nothing appears in /tmp/neomake.log.

I'm running Fedora 31, NVIM v0.4.3. I can reproduce with the following container:

FROM fedora:31
RUN dnf install -y git neovim

ARG NVIM_PDIR=/root/.local/share/nvim/site/pack/root/start
ARG NVIM_CDIR=/root/.config/nvim

RUN mkdir -p "${NVIM_PDIR}" "${NVIM_CDIR}"
RUN git clone https://github.com/neomake/neomake.git "${NVIM_PDIR}/neomake"
RUN echo "call neomake#configure#automake('w')" \
        >> "${NVIM_CDIR}/init.vim"

CMD nvim
cp Dockerfile /tmp/neomake/Dockerfile
podman build -t tpreston/test-nvim /tmp/neomake
podman run -it tpreston/test-nvim

Then neovim opens with E117: Unknown function: neomake#configure#automake.

Output from :NeomakeInfo

#### Neomake debug information

Async support: 1
Current filetype: 
Windows: 0
[shell, shellcmdflag, shellslash]: ['/bin/bash', '-c', 0]
makeprg=make

##### Enabled makers

For the current filetype ("", used with :Neomake):
None.
NOTE: the current buffer does not have a filetype.

For the project (used with :Neomake!):
 - makeprg
   - append_file: 0
   - args: []
   - auto_enabled: 1
   - errorformat: '%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory %*[`'']%f'',%X%*\a[%*\d]: Leaving directory %*[`'']%f'',%D%*\a: Entering directory %*[`'']%f'',%X%*\a: Leaving directory %*[`'']%f'',%DMaking %*\a in %f,%f|%l| %m'
   - exe: 'make'
   - version information (/usr/bin/make --version): GNU Make 4.2.1
     Built for x86_64-redhat-linux-gnu
     Copyright (C) 1988-2016 Free Software Foundation, Inc.
     License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
     This is free software: you are free to change and redistribute it.
     There is NO WARRANTY, to the extent permitted by law.
NOTE: you can define g:neomake_enabled_makers to configure it.

Default maker settings:
 - output_stream: 'both'
 - remove_invalid_entries: 0
 - buffer_output: 1

##### Settings

###### New-style (dict, overrides old-style)

```
g:neomake: unset
b:neomake: unset
```

###### Old-style

```
g:neomake_place_signs = 1

```


#### :version

```
NVIM v0.4.3
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=1 -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/builddir/build/BUILD/neovim-0.4.3/build/config -I/builddir/build/BUILD/neovim-0.4.3/src -I/usr/include -I/usr/include/lua-5.1 -I/builddir/build/BUILD/neovim-0.4.3/build/src/nvim/auto -I/builddir/build/BUILD/neovim-0.4.3/build/include
Compiled by mockbuild

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
```

#### :messages

```
Error detected while processing /home/tpreston/.dotfiles/config/nvim/init.vim:
line   52:
E117: Unknown function: neomake#configure#automake
```
@tompreston
Copy link
Author

It looks like the neomake#configure#automake function is defined in autoload/neomake/configure.vim, but this doesn't appear when I run :scriptnames in neovim. Maybe this has something to do with it?

@eddyecho
Copy link

This works for me. It appears that vimrc is sourced before neomake's autoload/neomake/configure.vim is sourced.
autocmd VimEnter * call neomake#configure#automake('w')

@mf-fx
Copy link

mf-fx commented Feb 18, 2021

Had the same issue, @eddyecho 's workaround works for me, as did running it manually from within vim,
so yes, it seems to be an order/timing issue?

@AdrienGiboire
Copy link

April 2022, got the same issue. @eddyecho workaround works for me as well.

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

4 participants