2015-03-25 03:34:19 +00:00
|
|
|
;;; packages.el --- erc Layer packages File for Spacemacs
|
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-03-25 03:34:19 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2018-06-01 06:59:57 +00:00
|
|
|
(defconst erc-packages
|
|
|
|
'(
|
|
|
|
company
|
|
|
|
company-emoji
|
|
|
|
emoji-cheat-sheet-plus
|
|
|
|
erc
|
|
|
|
(erc-gitter :location (recipe
|
|
|
|
:fetcher github
|
|
|
|
:repo "jleechpe/erc-gitter")
|
|
|
|
:excluded t)
|
|
|
|
erc-hl-nicks
|
|
|
|
erc-image
|
|
|
|
(erc-sasl :location local)
|
|
|
|
erc-social-graph
|
|
|
|
(erc-terminal-notifier :toggle (spacemacs/system-is-mac))
|
|
|
|
(erc-tex :location local)
|
|
|
|
erc-view-log
|
|
|
|
(erc-yank :location local :excluded t)
|
|
|
|
erc-yt
|
|
|
|
linum
|
|
|
|
persp-mode
|
|
|
|
))
|
2015-03-28 02:24:39 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun erc/post-init-company ()
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends :backends company-capf :modes erc-mode))
|
2015-08-27 01:55:28 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun erc/post-init-company-emoji ()
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends :backends company-emoji :modes erc-mode))
|
2015-08-27 01:55:28 +00:00
|
|
|
|
|
|
|
(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
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-03-25 03:34:19 +00:00
|
|
|
:init
|
2016-06-04 02:18:45 +00:00
|
|
|
(progn
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"aie" 'erc
|
|
|
|
"aiE" 'erc-tls
|
|
|
|
"aii" 'erc-track-switch-buffer
|
|
|
|
"aiD" 'erc/default-servers)
|
2019-02-11 15:07:17 +00:00
|
|
|
(spacemacs/declare-prefix "ai" "irc")
|
2016-06-04 02:18:45 +00:00
|
|
|
;; utf-8 always and forever
|
|
|
|
(setq erc-server-coding-system '(utf-8 . utf-8)))
|
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
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-04-03 04:37:20 +00:00
|
|
|
:init
|
2015-04-27 01:48:32 +00:00
|
|
|
(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) "]")))
|
|
|
|
|
2017-08-24 01:03:49 +00:00
|
|
|
;; Notifications are enabled if erc-enable-notifications is non-nil, and
|
|
|
|
;; D-BUS is available (i.e. Linux/BSD).
|
|
|
|
(when (and erc-enable-notifications (boundp 'dbus-compiled-version))
|
|
|
|
(require 'notifications)
|
|
|
|
(defun erc-global-notify (match-type nick message)
|
|
|
|
"Notify when a message is received."
|
|
|
|
(notifications-notify
|
|
|
|
:title nick
|
|
|
|
:body message
|
|
|
|
:app-icon (concat spacemacs-assets-directory "spacemacs.svg")
|
|
|
|
:urgency 'low))
|
2015-08-17 23:32:20 +00:00
|
|
|
(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
|
2017-06-29 19:14:07 +00:00
|
|
|
"b" 'erc-switch-to-buffer
|
2015-11-18 00:38:05 +00:00
|
|
|
"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)))
|
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/pre-init-erc-hl-nicks ()
|
2016-05-30 02:39:21 +00:00
|
|
|
(spacemacs|use-package-add-hook erc
|
2016-04-03 04:37:20 +00:00
|
|
|
:post-config
|
|
|
|
(use-package erc-hl-nicks)))
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/init-erc-hl-nicks ())
|
2015-04-27 01:48:32 +00:00
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/pre-init-erc-sasl ()
|
2016-05-30 02:39:21 +00:00
|
|
|
(spacemacs|use-package-add-hook erc
|
2016-04-03 04:37:20 +00:00
|
|
|
:post-config
|
|
|
|
(use-package erc-sasl
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-04-03 04:37:20 +00:00
|
|
|
:if erc-enable-sasl-auth
|
|
|
|
;; Following http://www.emacswiki.org/emacs/ErcSASL
|
|
|
|
;; Maybe an advice would be better?
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
;; Add any server like this
|
|
|
|
;; (add-to-list 'erc-sasl-server-regexp-list "host\\.server\\.com")
|
|
|
|
(add-to-list 'erc-sasl-server-regexp-list "irc\\.freenode\\.net")
|
|
|
|
(defun erc-login ()
|
|
|
|
"Perform user authentication at the IRC server."
|
|
|
|
(erc-log (format "login: nick: %s, user: %s %s %s :%s"
|
|
|
|
(erc-current-nick)
|
|
|
|
(user-login-name)
|
|
|
|
(or erc-system-name (system-name))
|
|
|
|
erc-session-server
|
|
|
|
erc-session-user-full-name))
|
|
|
|
(if erc-session-password
|
|
|
|
(erc-server-send (format "PASS %s" erc-session-password))
|
|
|
|
(message "Logging in without password"))
|
|
|
|
(when (and (featurep 'erc-sasl) (erc-sasl-use-sasl-p))
|
|
|
|
(erc-server-send "CAP REQ :sasl"))
|
|
|
|
(erc-server-send (format "NICK %s" (erc-current-nick)))
|
|
|
|
(erc-server-send
|
|
|
|
(format "USER %s %s %s :%s"
|
|
|
|
;; hacked - S.B.
|
|
|
|
(if erc-anonymous-login erc-email-userid (user-login-name))
|
|
|
|
"0" "*"
|
|
|
|
erc-session-user-full-name))
|
|
|
|
(erc-update-mode-line))))))
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/init-erc-sasl ())
|
2016-01-18 03:06:04 +00:00
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/pre-init-erc-social-graph ()
|
2016-05-30 02:39:21 +00:00
|
|
|
(spacemacs|use-package-add-hook erc
|
2016-04-03 04:37:20 +00:00
|
|
|
:post-config
|
|
|
|
(use-package erc-social-graph
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
;; does not exist ?
|
|
|
|
;; (erc-social-graph-enable)
|
|
|
|
(setq erc-social-graph-dynamic-graph t)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'erc-mode
|
|
|
|
"D" 'erc-social-graph-draw)))))
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/init-erc-social-graph ())
|
2015-04-27 01:48:32 +00:00
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/pre-init-erc-tex ()
|
2016-05-30 02:39:21 +00:00
|
|
|
(spacemacs|use-package-add-hook erc
|
2016-04-03 04:37:20 +00:00
|
|
|
:post-config
|
|
|
|
(require 'erc-tex)))
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/init-erc-tex ())
|
2016-01-18 03:06:04 +00:00
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/pre-init-erc-yt ()
|
2016-05-30 02:39:21 +00:00
|
|
|
(spacemacs|use-package-add-hook erc
|
2016-04-03 04:37:20 +00:00
|
|
|
:post-config
|
|
|
|
(use-package erc-yt
|
2016-05-31 00:56:49 +00:00
|
|
|
:init (with-eval-after-load 'erc
|
2016-04-03 04:37:20 +00:00
|
|
|
(add-to-list 'erc-modules 'youtube)))))
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/init-erc-yt ())
|
2015-04-27 01:48:32 +00:00
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/pre-init-erc-yank ()
|
2016-05-30 02:39:21 +00:00
|
|
|
(spacemacs|use-package-add-hook erc
|
2016-04-03 04:37:20 +00:00
|
|
|
:post-config
|
|
|
|
(use-package erc-yank
|
2017-07-02 13:48:06 +00:00
|
|
|
:if (configuration-layer/package-used-p 'gist)
|
2016-04-03 04:37:20 +00:00
|
|
|
:init (evil-define-key 'normal erc-mode-map "p" 'erc-yank))))
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun erc/init-erc-yank ())
|
2016-01-18 03:06:04 +00:00
|
|
|
|
2015-04-27 01:48:32 +00:00
|
|
|
(defun erc/init-erc-view-log ()
|
|
|
|
(use-package erc-view-log
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-04-27 01:48:32 +00:00
|
|
|
:init
|
2015-04-28 04:19:22 +00:00
|
|
|
(progn
|
|
|
|
(setq erc-log-channels-directory
|
|
|
|
(expand-file-name
|
|
|
|
(concat spacemacs-cache-directory
|
|
|
|
"erc-logs")))
|
|
|
|
(unless (file-exists-p erc-log-channels-directory)
|
2016-04-03 04:37:20 +00:00
|
|
|
(make-directory erc-log-channels-directory))
|
2015-04-28 04:19:22 +00:00
|
|
|
(add-to-list 'auto-mode-alist
|
|
|
|
`(,(format "%s/.*\\.[log|txt]"
|
|
|
|
(regexp-quote
|
|
|
|
(expand-file-name
|
|
|
|
erc-log-channels-directory))) . erc-view-log-mode))
|
2016-04-03 04:37:20 +00:00
|
|
|
(with-eval-after-load 'erc (add-to-list 'erc-modules 'log)))
|
|
|
|
:config
|
|
|
|
;; ERC Logging
|
|
|
|
(progn
|
2015-04-28 04:19:22 +00:00
|
|
|
;; 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)
|
|
|
|
|
2016-01-20 02:55:38 +00:00
|
|
|
(spacemacs|define-transient-state erc-log
|
|
|
|
:title "ERC Log Transient State"
|
2016-01-21 21:06:15 +00:00
|
|
|
:doc "\n[_r_] reload the log file [_>_/_<_] go to the next/prev mention"
|
2016-06-18 03:40:06 +00:00
|
|
|
:evil-leader-for-mode (erc-mode . ".")
|
2015-04-28 04:19:22 +00:00
|
|
|
:bindings
|
|
|
|
("r" erc-view-log-reload-file)
|
|
|
|
(">" erc-view-log-next-mention)
|
2016-06-18 03:40:06 +00:00
|
|
|
("<" erc-view-log-previous-mention)))))
|
2015-04-27 01:48:32 +00:00
|
|
|
|
|
|
|
(defun erc/init-erc-image ()
|
|
|
|
(use-package erc-image
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-04-03 04:37:20 +00:00
|
|
|
:init (with-eval-after-load 'erc
|
|
|
|
(require 'erc-image)
|
|
|
|
(add-to-list 'erc-modules 'image))))
|
2015-04-27 01:48:32 +00:00
|
|
|
|
2016-01-31 01:01:22 +00:00
|
|
|
(defun erc/init-erc-terminal-notifier ()
|
|
|
|
(use-package erc-terminal-notifier
|
|
|
|
:if (executable-find "terminal-notifier")))
|
2015-11-09 04:51:29 +00:00
|
|
|
|
2016-06-04 02:18:45 +00:00
|
|
|
(defun erc/post-init-linum ()
|
2016-10-09 16:57:46 +00:00
|
|
|
(spacemacs/add-to-hooks 'spacemacs/no-linum '(erc-mode-hook
|
|
|
|
erc-insert-pre-hook)))
|
2016-06-04 02:18:45 +00:00
|
|
|
|
2018-01-10 04:01:34 +00:00
|
|
|
(defun erc/pre-init-persp-mode ()
|
|
|
|
(spacemacs|use-package-add-hook persp-mode
|
|
|
|
:post-config
|
2016-01-25 04:28:10 +00:00
|
|
|
(progn
|
2018-01-10 04:01:34 +00:00
|
|
|
(add-to-list 'persp-filter-save-buffers-functions
|
|
|
|
'spacemacs//erc-persp-filter-save-buffers-function)
|
|
|
|
(spacemacs|define-custom-layout erc-spacemacs-layout-name
|
|
|
|
:binding erc-spacemacs-layout-binding
|
|
|
|
:body
|
|
|
|
(progn
|
|
|
|
(add-hook 'erc-mode-hook #'spacemacs//erc-buffer-to-persp)
|
|
|
|
(if erc-server-list
|
|
|
|
(erc/default-servers)
|
|
|
|
(call-interactively 'erc)))))))
|
|
|
|
|