-
-
Save unhammer/dc7d31a51dc1782fd1f5f93da12484fb to your computer and use it in GitHub Desktop.
weechat init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Use with https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00664.html | |
;; which probably isn't merged yet https://lists.gnu.org/r/emacs-devel/2018-06/msg00559.html | |
(defun erc-weechat-connect (server network) | |
"Connect to SERVER as a weechat ssl irc proxy. | |
Gets password from `auth-sources' stored under host ssl.irc.weechat; | |
and my-weechat-server.example.com:9001 hardcoded here. | |
Will not connect if we already have a connection to NETWORK." | |
(if-let ((existing (erc-buffer-list (lambda () (eq (erc-network) network))))) | |
(message "Already connected to %s (%S), see buffer %S" network server (car existing)) | |
(let ((password (auth-source-pick-first-password :host '("ssl.irc.weechat") | |
:type 'netrc | |
:max 1))) | |
(erc-tls :server "my-weechat-server.example.com" | |
:port 9001 | |
:password (concat server ":" password))))) | |
(defmacro erc-weechat-make-connect (server network) | |
"Partially apply `erc-weechat-connect' on a certain SERVER and NETWORK." | |
`(defun ,(intern (concat "erc-weechat-connect-" server)) () | |
,(concat "Connect to " server " on weechat, through ERC. | |
Will not connect if we already have a connection to NETWORK.") | |
(interactive) | |
(erc-weechat-connect ,server ,network))) | |
(erc-weechat-make-connect "bitlbee" 'BitlBee) | |
(erc-weechat-make-connect "freenode-over-tor" 'freenode) | |
;; can now do e.g. (erc-weechat-connect-freenode)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment