kakounedotcom / connect.kak

Connect a program to Kakoune clients

Home Page:https://kakoune.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

module already defined errors

vbauerster opened this issue · comments

I source connect via plug like:

plug "alexherbo2/connect.kak" config %{
    map global normal <c-t> ': connect-terminal<ret>'
    require-module connect-fzy
    require-module connect-lf
    require-module connect-nnn
}

and having following errors:

*** This is the debug buffer, where debug info will be written ***
/Users/vbauer/.config/kak/plugins/plug.kak/..//connect.kak/rc/connect/modules/fifo/fifo.kak:1:1: 'provide-module' module 'connect-fifo' already defined
plug.kak: Error occured while loading 'alexherbo2/connect.kak' plugin:
          2:5: 'evaluate-commands' 25:1: 'source' 1:1: 'provide-module' module 'connect-fifo' already defined
plug.kak: Error occured while loading 'alexherbo2/explore.kak' plugin:
          2:5: 'evaluate-commands' 9:1: 'evaluate-commands' 3:5: 'alias' no such command: 'fzy-files'
/Users/vbauer/.config/kak/plugins/plug.kak/..//snippets.kak/rc/modules/scss.kak:4:1: 'provide-module' module 'snippets-scss' already defined
plug.kak: Error occured while loading 'alexherbo2/snippets.kak' plugin:
          2:5: 'evaluate-commands' 6:1: 'source' 4:1: 'provide-module' module 'snippets-scss' already defined

Looks like there is some kind of dependency cycle.
Is it problem of plug?

See the example 4 and example configuration.

You can try interactively :connect-require ▌ and see the modules being completed.

The issue looks to be plug.kak sourcing recursively all .kak files, including the modules. The connect-require sources and requires only the given modules, and by default connect.kak does a connect-require fifo. I think we do that, and plug.kak sources the fifo.kak module after, hence the errors.

@vbauerster I have a fix, but it will impact all the plugins.

I managed to fix by loading my plugins manually.

All plugins have been updated and do not require-module or enable functionalities on their own.

Here is an example of my kakrc:

# Require modules
require-module auto-pairs
require-module batch
require-module bc
require-module capitalize-selections
require-module change-directory
require-module chronic
require-module connect
require-module connect-broot
require-module connect-dmenu
require-module connect-dolphin
require-module connect-fzf
require-module connect-fzy
require-module connect-lf
require-module connect-nnn
require-module connect-rofi
require-module connect-wofi
require-module current-word-highlighter
require-module explore-buffers
require-module explore-files
require-module jq
require-module manual-indent
require-module mkdir
require-module move-line
require-module objectify
require-module out-of-view
require-module pad-number
require-module palette
require-module phantom
require-module prelude
require-module rails
require-module search-highlighter
require-module snippets
require-module split-object
require-module surround
require-module terminal-mode
require-module text-objects
require-module toggle-highlighter
require-module type-expand
require-module volatile-highlighter
require-module word-select
require-module yank-ring
require-module yank-ring-connect

# Enable plugins
auto-pairs-enable
current-word-highlighter-enable
explore-buffers-enable
explore-files-enable
out-of-view-enable
palette-enable
phantom-enable
rails-detect
search-highlighter-enable
snippets-enable
volatile-highlighter-enable
yank-ring-enable