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/custom.el | 4 +- emacs/init.html | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++------ emacs/init.org | 98 ++++++++++++++++++++++++++++++++++++ 3 files changed, 234 insertions(+), 18 deletions(-) (limited to 'emacs') diff --git a/emacs/custom.el b/emacs/custom.el index 7c0e1ce..8eed56f 100644 --- a/emacs/custom.el +++ b/emacs/custom.el @@ -7,14 +7,14 @@ ["#1c1c1c" "#d78787" "#b9dc92" "#ffffaf" "#87afd7" "#875f87" "#dfafdf" "#d0d0d0"]) '(custom-safe-themes (quote - ("5a3f33eefbcf2a3098bafd22d7ad44358e66c3e844797e7bf9ef552a08dfeb6f" default))) + ("5869e98ef7446c9e2283e5788c0f6e2790676bdb52e9e1e112bb74e2415733c4" "5a3f33eefbcf2a3098bafd22d7ad44358e66c3e844797e7bf9ef552a08dfeb6f" default))) '(delete-selection-mode nil) '(magit-commit-arguments (quote ("--all" "--verbose" "--signoff"))) '(magit-log-arguments (quote ("--graph" "--color" "--decorate" "-n256"))) '(markdown-command "/usr/bin/markdown-calibre") '(package-selected-packages (quote - (htmlize cmake-mode websocket markdown-mode go-mode magit evil-leader evil helm projectile writeroom-mode org-eldoc evil-commentary circe yasnippet yaml-mode which-key web-mode wc-mode use-package terraform-mode smart-tabs-mode slim-mode scss-mode rainbow-delimiters php-mode org-evil olivetti mu4e-alert mmm-jinja2 markdown-preview-mode helm-projectile helm-ag go-eldoc go-add-tags flycheck expand-region evil-surround evil-org evil-numbers evil-mu4e evil-magit evil-args dockerfile-mode disable-mouse default-text-scale crux cmake-font-lock ag)))) + (erc-image erc-yt erc-hl-nicks emoji-cheat-sheet-plus helm-circe htmlize cmake-mode websocket markdown-mode go-mode magit evil-leader evil helm projectile writeroom-mode org-eldoc evil-commentary circe yasnippet yaml-mode which-key web-mode wc-mode use-package terraform-mode smart-tabs-mode slim-mode scss-mode rainbow-delimiters php-mode org-evil olivetti mu4e-alert mmm-jinja2 markdown-preview-mode helm-projectile helm-ag go-eldoc go-add-tags flycheck expand-region evil-surround evil-org evil-numbers evil-mu4e evil-magit evil-args dockerfile-mode disable-mouse default-text-scale crux cmake-font-lock ag)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. 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 <
     
    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 -- cgit v1.2.3