:group 'erc)
;; Defined in erc-backend
+(defvar erc--server-last-reconnect-count)
(defvar erc--server-reconnecting)
(defvar erc-channel-members-changed-hook)
(defvar erc-server-367-functions)
(const :tag "Use current buffer" buffer)
(const :tag "Use current buffer" t)))
+(defcustom erc-reconnect-display nil
+ "How (and whether) to display a channel buffer upon reconnecting.
+
+This only affects automatic reconnections and is ignored when
+issuing a /reconnect command or reinvoking `erc-tls' with the
+same args (assuming success, of course). See `erc-join-buffer'
+for a description of possible values."
+ :package-version '(ERC . "5.4.1") ; FIXME increment upon publishing to ELPA
+ :group 'erc-buffers
+ :type '(choice (const :tag "Use value of `erc-join-buffer'" nil)
+ (const :tag "Split window and select" window)
+ (const :tag "Split window, don't select" window-noselect)
+ (const :tag "New frame" frame)
+ (const :tag "Bury in new buffer" bury)
+ (const :tag "Use current buffer" buffer)))
+
(defcustom erc-frame-alist nil
"Alist of frame parameters for creating erc frames.
A value of nil means to use `default-frame-alist'."
(defun erc-setup-buffer (buffer)
"Consults `erc-join-buffer' to find out how to display `BUFFER'."
- (pcase erc-join-buffer
+ (pcase (if (zerop (erc-with-server-buffer
+ erc--server-last-reconnect-count))
+ erc-join-buffer
+ (or erc-reconnect-display erc-join-buffer))
('window
(if (active-minibuffer-window)
(display-buffer buffer)
(switch-to-buffer (if (get-buffer chnl-name)
chnl-name
(concat chnl-name "/" server)))
+ (setq erc--server-last-reconnect-count 0)
(erc-server-join-channel server chnl key)))))
t)
(nick (car (erc-response.command-args parsed)))
(buffer (process-buffer proc)))
(setq erc-server-connected t)
- (setq erc-server-reconnect-count 0)
+ (setq erc--server-last-reconnect-count erc-server-reconnect-count
+ erc-server-reconnect-count 0)
(erc-update-mode-line)
(erc-set-initial-user-mode nick buffer)
(erc-server-setup-periodical-ping buffer)