* lisp/erc/erc.el (erc-generate-new-buffer-name): Fixes behavior 1,
also determines if the '#channel/server' buffer already exists
and will reuse that buffer when joining on the same
server. Additionally when creating a new buffer with
'#channel/serverB', the existing buffer '#channel' on 'severA' will be
renamed to '#channel/serverA' for the sake of consistency (bug#40121).
* lisp/erc/erc-join.el (erc-autojoin-channels): The logic is
simplified ensuring that when autojoining channels specified in
erc-autojoin-channels-alist, if there exists an erc buffer with the
same channel name but a different server, it will create a new buffer
to join the channel. The current logic is very weak that will skip
joining same channel on different servers altogether.
By the definition of erc-reuse-buffers, if non-nil it should create a
new buffer when joining channels with same names on different
servers. The current behavior of erc-reuse-buffers is:
1. when non-nil, it will always reuse the same channel buffer,
resulting in server A's channel gets reconnected to the channel with
the same name of server B.
2. when nil, the buffer-name of the joined channel is
'#channel/server'. However if one tries to '/join #channel' from the
server buffer, it creates a new empty buffer with buffer-name
'#channel', instead of opening the already-joined channel buffer.