summaryrefslogtreecommitdiffstats
path: root/spacemacs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--spacemacs/.emacs.d/private/aminb/layers.el14
-rw-r--r--spacemacs/.emacs.d/private/aminb/packages.el48
-rw-r--r--spacemacs/.spacemacs2
3 files changed, 62 insertions, 2 deletions
diff --git a/spacemacs/.emacs.d/private/aminb/layers.el b/spacemacs/.emacs.d/private/aminb/layers.el
new file mode 100644
index 0000000..a7cbc32
--- /dev/null
+++ b/spacemacs/.emacs.d/private/aminb/layers.el
@@ -0,0 +1,14 @@
+;;; layers.el --- aminb layer layers file for Spacemacs.
+;;
+;; Copyright (c) 2016 Amin Bandali
+;;
+;; Author: Amin Bandali <amin@aminb.org>
+;; URL: https://github.com/aminb/dotfiles
+;;
+;; This file is not part of GNU Emacs.
+;;
+;;; License: GPLv3
+
+;; Prerequisites
+
+(configuration-layer/declare-layer 'erc)
diff --git a/spacemacs/.emacs.d/private/aminb/packages.el b/spacemacs/.emacs.d/private/aminb/packages.el
index fb9862b..919b271 100644
--- a/spacemacs/.emacs.d/private/aminb/packages.el
+++ b/spacemacs/.emacs.d/private/aminb/packages.el
@@ -17,7 +17,7 @@
;;; Code:
(defconst aminb-packages
- '(crux writeroom-mode)
+ '(crux writeroom-mode znc)
"The list of Lisp packages required by the aminb layer.")
(defun aminb/init-crux ()
@@ -34,5 +34,51 @@
:bind (("C-c W" . writeroom-mode)
("s-?" . writeroom-toggle-mode-line))))
+(defun aminb/init-znc ()
+ (use-package znc
+ :defer t
+ :init
+ (spacemacs/set-leader-keys
+ "aiz" 'znc-erc)
+ :config
+ (progn
+ (defun vbe:znc-add-server (server port user networks)
+ "Add a server to the list of ZNC servers.
+We use SSL inconditionaly. Moreover, we don't store the password
+but put nil instead. At least, we tweak the username to contain
+the network name later, this will be separated again."
+ (add-to-list 'znc-servers
+ (list server
+ port
+ t ; SSL enabled
+ (mapcar (function (lambda (slug) (list slug
+ (format "%s/%s" user slug)
+ nil)))
+ networks))))
+
+ (defun vbe:znc-erc-ssl-connector (&rest R)
+ "Connect to ERC using SSL and retrieve password with `auth-source-search'.
+Moreover, handle multiple networks by sending the password with
+the appropriate network slug that we extract from the nick."
+ (let* ((user (nth 0 (split-string (plist-get R :nick) "/")))
+ (slug (nth 1 (split-string (plist-get R :nick) "/")))
+ (found (nth 0 (auth-source-search :host (plist-get R :server)
+ :user user
+ :require '(:user :secret)
+ :max 1))))
+ (if found
+ (let ((password (let ((secret (plist-get found :secret)))
+ (if (functionp secret)
+ (funcall secret)
+ secret))))
+ (plist-put R :password (format "%s/%s:%s" user slug password))
+ (plist-put R :nick user)
+ (apply 'erc-tls R)))))
+ (setq znc-erc-ssl-connector 'vbe:znc-erc-ssl-connector)
+
+ ;; Define networks
+ (vbe:znc-add-server "nix.aminb.org" 6669 "amin"
+ '(freenode mozilla))
+ )))
;;; packages.el ends here
diff --git a/spacemacs/.spacemacs b/spacemacs/.spacemacs
index e65ae22..2d97947 100644
--- a/spacemacs/.spacemacs
+++ b/spacemacs/.spacemacs
@@ -370,7 +370,7 @@ This function is called at the very end of Spacemacs initialization."
;; If there is more than one, they won't work right.
'(package-selected-packages
(quote
- (web-beautify livid-mode skewer-mode simple-httpd json-mode json-snatcher json-reformat js2-refactor multiple-cursors js2-mode js-doc company-tern dash-functional tern coffee-mode xterm-color ws-butler writeroom-mode window-numbering which-key wgrep web-mode volatile-highlights vi-tilde-fringe uuidgen use-package toc-org tagedit spacemacs-theme spaceline smex smeargle slim-mode shell-pop scss-mode sass-mode restart-emacs request rainbow-delimiters quelpa pug-mode popwin persp-mode pcre2el paradox orgit org-ref org-projectile org-present org-pomodoro org-plus-contrib org-download org-bullets open-junk-file neotree mwim multi-term move-text mmm-mode markdown-toc magit-gitflow macrostep lorem-ipsum linum-relative link-hint less-css-mode ivy-purpose ivy-hydra intero insert-shebang info+ indent-guide ido-vertical-mode hungry-delete htmlize hlint-refactor hl-todo hindent highlight-parentheses highlight-numbers highlight-indentation hide-comnt help-fns+ helm-make haskell-snippets google-translate golden-ratio gnuplot gitignore-mode gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link gh-md flyspell-correct-ivy flycheck-pos-tip flycheck-haskell flx-ido fish-mode fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-magit evil-lisp-state evil-indent-plus evil-iedit-state evil-exchange evil-escape evil-ediff evil-args evil-anzu eval-sexp-fu eshell-z eshell-prompt-extras esh-help emmet-mode elisp-slime-nav dumb-jump disaster define-word crux counsel-projectile company-web company-statistics company-shell company-ghci company-ghc company-cabal company-c-headers company-auctex column-enforce-mode cmm-mode cmake-mode clean-aindent-mode clang-format auto-yasnippet auto-highlight-symbol auto-dictionary auto-compile auctex-latexmk aggressive-indent adaptive-wrap ace-window ace-link ac-ispell))))
+ (znc erc-yt erc-view-log erc-social-graph erc-image erc-hl-nicks xterm-color ws-butler writeroom-mode window-numbering which-key wgrep web-mode volatile-highlights vi-tilde-fringe uuidgen use-package toc-org tagedit spacemacs-theme spaceline smex smeargle slim-mode shell-pop scss-mode sass-mode restart-emacs request rainbow-delimiters quelpa pug-mode popwin persp-mode pcre2el paradox orgit org-ref org-projectile org-present org-pomodoro org-plus-contrib org-download org-bullets open-junk-file neotree mwim multi-term move-text mmm-mode markdown-toc magit-gitflow macrostep lorem-ipsum linum-relative link-hint less-css-mode ivy-purpose ivy-hydra intero insert-shebang info+ indent-guide ido-vertical-mode hungry-delete htmlize hlint-refactor hl-todo hindent highlight-parentheses highlight-numbers highlight-indentation hide-comnt help-fns+ helm-make haskell-snippets google-translate golden-ratio gnuplot gitignore-mode gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link gh-md flyspell-correct-ivy flycheck-pos-tip flycheck-haskell flx-ido fish-mode fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-magit evil-lisp-state evil-indent-plus evil-iedit-state evil-exchange evil-escape evil-ediff evil-args evil-anzu eval-sexp-fu eshell-z eshell-prompt-extras esh-help emmet-mode elisp-slime-nav dumb-jump disaster define-word crux counsel-projectile company-web company-statistics company-shell company-ghci company-ghc company-cabal company-c-headers company-auctex column-enforce-mode cmm-mode cmake-mode clean-aindent-mode clang-format auto-yasnippet auto-highlight-symbol auto-dictionary auto-compile auctex-latexmk aggressive-indent adaptive-wrap ace-window ace-link ac-ispell))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.