2015-11-25 23:33:55 +00:00
|
|
|
;;;; IRC packages config
|
2015-11-24 21:12:10 +00:00
|
|
|
|
2016-09-26 15:04:09 +00:00
|
|
|
(setq erc-autojoin-channels-alist
|
|
|
|
'(("freenode"
|
|
|
|
;; "#emacs"
|
|
|
|
"##emacs.de"
|
|
|
|
"#lilypond"
|
|
|
|
;; "#lisp"
|
|
|
|
;; "#lispgames"
|
|
|
|
;; "#scheme"
|
|
|
|
|
|
|
|
"#opensourcemusicians"
|
2016-06-12 04:35:19 +00:00
|
|
|
|
2016-09-28 11:55:09 +00:00
|
|
|
"##privacy"
|
|
|
|
|
2016-09-26 15:04:09 +00:00
|
|
|
"##classical"
|
|
|
|
"##guitar"
|
|
|
|
;; "#music-theory"
|
|
|
|
;; "##piano"
|
2016-06-12 04:35:19 +00:00
|
|
|
|
2016-09-26 15:04:09 +00:00
|
|
|
"##hindi"
|
|
|
|
;; "##italiano"
|
|
|
|
"##deutsch"
|
2016-06-12 04:35:19 +00:00
|
|
|
|
2016-09-26 15:04:09 +00:00
|
|
|
"#VelvetAndLace")
|
|
|
|
("oftc" "#debian-next")))
|
2016-06-12 04:35:19 +00:00
|
|
|
|
2016-09-26 15:04:09 +00:00
|
|
|
(with-eval-after-load 'erc
|
2016-09-28 12:51:58 +00:00
|
|
|
(defun cp-erc-generate-log-file-name (buffer target nick server port)
|
|
|
|
"Generates a log-file name using only the channel and network
|
|
|
|
names rather than server name. This results in a file name of the
|
|
|
|
form irc.NETWORK.#CHANNEL.erclog. This function is a possible
|
|
|
|
value for `erc-generate-log-file-name-function'."
|
|
|
|
(require 'erc-networks)
|
|
|
|
(let ((file (concat
|
|
|
|
(erc-compute-server)
|
|
|
|
;; "irc."
|
|
|
|
;; (or (with-current-buffer buffer (erc-network-name)) server)
|
|
|
|
;; (if target (concat target "!"))
|
|
|
|
"."
|
|
|
|
target
|
|
|
|
".erclog")))
|
|
|
|
;; we need a make-safe-file-name function.
|
|
|
|
(convert-standard-filename file)))
|
|
|
|
|
2016-09-26 15:04:09 +00:00
|
|
|
(setq ;; erc-default-coding-system 'utf-8
|
2016-06-13 17:24:57 +00:00
|
|
|
erc-password "trololo_trololo"
|
|
|
|
erc-fill-mode nil
|
2016-06-12 04:35:19 +00:00
|
|
|
|
2016-09-28 12:51:58 +00:00
|
|
|
erc-generate-log-file-name-function 'cp-erc-generate-log-file-name
|
|
|
|
;; erc-generate-log-file-name-function 'erc-generate-log-file-name-network
|
2016-06-13 17:24:57 +00:00
|
|
|
erc-log-channels-directory "~/.emacs.d/erc/logs/"
|
|
|
|
erc-log-mode t
|
|
|
|
erc-save-buffer-on-part nil
|
|
|
|
erc-save-queries-on-quit nil
|
|
|
|
erc-log-write-after-send t
|
|
|
|
erc-log-write-after-insert t
|
2016-06-12 04:35:19 +00:00
|
|
|
|
2016-06-13 17:24:57 +00:00
|
|
|
erc-modules '(autojoin completion list log menu ring stamp ercn
|
|
|
|
netsplit button match track readonly networks noncommands
|
|
|
|
irccontrols move-to-prompt)
|
|
|
|
erc-nick '("contrapunctus"
|
|
|
|
"HisaoNakai"
|
|
|
|
"[Batou]"
|
|
|
|
"[Togusa]"
|
|
|
|
"[2501]")
|
|
|
|
erc-stamp-mode t
|
|
|
|
erc-timestamp-format-left "[%FT%T%z]
|
2015-11-25 22:35:35 +00:00
|
|
|
"
|
2016-06-13 17:24:57 +00:00
|
|
|
erc-timestamp-format-right nil
|
|
|
|
erc-join-buffer 'bury
|
|
|
|
erc-fools '("c-c@" "Kimryd" "csmr"))
|
|
|
|
|
|
|
|
(define-key erc-mode-map (kbd "C-c C-c") nil)
|
|
|
|
(add-hook 'erc-mode-hook 'erc-fill-disable)
|
|
|
|
(add-hook 'erc-mode-hook (lambda () (setq erc-ignore-list '("*!csmr@kapsi.fi")))))
|
|
|
|
|
|
|
|
(autoload 'erc "erc" "ERC." t)
|
2016-09-28 13:31:27 +00:00
|
|
|
;; erc-server-buffer-p is the first ERC function called by
|
|
|
|
;; cp-erc-freenode, which is what I use to start ERC
|
|
|
|
(autoload 'erc-server-buffer-p "erc" "ERC." t)
|
2016-06-12 04:35:19 +00:00
|
|
|
|
2016-09-28 13:31:27 +00:00
|
|
|
;; (let ((results (remove-if-not (lambda (a)
|
|
|
|
;; (string-match regexp a))
|
|
|
|
;; (mapcar #'buffer-name (buffer-list)))))
|
|
|
|
;; (if all results (car results)))
|
|
|
|
;; (defun cp-erc-server-buffer ()
|
|
|
|
;; (cp-get-buffer-regexp "^irc"))
|
|
|
|
|
|
|
|
(defun cp-erc-server-buffer (&optional all)
|
|
|
|
(let ((results (remove-if-not #'erc-server-buffer-p
|
|
|
|
(buffer-list))))
|
|
|
|
(if all results (car results))))
|
2015-11-26 23:33:07 +00:00
|
|
|
(defun cp-erc-freenode ()
|
|
|
|
(interactive)
|
2016-09-28 13:31:27 +00:00
|
|
|
(let ((bufname (cp-erc-server-buffer)))
|
2015-11-26 23:33:07 +00:00
|
|
|
(if bufname
|
|
|
|
(switch-to-buffer bufname)
|
|
|
|
(erc :server "irc.freenode.net"
|
|
|
|
:nick "contrapunctus"
|
|
|
|
:password "trololo_trololo"))))
|
|
|
|
(defun cp-erc-reconnect ()
|
|
|
|
(interactive)
|
|
|
|
(if (equal major-mode 'erc-mode)
|
|
|
|
(erc-server-reconnect)
|
2016-09-28 13:31:27 +00:00
|
|
|
(progn (switch-to-buffer (cp-erc-server-buffer))
|
2015-11-26 23:33:07 +00:00
|
|
|
(erc-server-reconnect))))
|
2016-06-12 04:50:44 +00:00
|
|
|
(defun cp-erc-ghost ()
|
|
|
|
(interactive)
|
2016-09-28 13:31:27 +00:00
|
|
|
;; (cp-erc-server-buffer)
|
2016-06-12 04:50:44 +00:00
|
|
|
(erc-message "PRIVMSG" "NickServ GHOST contrapunctus")
|
|
|
|
(erc-cmd-NICK "contrapunctus"))
|
|
|
|
(defun cp-erc-toggle-autojoin ()
|
|
|
|
(interactive)
|
|
|
|
(if erc-autojoin-mode
|
|
|
|
(progn (erc-autojoin-disable)
|
|
|
|
(message "ERC - autojoin disabled."))
|
|
|
|
(progn (erc-autojoin-enable)
|
|
|
|
(message "ERC - autojoin enabled."))))
|
|
|
|
;; (defun cp-erc-cycle ()
|
|
|
|
;; (interactive)
|
|
|
|
;; ())
|
|
|
|
|
2016-06-12 04:51:08 +00:00
|
|
|
(global-unset-key (kbd "C-x e"))
|
2015-11-26 23:33:07 +00:00
|
|
|
(cp-set-keys
|
|
|
|
:bindings
|
|
|
|
`((,(kbd "C-x e r") cp-erc-reconnect)
|
2015-11-30 18:12:32 +00:00
|
|
|
(,(kbd "C-x e e") cp-erc-freenode)
|
2016-06-12 04:51:08 +00:00
|
|
|
(,(kbd "C-x e w") cp-erc-ghost)
|
|
|
|
(,(kbd "C-c C-c") erc-track-switch-buffer)
|
|
|
|
(,(kbd "C-x e a") cp-erc-toggle-autojoin)))
|
2015-11-30 18:13:00 +00:00
|
|
|
|
2015-11-30 18:13:23 +00:00
|
|
|
(define-derived-mode erc-log-read-mode text-mode "ERC-log"
|
|
|
|
"Major mode for viewing ERC logs."
|
|
|
|
(highlight-lines-matching-regexp "^\[[0-9: ]*\]$"
|
|
|
|
"font-lock-comment-face")
|
|
|
|
(highlight-lines-matching-regexp "^\*\*\*.*\(join\|quit\|part\)"
|
|
|
|
"font-lock-comment-face"))
|
2016-09-28 12:51:58 +00:00
|
|
|
;; (add-to-list 'auto-mode-alist
|
|
|
|
;; (cons "/erc/logs/" 'erc-log-read-mode))
|
2015-11-30 18:13:23 +00:00
|
|
|
(add-to-list 'auto-mode-alist
|
2016-09-28 12:51:58 +00:00
|
|
|
(cons ".erclog$" 'erc-log-read-mode))
|
2015-11-24 21:12:10 +00:00
|
|
|
|
2016-06-13 17:27:44 +00:00
|
|
|
(with-eval-after-load 'rcirc
|
|
|
|
(setq
|
|
|
|
rcirc-log-flag t
|
|
|
|
rcirc-time-format "%Y %m %e %T "
|
|
|
|
rcirc-fill-column 80
|
|
|
|
rcirc-server-alist '(("irc.freenode.net"
|
|
|
|
:channels
|
|
|
|
("#emacs" "#lilypond" "#velvetandlace"
|
|
|
|
"#opensourcemusicians" "##classical"
|
|
|
|
"##guitar" "##deutsch" "##hindi")
|
|
|
|
:password
|
|
|
|
"trololo_trololo"))
|
|
|
|
rcirc-default-nick "contrapunctus"
|
|
|
|
;; rcirc-coding-system-alist '(("" . 'utf-8))
|
|
|
|
))
|
2016-09-28 12:51:58 +00:00
|
|
|
|
|
|
|
;; TODO
|
|
|
|
;; open log file for current channel
|