diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-10-30 15:13:45 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-10-31 18:56:00 -0700 |
commit | 365a519192fcc4f60f7f63d47a9a4bf51c822af1 (patch) | |
tree | c78fb22963dc84f630cece9f4422708833419462 /.emacs.d | |
parent | 59e405c2ef0da027b6fc5088bc13f70809a601e4 (diff) | |
download | dotfiles-365a519192fcc4f60f7f63d47a9a4bf51c822af1.tar.gz |
irssi -> rcirc initial configuration
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/init.el | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index d0e065f5..f93c1b1d 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -363,6 +363,17 @@ windows side-by-side in the frame." (spw/project-vc-print-root-log "VC-Log" "L") (transient-cycles-cmd-spw/project-eshell "Eshell"))) '(project-switch-use-entire-map t) + '(rcirc-default-full-name "Sean Whitton [spwhitton@spwhitton.name]") + '(rcirc-default-nick "spwhitton") + '(rcirc-default-user-name "spwhitton") + '(rcirc-display-server-buffer nil) + '(rcirc-log-directory "~/local/irclogs") + '(rcirc-log-filename-function 'spw/rcirc-generate-log-filename) + '(rcirc-log-flag t) + '(rcirc-time-format "%b/%d %H:%M ") + '(rcirc-track-abbrevate-flag nil) + '(rcirc-track-ignore-server-buffer-flag t) + '(rcirc-track-minor-mode t) '(read-mail-command 'gnus) '(read-minibuffer-restore-windows nil) '(remember-data-file "~/local/tmp/emacs-notes") @@ -3469,6 +3480,67 @@ mutt's review view, after exiting EDITOR." (advice-add #'gnus-summary-exit-no-update :around #'spw/gnus-with-expert) +;;;; rcirc + +(defun spw/rcirc-generate-log-filename (process target) + (concat (file-name-concat (format-time-string "%Y/%m") + (process-name process) (or target "server")) + ".log")) + +(defun spw/irc-autoaway () + (dolist (process (rcirc-process-list)) + (rcirc-send-string process "AWAY :This Emacs is idle")) + (spw/add-once-hook 'post-command-hook + (lambda () + (dolist (process (rcirc-process-list)) + (rcirc-send-string process "AWAY :"))))) + +(when (spw/on-host-p "athena.silentflame.com") + (defvar spw/irc-autoaway-timer + (progn (load (expand-file-name "irc-init" user-emacs-directory)) + (irc nil) + (run-with-idle-timer 240 t #'spw/irc-autoaway)))) + +(defun spw/rcirc-log-for-mail (process sender response target text) + (with-rcirc-process-buffer process + (when (and (string= "PRIVMSG" response) + (or (string= sender target) + (string-match-p + (format "\\`\\(?:spwhitton\\|seanw\\|%s\\).? " rcirc-nick) + text))) + (with-temp-buffer + (let ((time (format-time-string rcirc-time-format)) + (name (rcirc-generate-new-buffer-name process target))) + (insert + (if (string= sender target) + (format "\n\n%s\t\t%s\n\n " time name) + (format "\n\n%s\t\t%s\n\n <%s> " time name sender)))) + (insert text) + (fill-region (pos-bol) (point)) + (write-region nil nil "~/local/irclogs/mail.log" t 'silent))))) +(spw/feature-add-hook spw/rcirc-log-for-mail (rcirc rcirc-print-functions)) + +(defun spw/rcirc-mail-hilights () + (when (file-exists-p "~/local/irclogs/mail.log") + (ignore-errors + (rename-file "~/local/irclogs/mail.log" "~/local/irclogs/mail.log.tmp")) + (let (mail-signature + (mail-from-style 'parens) + (user-full-name "Cron Daemon") + (user-mail-address user-login-name)) + (mail 'new user-login-name "IRC messages") + (mail-text) (insert-file "~/local/irclogs/mail.log.tmp") + (mail-text) (delete-blank-lines) (delete-blank-lines) + (let ((inhibit-quit t)) + (mail-send) + (kill-buffer) + (delete-file "~/local/irclogs/mail.log.tmp"))))) + +(when (spw/on-host-p "athena.silentflame.com") + (defvar spw/rcirc-mail-hilights-timer + (run-at-time t 21600 #'spw/rcirc-mail-hilights))) + + ;;;; VC ;;; Want Magit installed for `git-commit-mode', `git-rebase-mode' and these |