From 821dd60a60ae3f5654be037de38a4697977a7b08 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Sat, 28 Jan 2017 16:36:16 +0100 Subject: emacs: added ERC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- emacs/init.html | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 134 insertions(+), 16 deletions(-) (limited to 'emacs/init.html') diff --git a/emacs/init.html b/emacs/init.html index 0112304..7ebb0a7 100644 --- a/emacs/init.html +++ b/emacs/init.html @@ -4,7 +4,7 @@ mssola's GNU Emacs configuration - + @@ -181,10 +181,11 @@ for the JavaScript code in this tag.
  • TODO shortcuts for stuff like: create something urgent for today
  • -
  • Languages
  • -
  • Misc
  • -
  • Credits
  • -
  • License
  • +
  • IRC
  • +
  • Languages
  • +
  • Misc
  • +
  • Credits
  • +
  • License
  • @@ -1924,9 +1925,126 @@ Insert a <kbd></kbd> value in org mode. See this -

    Languages

    +

    IRC

    +I'm giving ERC a chance. First of all, I'm setting up basic stuff. +

    + +
    + +
    (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")))
    +
    +
    + +

    +Setup desktop notifications. +

    + +
    + +
    (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))
    +
    +
    + +

    +Add some helper packages and update the loaded ERC modules. +

    + +
    + +
    (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)))
    +
    +
    + +

    +And now define a function to connect to both IRC servers. +

    + +
    + +
    (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))
    +
    +
    +
    + + +
    +

    Languages

    +
    +

    First of all, define a function that identifies some warning keywords (e.g. TODO). This function can then be applied to the proper mode.

    @@ -2211,9 +2329,9 @@ criteria really).
    -
    -

    Misc

    -
    +
    +

    Misc

    +

    Install a set of useful functions from @bbatsov. The bindings are following Emacs style instead of being more Vim-like on purpose (I don't want to put @@ -2231,9 +2349,9 @@ too many things into my leader and these shortcuts look sensible to me).

    -
    -

    Credits

    -
    +
    +

    Credits

    +

    I've built this file by simply scavenging from other people's emacs.d/dotfiles repositories. I have taken lots of pieces from here and there, but most notably: @@ -2258,9 +2376,9 @@ repositories. I have taken lots of pieces from here and there, but most notably:

    -
    -

    License

    -
    +
    +

    License

    +
    Copyright (C) 2014-2017 Miquel Sabaté Solà <mikisabate@gmail.com>
    @@ -2284,7 +2402,7 @@ along with this program.  If not, see <
     
    -- cgit v1.2.3