X-Git-Url: https://git.shemshak.org/~bandali/configs/blobdiff_plain/ccb32b49c84c49070c5a5c5764a5b26d305e2584..535c73d96e2cf9adbd2dfa31d87f4b7960359926:/.emacs.d/lisp/bandali-erc.el diff --git a/.emacs.d/lisp/bandali-erc.el b/.emacs.d/lisp/bandali-erc.el index 3527a65..8cd1457 100644 --- a/.emacs.d/lisp/bandali-erc.el +++ b/.emacs.d/lisp/bandali-erc.el @@ -1,6 +1,6 @@ ;;; bandali-erc.el --- bandali's ERC setup -*- lexical-binding: t; -*- -;; Copyright (C) 2018-2021 Amin Bandali +;; Copyright (C) 2018-2022 Amin Bandali ;; Author: Amin Bandali ;; Keywords: IRC, chat, client, Internet @@ -26,14 +26,14 @@ (with-eval-after-load 'erc (make-directory (b/var "erc/dcc") t) - (csetq + (setq erc-auto-query 'bury erc-autojoin-domain-only nil erc-dcc-get-default-directory (b/var "erc/dcc") erc-email-userid "bandali" erc-format-nick-function 'erc-format-@nick erc-join-buffer 'bury - erc-lurker-hide-list '("JOIN" "PART" "QUIT") + ;; erc-lurker-hide-list '("JOIN" "PART" "QUIT") erc-nick "bandali" erc-prompt "erc>" erc-prompt-for-password nil @@ -63,8 +63,6 @@ (add-to-list 'erc-modules 'notifications) (add-to-list 'erc-modules 'smiley)) (add-to-list 'erc-modules 'spelling) - (declare-function erc-update-modules "erc") - (erc-update-modules) ;; (set-face-attribute ;; 'erc-nick-default-face nil @@ -84,7 +82,7 @@ ;; :foreground "steel blue") ;; erc-fill - ;; (csetq + ;; (setq ;; erc-fill-column 77 ;; erc-fill-function 'erc-fill-variable ;; erc-fill-static-center 18) @@ -92,23 +90,36 @@ ;; (erc-fill-mode -1) ;; erc-log - (csetq + (defun b/erc-log-directory (buffer target _nick server _port) + (let ((directory (concat (b/var "erc/logs/") + ;; (or (with-current-buffer buffer + ;; (symbol-name erc-network)) + ;; server) + server + (if (erc-server-buffer-p buffer) + (concat "/" server) + (and target (concat "/" target)))))) + (unless (file-exists-p directory) + (make-directory directory 'make-parents)) + directory)) + (defun b/erc-log-file-name (&rest _) + (concat (format-time-string "%Y-%m-%d") ".log")) + (setq ;; erc-enable-logging 'erc-log-all-but-server-buffers - erc-generate-log-file-name-function 'erc-generate-log-file-name-with-date - erc-log-channels-directory (b/var "erc/logs") + erc-generate-log-file-name-function #'b/erc-log-file-name + erc-log-channels-directory #'b/erc-log-directory erc-log-file-coding-system 'utf-8 erc-log-write-after-insert t erc-log-write-after-send t erc-save-buffer-on-part nil erc-save-queries-on-quit nil) - ;; erc-match - (csetq - erc-pal-highlight-type 'nick - erc-pals - '("bremner" "^gopar" "^iank" "quidam" "^rwp" "sudoman" - "technomancy" "thomzane")) (with-eval-after-load 'erc-match + (setq + erc-pal-highlight-type 'nick + erc-pals + '("bremner" "^gopar" "^iank" "quidam" "^rwp" "sudoman" + "technomancy" "thomzane")) (set-face-attribute 'erc-pal-face nil :foreground 'unspecified @@ -117,13 +128,23 @@ ;; :background (face-attribute 'font-lock-string-face :background) :background "#ffffdf")) - ;; erc-pcomplete - (csetq erc-pcomplete-nick-postfix ",") - - ;; erc-stamp - (csetq erc-timestamp-only-if-changed-flag nil - erc-timestamp-format "%T " - erc-insert-timestamp-function 'erc-insert-timestamp-left) + (with-eval-after-load 'erc-pcomplete + (setq erc-pcomplete-nick-postfix ",") + ;; for matterircd nick (username) completions + ;; (advice-add + ;; #'pcomplete-erc-nicks + ;; :around + ;; (lambda (orig-fun &rest args) + ;; (let ((nicks (apply orig-fun args))) + ;; (if (string-match-p "matterircd" (symbol-name (erc-network))) + ;; (mapcar (lambda (nick) (concat "@" nick)) nicks) + ;; nicks)))) + ) + + (with-eval-after-load 'erc-stamp + (setq erc-timestamp-only-if-changed-flag nil + erc-timestamp-format "%T " + erc-insert-timestamp-function 'erc-insert-timestamp-left)) (with-eval-after-load 'erc-match (set-face-attribute 'erc-timestamp-face nil @@ -131,15 +152,18 @@ :weight 'unspecified :background 'unspecified)) - ;; erc-track - (csetq - erc-track-enable-keybindings nil - erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT" - "324" "329" "332" "333" "353" "477") - erc-track-position-in-mode-line t - erc-track-priority-faces-only 'all - erc-track-shorten-function nil - erc-track-showcount t) + (with-eval-after-load 'erc-track + (setq + erc-track-enable-keybindings nil + erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT" + "324" "329" "332" "333" "353" "477") + erc-track-position-in-mode-line t + erc-track-priority-faces-only 'all + erc-track-shorten-function nil + erc-track-showcount t)) + + (declare-function erc-update-modules "erc") + (erc-update-modules) ;; key bindings (global-set-key (kbd "C-c w e") #'erc-switch-to-buffer-other-window) @@ -147,26 +171,30 @@ ;; global key bindings (global-set-key - (kbd "C-c a e f") + (kbd "C-c e l") (lambda () (interactive) - (erc-tls :server "chat.freenode.net" :port 6697 - :client-key (b/var "erc/certs/bandali-freenode.key") - :client-crt (b/var "erc/certs/bandali-freenode.crt")))) + (erc-tls :server "irc.libera.chat" :port 6697 + :client-certificate t))) (global-set-key - (kbd "C-c a e o") + (kbd "C-c e o") (lambda () (interactive) (erc-tls :server "irc.oftc.net" :port 6697 - :client-key (b/var "erc/certs/bandali-oftc.key") - :client-crt (b/var "erc/certs/bandali-oftc.crt")))) + :client-certificate t))) (global-set-key - (kbd "C-c a e t") + (kbd "C-c e t") (lambda () (interactive) (erc-tls :server "na.tilde.chat" :port 6697 - :client-key (b/var "erc/certs/bandali-tildechat.key") - :client-crt (b/var "erc/certs/bandali-tildechat.crt")))) + :client-certificate t))) + +;; (global-set-key +;; (kbd "C-c e c") +;; (lambda () +;; (interactive) +;; (erc :server "localhost" :port 6667 +;; :id 'matterircd-canonical))) (provide 'bandali-erc) ;;; bandali-erc.el ends here