2015-03-25 03:34:19 +00:00
|
|
|
;;; packages.el --- erc Layer packages File for Spacemacs
|
|
|
|
;;
|
|
|
|
;; Copyright (c) 2012-2014 Sylvain Benner
|
|
|
|
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-04-27 01:48:32 +00:00
|
|
|
(setq erc-packages
|
|
|
|
'(
|
2015-08-27 01:55:28 +00:00
|
|
|
company
|
|
|
|
company-emoji
|
|
|
|
emoji-cheat-sheet-plus
|
2015-04-27 01:48:32 +00:00
|
|
|
erc
|
2015-09-22 17:23:29 +00:00
|
|
|
(erc-gitter :location (recipe
|
|
|
|
:fetcher github
|
2015-09-24 16:04:20 +00:00
|
|
|
:repo "jleechpe/erc-gitter")
|
|
|
|
:excluded t)
|
2015-04-27 01:48:32 +00:00
|
|
|
erc-hl-nicks
|
|
|
|
erc-image
|
|
|
|
erc-social-graph
|
|
|
|
erc-view-log
|
|
|
|
erc-yt
|
2015-11-09 04:51:29 +00:00
|
|
|
persp-mode
|
2015-11-11 05:06:27 +00:00
|
|
|
smooth-scrolling
|
2015-04-27 01:48:32 +00:00
|
|
|
))
|
2015-03-25 03:34:19 +00:00
|
|
|
|
2015-08-23 01:47:30 +00:00
|
|
|
(when (spacemacs/system-is-mac)
|
2015-03-28 02:24:39 +00:00
|
|
|
(push 'erc-terminal-notifier erc-packages))
|
|
|
|
|
2015-08-27 01:55:28 +00:00
|
|
|
(when (configuration-layer/layer-usedp 'auto-completion)
|
|
|
|
(defun erc/post-init-company ()
|
|
|
|
(spacemacs|add-company-hook erc-mode)
|
|
|
|
(push 'company-capf company-backends-erc-mode))
|
|
|
|
|
|
|
|
(defun erc/post-init-company-emoji ()
|
|
|
|
(push 'company-emoji company-backends-erc-mode)))
|
|
|
|
|
|
|
|
(defun erc/post-init-emoji-cheat-sheet-plus ()
|
|
|
|
(add-hook 'erc-mode-hook 'emoji-cheat-sheet-plus-display-mode))
|
|
|
|
|
2015-03-25 03:34:19 +00:00
|
|
|
(defun erc/init-erc ()
|
|
|
|
"Initialize ERC"
|
|
|
|
(use-package erc
|
|
|
|
:defer t
|
|
|
|
:init
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys
|
2015-04-11 15:00:54 +00:00
|
|
|
"aie" 'erc
|
2015-04-17 06:00:10 +00:00
|
|
|
"aiE" 'erc-tls
|
2015-04-21 06:02:19 +00:00
|
|
|
"aii" 'erc-track-switch-buffer)
|
2015-04-27 01:48:32 +00:00
|
|
|
;; utf-8 always and forever
|
|
|
|
(setq erc-server-coding-system '(utf-8 . utf-8))
|
|
|
|
;; disable linum mode in erc
|
|
|
|
;; check if this will not be efficient
|
|
|
|
(defun no-linum (&rest ignore)
|
|
|
|
(when (or 'linum-mode global-linum-mode)
|
|
|
|
(linum-mode 0)))
|
2015-08-23 01:47:30 +00:00
|
|
|
(spacemacs/add-to-hooks 'no-linum '(erc-hook
|
|
|
|
erc-mode-hook
|
|
|
|
erc-insert-pre-hook))
|
2015-03-28 02:24:39 +00:00
|
|
|
:config
|
2015-03-25 03:34:19 +00:00
|
|
|
(progn
|
2015-04-27 01:48:32 +00:00
|
|
|
(use-package erc-autoaway
|
|
|
|
:config
|
|
|
|
(setq erc-auto-discard-away t
|
|
|
|
erc-autoaway-idle-seconds 600
|
|
|
|
erc-autoaway-use-emacs-idle t))
|
|
|
|
(erc-services-mode 1)
|
2015-03-25 18:29:11 +00:00
|
|
|
(defun erc-list-command ()
|
2015-03-28 02:24:39 +00:00
|
|
|
"execute the list command"
|
|
|
|
(interactive)
|
2015-03-25 18:29:11 +00:00
|
|
|
(insert "/list")
|
|
|
|
(erc-send-current-line))
|
2015-03-28 02:24:39 +00:00
|
|
|
(setq erc-kill-buffer-on-part t
|
|
|
|
erc-kill-queries-on-quit t
|
|
|
|
erc-kill-server-buffer-on-quit t)
|
2015-04-27 01:48:32 +00:00
|
|
|
(add-hook 'erc-connect-pre-hook (lambda (x) (erc-update-modules)))
|
2015-03-28 02:24:39 +00:00
|
|
|
(erc-track-mode t)
|
|
|
|
(setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE")
|
|
|
|
erc-server-coding-system '(utf-8 . utf-8))
|
2015-04-27 01:48:32 +00:00
|
|
|
(setq erc-prompt (lambda () (concat "[" (buffer-name) "]")))
|
|
|
|
|
|
|
|
(require 'notifications)
|
|
|
|
(defun erc-global-notify (match-type nick message)
|
|
|
|
"Notify when a message is recieved."
|
|
|
|
(notifications-notify
|
|
|
|
:title nick
|
|
|
|
:body message
|
2015-10-12 04:58:38 +00:00
|
|
|
:app-icon (concat spacemacs-assets-directory "spacemacs.svg")
|
2015-04-27 01:48:32 +00:00
|
|
|
:urgency 'low))
|
|
|
|
|
2015-08-17 23:32:20 +00:00
|
|
|
;; osx doesn't have dbus support
|
|
|
|
(when (boundp 'dbus-compiled-version)
|
|
|
|
(add-hook 'erc-text-matched-hook 'erc-global-notify))
|
|
|
|
|
2015-03-25 18:29:11 +00:00
|
|
|
;; keybindings
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'erc-mode
|
|
|
|
"d" 'erc-input-action
|
|
|
|
"j" 'erc-join-channel
|
|
|
|
"n" 'erc-channel-names
|
|
|
|
"l" 'erc-list-command
|
|
|
|
"p" 'erc-part-from-channel
|
|
|
|
"q" 'erc-quit-server))))
|
2015-04-03 21:35:33 +00:00
|
|
|
|
2015-09-22 17:23:29 +00:00
|
|
|
(defun erc/init-erc-gitter ()
|
|
|
|
(use-package erc-gitter
|
|
|
|
:config
|
|
|
|
(add-to-list 'erc-modules 'gitter)))
|
|
|
|
|
2015-04-27 01:48:32 +00:00
|
|
|
|
|
|
|
(defun erc/init-erc-hl-nicks ()
|
|
|
|
(use-package erc-hl-nicks
|
2015-04-28 04:19:22 +00:00
|
|
|
:defer t
|
|
|
|
;; may need a hook ?
|
2015-04-27 01:48:32 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
(defun erc/init-erc-social-graph ()
|
|
|
|
(use-package erc-social-graph
|
2015-04-28 04:19:22 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
;; does not exist ?
|
|
|
|
;; (erc-social-graph-enable)
|
|
|
|
(setq erc-social-graph-dynamic-graph t)
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'erc-mode
|
|
|
|
"D" 'erc-social-graph-draw))))
|
2015-04-27 01:48:32 +00:00
|
|
|
|
|
|
|
(defun erc/init-erc-yt ()
|
|
|
|
(use-package erc-yt
|
2015-09-29 05:07:57 +00:00
|
|
|
:init (with-eval-after-load 'erc (add-to-list 'erc-modules 'youtube))))
|
2015-04-27 01:48:32 +00:00
|
|
|
|
|
|
|
(defun erc/init-erc-view-log ()
|
|
|
|
(use-package erc-view-log
|
|
|
|
:init
|
2015-04-28 04:19:22 +00:00
|
|
|
(progn
|
2015-09-29 05:07:57 +00:00
|
|
|
(with-eval-after-load 'erc (add-to-list 'erc-modules 'log))
|
2015-04-28 04:19:22 +00:00
|
|
|
(setq erc-log-channels-directory
|
|
|
|
(expand-file-name
|
|
|
|
(concat spacemacs-cache-directory
|
|
|
|
"erc-logs")))
|
|
|
|
(unless (file-exists-p erc-log-channels-directory)
|
|
|
|
(make-directory erc-log-channels-directory)))
|
2015-04-27 01:48:32 +00:00
|
|
|
|
|
|
|
:config
|
|
|
|
;; ERC Logging
|
2015-04-28 04:19:22 +00:00
|
|
|
(progn
|
|
|
|
(add-to-list 'auto-mode-alist
|
|
|
|
`(,(format "%s/.*\\.[log|txt]"
|
|
|
|
(regexp-quote
|
|
|
|
(expand-file-name
|
|
|
|
erc-log-channels-directory))) . erc-view-log-mode))
|
|
|
|
;; Following https://raw.githubusercontent.com/Niluge-KiWi/erc-view-log/master/erc-view-log.el
|
|
|
|
;; installation instructions
|
|
|
|
(add-hook 'erc-view-log-mode-hook 'turn-on-auto-revert-tail-mode)
|
|
|
|
|
|
|
|
|
|
|
|
(defun spacemacs//erc-log-ms-documentation ()
|
|
|
|
"Return the docstring for the workspaces micro-state."
|
|
|
|
(concat
|
|
|
|
"\n[r] to reload the log file"
|
|
|
|
"[>], [<] to go to the next/prev mention"))
|
|
|
|
|
|
|
|
(spacemacs|define-micro-state erc-log
|
|
|
|
:doc (spacemacs//erc-log-ms-documentation)
|
|
|
|
:use-minibuffer t
|
|
|
|
:evil-leader "m."
|
|
|
|
:bindings
|
|
|
|
("r" erc-view-log-reload-file)
|
|
|
|
(">" erc-view-log-next-mention)
|
|
|
|
("<" erc-view-log-previous-mention)))))
|
2015-04-27 01:48:32 +00:00
|
|
|
|
|
|
|
(defun erc/init-erc-image ()
|
|
|
|
(use-package erc-image
|
2015-09-29 05:07:57 +00:00
|
|
|
:init (with-eval-after-load 'erc (add-to-list 'erc-modules 'image))))
|
2015-04-27 01:48:32 +00:00
|
|
|
|
2015-04-03 21:35:33 +00:00
|
|
|
(defun erc/init-erc-terminal-notifier ())
|
2015-11-09 04:51:29 +00:00
|
|
|
|
|
|
|
(defun erc/post-init-persp-mode ()
|
|
|
|
(spacemacs|define-custom-layout "@ERC"
|
|
|
|
:binding "E"
|
|
|
|
:body
|
|
|
|
(call-interactively 'erc))
|
|
|
|
;; do not save erc buffers
|
|
|
|
(spacemacs|use-package-add-hook persp-mode
|
|
|
|
:post-config
|
|
|
|
(push (lambda (b) (with-current-buffer b (eq major-mode 'erc-mode)))
|
|
|
|
persp-filter-save-buffers-functions)))
|
2015-11-11 05:06:27 +00:00
|
|
|
|
|
|
|
(defun erc/post-init-smooth-scrolling ()
|
|
|
|
(add-hook 'erc-mode-hook 'spacemacs//unset-scroll-margin))
|