vaffle.vim icon indicating copy to clipboard operation
vaffle.vim copied to clipboard

Vaffle and projectionist interfere with one another

Open WhoIsSethDaniel opened this issue 4 years ago • 6 comments

WhoIsSethDaniel avatar Oct 01 '20 04:10 WhoIsSethDaniel

I use the projectionist vim plugin (https://github.com/tpope/vim-projectionist). When I attempt to use :Vaffle an exception occurs:

Error detected while processing function vaffle#init[45]..function vaffle#init[39]..vaffle#buffer#init[3]..BufFilePost Autocommands for "*"..function ProjectionistDetect[14]..<SNR>50_load[2]..script /home/seth/.vim/pack/git-plugins
/opt/vaffle.vim/autoload/vaffle.vim:
line  123:
E127: Cannot redefine function vaffle#init: It is in use

When in autoload/vaffle/buffer.vim the 'file' command is used to rename the buffer this triggers an autocommand in projectionist that attempts to detect the type of the buffer. Beyond that I'm unclear on exactly what is happening. I will continue to look at it but I don't know that I'll resolve this issue on my own.

To replicate simply install projectionist and attempt to run Vaffle.

WhoIsSethDaniel avatar Oct 01 '20 04:10 WhoIsSethDaniel

The most radical change that will work is to use 'noautocmd' for the line that runs 'file'. This seems like using a nuclear bomb to kill a fly.

autoload/vaffle/buffer.vim:

 execute printf('silent noautocmd keepalt file %s',
        \ s:generate_unique_bufname(a:filer.dir))

WhoIsSethDaniel avatar Oct 01 '20 04:10 WhoIsSethDaniel

I can

let g:projectionist_ignore_vaffle = 1

in my config and this will ignore anything with the namespace 'vaffle'. This appears to be undocumented but is in the projectionist code. It also keeps projectionist and vaffle from interfering with one another.

WhoIsSethDaniel avatar Oct 01 '20 05:10 WhoIsSethDaniel

The actual cause of the problem appears to be projectionist attempting to execute "runtime! autoload/vaffle.vim" from within s:load() in the plugin/projectionist.vim code. I haven't wrapped my head around all that projectionist is doing. For now I think I'm going to just do the thing I mention in the above comment.

WhoIsSethDaniel avatar Oct 01 '20 05:10 WhoIsSethDaniel

@WhoIsSethDaniel does using let g:projectionist_ignore_vaffle = 1 causes any issue or disables any feature? I too am facing the same issue and applied the fix you suggested.

ajitid avatar Apr 27 '21 21:04 ajitid

@WhoIsSethDaniel does using let g:projectionist_ignore_vaffle = 1 causes any issue or disables any feature? I too am facing the same issue and applied the fix you suggested.

I've been using it without issue for months. Doesn't remove any features as far as I can tell.

WhoIsSethDaniel avatar Apr 27 '21 21:04 WhoIsSethDaniel