ERC log file name

Written on

I cleaned my erc config today after a long time. It was a big mess of copy-pasted things from everywhere.

So erc-log-insert-log-on-open literally inserts the whole log file on open. But you could rotate the log file which'll make this usable (thanks to wgreenhouse on #erc@freenode for the idea).

I discovered this today because it never worked before for some reason. I just set erc-log-insert-log-on-open to nil because I don't need it. Also, erc-generate-log-file-name-function is used to change log-file name, you can use this to rotate logs.

I just tweaked other log-file name. This is what I set it to:

(defun erc-generate-log-file-network (buffer target nick server port)
    "Generates a log-file name using the network name rather than server
       name. This results in a file name of the form #channel@network.
       This function is a possible value for
       `erc-generate-log-file-name-function'."
    (require 'erc-networks)
    (let ((file (concat
    (if target (concat target ""))
    "@"
    (or (with-current-buffer buffer (erc-network-name))
                   server))))
    ;; we need a make-safe-file-name function.
    (convert-standard-filename file)))