tpope / vim-projectionist

projectionist.vim: Granular project configuration
https://www.vim.org/scripts/script.php?script_id=4989
1.06k stars 67 forks source link

Multiple load of autoload scripts #169

Closed am1re closed 2 years ago

am1re commented 2 years ago

As we discussed this issue https://github.com/lambdalisue/fern.vim/issues/407 on lambdalisue/fern.vim side, several points were made:

  1. Vim won't load a script file for autoload twice https://github.com/lambdalisue/fern.vim/issues/407#issuecomment-1080786091
  2. https://github.com/tpope/vim-projectionist/blob/93b2af188fe0937edea414b8e05a362b74f4b31d/plugin/projectionist.vim#L40 This line runs autoload script again which is unexpected behaviour https://github.com/lambdalisue/fern.vim/issues/407#issuecomment-1080812934

This causes lambdalisue/fern.vim plugin to behave unexpectedly as described here https://github.com/lambdalisue/fern.vim/issues/407

tpope commented 2 years ago

The issue is:

  1. exists('*some#function') will return false if autoload/some.vim hasn't been sourced.
  2. there's no way to tell if autoload/some.vim has been previously sourced.

https://github.com/lambdalisue/fern.vim/commit/93d34cc78b77a890ed31440a2572016993a2ecd7 appears to have fixed this in practice in the short-term. In the long-term I can probably migrate to an alternative that doesn't rely on autoload functions at all.

am1re commented 2 years ago

Thank you for the fast response 😊 Unfortunately those changes https://github.com/lambdalisue/fern.vim/commit/93d34cc78b77a890ed31440a2572016993a2ecd7 just affected error message and didnt resolve the issue as @lambdalisue said https://github.com/lambdalisue/fern.vim/issues/407#issuecomment-1080800398

tpope commented 2 years ago

Okay, failed to reproduce myself, but that could be some load order thing.