about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <vincent@spotify.com>2013-07-08T14·55+0200
committerVincent Ambo <vincent@spotify.com>2013-07-08T14·55+0200
commit0ebbf64fd1e42e69de29d5d49ffcedbf110c83dd (patch)
tree2faebec792fe1a5168f560f21eec184b7bf59258
parent74d252df97ccee6b407aa79d0d763090346b3b14 (diff)
Emacs: Added a function to reconnect rcirc
-rw-r--r--emacs.d/init-functions.el25
-rw-r--r--fish/config.fish1
2 files changed, 25 insertions, 1 deletions
diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el
index de68ab71f546..3572cca69b7a 100644
--- a/emacs.d/init-functions.el
+++ b/emacs.d/init-functions.el
@@ -63,3 +63,28 @@
     (insert prefix)
     (dotimes (_ (- 80 col (length prefix) (length postfix))) (insert "u"))
     (insert postfix)))
+
+;; Reconnect rcirc
+(eval-after-load 'rcirc
+  '(defun-rcirc-command reconnect (arg)
+     "Reconnect the server process."
+     (interactive "i")
+     (unless process
+       (error "There's no process for this target"))
+     (let* ((server (car (process-contact process)))
+            (port (process-contact process :service))
+            (nick (rcirc-nick process))
+            channels query-buffers)
+       (dolist (buf (buffer-list))
+         (with-current-buffer buf
+           (when (eq process (rcirc-buffer-process))
+             (remove-hook 'change-major-mode-hook
+                          'rcirc-change-major-mode-hook)
+             (if (rcirc-channel-p rcirc-target)
+                 (setq channels (cons rcirc-target channels))
+               (setq query-buffers (cons buf query-buffers))))))
+       (delete-process process)
+       (rcirc-connect server port nick
+                      rcirc-default-user-name
+                      rcirc-default-full-name
+                      channels))))
diff --git a/fish/config.fish b/fish/config.fish
index bc816eb627eb..b47d60adb4c4 100644
--- a/fish/config.fish
+++ b/fish/config.fish
@@ -13,7 +13,6 @@ function fish_right_prompt
    set_color --bold yellow
    echo -n ']'
 end
-   
 
 set -gx EDITOR emacsclient
 set -gx ALTERNATE_EDITOR emacs