summaryrefslogtreecommitdiff
path: root/emacs.d/lisp/setup-erc.el
blob: 1bfcc97c24d41c88c2c9cd62313b3879df6624ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
;;; setup-erc.el --- setup-erc

;; Copyright (C) 2010  Luo Jinghua <sunmoon1997@gmail.com>

;; Author:  Luo Jinghua <sunmoon1997@gmail.com>
;; Keywords: erc

;; 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/>.

;;; Commentary:

;;

;;; Code:

(custom-set-variables
 '(erc-modules (quote (autojoin button completion
				fill irccontrols match menu netsplit noncommands readonly ring
				services smiley sound stamp spelling track))))
(custom-set-faces)

(server-start)
(erc :server "irc.freenode.net" :port 6667 :nick "sunmoon1997" :full-name "Luo.Jinghua" )

(require 'erc-services)
(erc-services-mode 1)
(setq erc-prompt-for-nickserv-password nil)
(setq erc-nickserv-passwords
      '((freenode (("sunmoon1997" . "")))))


(require 'erc-join)
(erc-autojoin-mode t)
(setq erc-autojoin-channels-alist
      '( ("freenode.net"  "#ppmm" "#cairo" "#dri-devel" "#ubuntu-cn")))

;;(setq erc-sound-path '("~/.emacs.d/sound"))
;;(setq erc-play-command "aplay")

;;(add-hook 'erc-text-matched-hook
;;(lambda (match-type nickuserhost message)
;;     (cond
;;      ((eq match-type 'current-nick)
;;       (play-sound-file "~/.emacs.d/sound/receive.wav"))
;;      ((eq match-type 'keyword)
;;       (play-sound-file "~/.emacs.d/sound/send.wav")))))

(defun erc-cmd-OPME ()
        "request a chanop op to me"
        (erc-message "PRIVMSG"
            (format "chanserv op %s"
                    (erc-default-target)
                    (erc-current-nick)) nil))

(defun erc-cmd-UNOPME ()
        "Deop myself from current channel"
        (erc-cmd-DEOP (format "%s" (erc-current-nick))))

;;;enable spelling check
(erc-spelling-mode 1)

;;;enable emotion symbol
(require 'smiley)
    (add-to-list 'smiley-regexp-alist '("\\(:-?]\\)\\W" 1 "forced"))
    (add-to-list 'smiley-regexp-alist '("\\s-\\(:-?/\\)\\W" 1 "wry"))
    (add-to-list 'smiley-regexp-alist '("\\(:-?(\\)\\W" 1 "sad"))
    (add-to-list 'smiley-regexp-alist '("\\((-?:\\)\\W" 1 "reverse-smile"))
    (add-to-list 'smiley-regexp-alist '("\\(:-?D\\)\\W" 1 "grin"))
    (add-to-list 'smiley-regexp-alist '("\\(:-?P\\)\\W" 1 "poke"))

(setq erc-auto-query 'buffer)

(add-hook 'erc-after-connect
	  (lambda (server nick)
	    (add-hook 'erc-server-NOTICE-hook 'erc-auto-query)))


(provide 'setup-erc)
;;; setup-erc.el ends here