Refactor autoload: Split the big function into two smaller ones,
doing only option parsing at main function.
The algorithm is also rewritten, now in two steps for both path
inclusion an exclusion functions: 1) use auxiliary lists to store
valid function and completion paths, 2) bulk insert or remove just
once in the variable.
Now also respects path insertion policy, keeping user function
path always in front of other paths, thus allowing precedence of
user functions.