]> git.eshelyaron.com Git - emacs.git/commitdiff
Display server buffer after connecting
authorPhilip Kaludercic <philipk@posteo.net>
Tue, 14 Sep 2021 17:07:18 +0000 (19:07 +0200)
committerPhilip Kaludercic <philipk@posteo.net>
Tue, 14 Sep 2021 17:07:18 +0000 (19:07 +0200)
* rcirc.el (rcirc-display-server-buffer): Add new option
(rcirc): Respect rcirc-display-server-buffer

lisp/net/rcirc.el

index 6c669564209cbd876fcba95eea080a39a0e47875..579a350c6a1cd7c8e3f07d93aeec70506d6044ad 100644 (file)
@@ -419,6 +419,11 @@ will be killed."
   :version "28.1"
   :type 'boolean)
 
+(defcustom rcirc-display-server-buffer t
+  "Non-nil means the server buffer should be shown on connecting."
+  :version "28.1"
+  :type 'boolean)
+
 (defvar-local rcirc-nick nil
   "The nickname used for the current connection.")
 
@@ -518,10 +523,12 @@ If ARG is non-nil, instead prompt for connection parameters."
                                                           :channels)
                                                " "))
                        "[, ]+" t))
-             (encryption (rcirc-prompt-for-encryption server-plist)))
-       (rcirc-connect server port nick user-name
-                      rcirc-default-full-name
-                      channels password encryption))
+             (encryption (rcirc-prompt-for-encryption server-plist))
+             (process (rcirc-connect server port nick user-name
+                                    rcirc-default-full-name
+                                    channels password encryption)))
+       (when rcirc-display-server-buffer
+          (pop-to-buffer-same-window (process-buffer process))))
     ;; connect to servers in `rcirc-server-alist'
     (let (connected-servers)
       (dolist (c rcirc-server-alist)
@@ -550,9 +557,11 @@ If ARG is non-nil, instead prompt for connection parameters."
                  (setq connected p)))
              (if (not connected)
                  (condition-case nil
-                     (rcirc-connect server port nick user-name
-                                     full-name channels password encryption
-                                     server-alias)
+                     (let ((process (rcirc-connect server port nick user-name
+                                                    full-name channels password encryption
+                                                    server-alias)))
+                        (when rcirc-display-server-buffer
+                          (pop-to-buffer-same-window (process-buffer process))))
                    (quit (message "Quit connecting to %s"
                                    (or server-alias server))))
                (with-current-buffer (process-buffer connected)