aboutsummaryrefslogtreecommitdiff
path: root/emacs/init.org
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2017-01-28 16:36:16 +0100
committerMiquel Sabaté Solà <msabate@suse.com>2017-01-28 16:36:16 +0100
commit821dd60a60ae3f5654be037de38a4697977a7b08 (patch)
tree951337694716e585625d1b7b7ea1adc9bf968c84 /emacs/init.org
parentdb25bee6cfbac01fb524452a536fa5a0f14631f0 (diff)
downloaddotfiles-821dd60a60ae3f5654be037de38a4697977a7b08.tar.gz
dotfiles-821dd60a60ae3f5654be037de38a4697977a7b08.zip
emacs: added ERC
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'emacs/init.org')
-rw-r--r--emacs/init.org98
1 files changed, 98 insertions, 0 deletions
diff --git a/emacs/init.org b/emacs/init.org
index a7a874d..8e70291 100644
--- a/emacs/init.org
+++ b/emacs/init.org
@@ -1377,6 +1377,104 @@ Will work on both org-mode and any mode that accepts plain html."
** TODO shortcuts for stuff like: create something urgent for today
+* IRC
+
+I'm giving ERC a chance. First of all, I'm setting up basic stuff.
+
+#+BEGIN_SRC elisp
+(use-package erc
+ :config
+
+ (erc-track-mode t)
+
+ (setq erc-hide-list '("PART" "QUIT" "JOIN")
+ erc-prompt (lambda () (concat (buffer-name) ">"))
+ erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE")
+ erc-server-coding-system '(utf-8 . utf-8)
+ erc-kill-buffer-on-part t
+ erc-kill-queries-on-quit t
+ erc-kill-server-buffer-on-quit t
+ erc-fill-column 130
+ erc-log-channels t
+ erc-log-write-after-insert t
+ erc-log-insert-log-on-open nil
+ erc-timestamp-format "%s "
+ erc-hide-timestamps t
+ erc-insert-timestamp-function 'erc-insert-timestamp-left
+ erc-insert-away-timestamp-function 'erc-insert-timestamp-left
+ erc-whowas-on-nosuchnick t
+ erc-public-away-p nil
+ erc-echo-notice-always-hook '(erc-echo-notice-in-minibuffer)
+ erc-auto-set-away nil
+ erc-autoaway-message "%i seconds out..."
+ erc-away-nickname "msabate"
+ erc-log-channels-directory "~/.emacs.d/erc/"
+ erc-enable-logging t
+ erc-query-on-unjoined-chan-privmsg t)
+
+ (setq erc-autojoin-channels-alist
+ '(("*.freenode.net" "#gnu" "#emacs")
+ ("*.suse.de" "#suse" "#docker")))
+#+END_SRC
+
+Setup desktop notifications.
+
+#+BEGIN_SRC elisp
+ (require 'notifications)
+
+ (defun erc-global-notify (match-type nick message)
+ "Notify when a message is recieved."
+
+ (when (eq match-type 'current-nick)
+ (notifications-notify
+ :title nick
+ :body message
+ :app-icon (concat
+ "/usr/share/emacs/"
+ (format "%s.%s" emacs-major-version emacs-minor-version)
+ "/etc/images/icons/hicolor/24x24/apps/emacs.png")
+ :urgency 'low)))
+
+ (when (boundp 'dbus-compiled-version)
+ (add-hook 'erc-text-matched-hook 'erc-global-notify))
+#+END_SRC
+
+Add some helper packages and update the loaded ERC modules.
+
+#+BEGIN_SRC elisp
+ (add-hook 'erc-connect-pre-hook
+ (lambda (x) (erc-update-modules)))
+
+ (use-package erc-hl-nicks
+ :ensure t)
+
+ (use-package erc-yt
+ :ensure t
+ :init
+ (with-eval-after-load 'erc
+ (add-to-list 'erc-modules 'youtube)))
+
+ (use-package erc-image
+ :ensure t
+ :init
+ (with-eval-after-load 'erc
+ (add-to-list 'erc-modules 'image)))
+#+END_SRC
+
+And now define a function to connect to both IRC servers.
+
+#+BEGIN_SRC elisp
+ (defun mssola-erc ()
+ "Join pre-speciifed servers and channels."
+
+ (interactive)
+
+ (erc :server "irc.freenode.net" :port 6667 :nick "mssola")
+ (erc-tls :server "irc.suse.de" :port 6697 :nick "mssola"))
+
+ (global-set-key (kbd "C-c i") 'mssola-erc))
+#+END_SRC
+
* Languages
First of all, define a function that identifies some warning keywords