84 lines
3.0 KiB
EmacsLisp
84 lines
3.0 KiB
EmacsLisp
;; (C) Copyright Collin J. Doering 2014
|
|
;;
|
|
;; This program is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
;;
|
|
;; This program is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
;;
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
;; File: rcirc.el
|
|
;; Author: Collin J. Doering <collin.doering@rekahsoft.ca>
|
|
;; Date: Oct 22, 2014
|
|
|
|
;; Use rcirc for irc; see: http://www.emacswiki.org/emacs/rcirc *TODO* currently broken
|
|
(require 'rcirc)
|
|
|
|
;; Use rcirc-notify extension; see: http://www.emacswiki.org/emacs/rcircNotify
|
|
(eval-after-load 'rcirc '(require 'rcirc-notify))
|
|
|
|
;; Include date in time stamp.
|
|
(setq rcirc-time-format "%Y-%m-%d %H:%M ")
|
|
|
|
;; Change user info
|
|
(setq rcirc-default-nick "rekahsoft"
|
|
rcirc-default-user-name "rekahsoft"
|
|
rcirc-default-full-name "rekahsoft"
|
|
rcirc-log-flag t
|
|
rcirc-log-directory "~/.emacs.d/rcirc-log")
|
|
|
|
(setq rcirc-server-alist
|
|
'(("irc.freenode.net" :port 6697 :encryption tls
|
|
:channels ("#emacs" "#haskell" "#racket" "#xmonad"))
|
|
("localhost" :port 6667 :channels ())))
|
|
|
|
;; Turn on rcirc tracking to be displayed in mode-line
|
|
(rcirc-track-minor-mode)
|
|
|
|
;; Thanks to: http://www.emacswiki.org/emacs/rcircReconnect
|
|
(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))))
|
|
|
|
;; Thanks to: http://www.emacswiki.org/emacs/rcircAll
|
|
(eval-after-load 'rcirc
|
|
'(defun-rcirc-command all (input)
|
|
"Run the arguments as a command for all connections.
|
|
Example use: /all away food or /all quit zzzz."
|
|
(interactive "s")
|
|
(let ((buffers (mapcar 'process-buffer (rcirc-process-list))))
|
|
(dolist (buf buffers)
|
|
(with-current-buffer buf
|
|
(goto-char (point-max))
|
|
(insert "/" input)
|
|
(rcirc-send-input))))))
|
|
|
|
;; Connect to servers auto-matically if in daemon-mode
|
|
(if (daemonp) (rcirc nil))
|