andreyorst / plug.kak

Plugin manager for Kakoune
MIT License
197 stars 18 forks source link

installing from plug-list doesn't respect plugin options #113

Closed mralusw closed 3 years ago

mralusw commented 3 years ago

... for instance, if I install a theme, it gets loaded immediately, even though themes are (rightly) supposed to noload.

This would be rather difficult to solve, as it would involve storing all plug options.

I'd suggest not calling plug_load from plug_install, as it can source a plugin with default parameters incompatible with the user's setup on a re-install (wrong config options, possibly leading to data loss depending on each plugin's initialization code).

Also, the corresponding kak command plug-install should probably expose the noload parameter that the shell plug_install() accepts.

andreyorst commented 3 years ago

This would be rather difficult to solve, as it would involve storing all plug options.

At some point in development, I thought about serializing all options into a single line and inserting it directly to the plug-list buffer. Giving these options a very dim syntax highlighter and essentially making them invisible would allow us to retrieve options from the line and install plugins accordingly. This would be a giant hack though. And it has a problem that it needs line wrapping to be disabled.

Unfortunately, Kakoune doesn't have any kind of associative data structures. It has some str to str map, but it's painful to use from shell and impossible to use from kakscript, so I've dropped the idea completely.

I'd suggest not calling plug_load from plug_install, as it can source a plugin with default parameters incompatible with the user's setup on a re-install (wrong config options, possibly leading to data loss depending on each plugin's initialization code).

Also, the corresponding kak command plug-install should probably expose the noload parameter that the shell plug_install() accepts.

Both are really good points. I'll change the behavior as you suggest.

mralusw commented 3 years ago

Actually, there's still a plug_load() call in plug_install() (which differs from what you wrote above); was this intentional?

andreyorst commented 3 years ago

plug _load should not do anything as I'm passing a noload argument to the plug_install when called from plug_fifo_operate