Function: erc-log-mode
erc-log-mode is an autoloaded, interactive and byte-compiled function
defined in erc-log.el.gz.
Signature
(erc-log-mode &optional ARG)
Documentation
Toggle ERC log mode.
With a prefix argument ARG, enable log if ARG is positive,
and disable it otherwise. If called from Lisp, enable the mode
if ARG is omitted or nil.
Automatically logs things you receive on IRC into files.
Files are stored in erc-log-channels-directory; file name
format is defined through a formatting function on
erc-generate-log-file-name-function.
Since automatic logging is not always a Good Thing (especially if
people say things in different coding systems), you can turn logging
behavior on and off with the variable erc-enable-logging, which can
also be a predicate function. To only log when you are not set away, use:
(setq erc-enable-logging
(lambda (buffer)
(with-current-buffer buffer
(null (erc-away-time)))))
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-log.el.gz
;;;###autoload(autoload 'erc-log-mode "erc-log" nil t)
(define-erc-module log nil
"Automatically logs things you receive on IRC into files.
Files are stored in `erc-log-channels-directory'; file name
format is defined through a formatting function on
`erc-generate-log-file-name-function'.
Since automatic logging is not always a Good Thing (especially if
people say things in different coding systems), you can turn logging
behavior on and off with the variable `erc-enable-logging', which can
also be a predicate function. To only log when you are not set away, use:
\(setq erc-enable-logging
(lambda (buffer)
(with-current-buffer buffer
(null (erc-away-time)))))"
;; enable
((when erc-log-write-after-insert
(add-hook 'erc-insert-post-hook #'erc-save-buffer-in-logs))
(when erc-log-write-after-send
(add-hook 'erc-send-post-hook #'erc-save-buffer-in-logs))
(add-hook 'erc-kill-buffer-hook #'erc-save-buffer-in-logs)
(add-hook 'erc-kill-channel-hook #'erc-save-buffer-in-logs)
(add-hook 'kill-emacs-hook #'erc-log-save-all-buffers)
(add-hook 'erc-quit-hook #'erc-conditional-save-queries)
(add-hook 'erc-part-hook #'erc-conditional-save-buffer)
;; append, so that 'erc-initialize-log-marker runs first
(add-hook 'erc-connect-pre-hook #'erc-log-setup-logging 'append)
(dolist (buffer (erc-buffer-list))
(erc-log-setup-logging buffer)))
;; disable
((remove-hook 'erc-insert-post-hook #'erc-save-buffer-in-logs)
(remove-hook 'erc-send-post-hook #'erc-save-buffer-in-logs)
(remove-hook 'erc-kill-buffer-hook #'erc-save-buffer-in-logs)
(remove-hook 'erc-kill-channel-hook #'erc-save-buffer-in-logs)
(remove-hook 'kill-emacs-hook #'erc-log-save-all-buffers)
(remove-hook 'erc-quit-hook #'erc-conditional-save-queries)
(remove-hook 'erc-part-hook #'erc-conditional-save-buffer)
(remove-hook 'erc-connect-pre-hook #'erc-log-setup-logging)
(dolist (buffer (erc-buffer-list))
(erc-log-disable-logging buffer))))