From: Gergely N. <alg...@bo...> - 2001-11-24 16:21:41
|
Greetings! The hard-coded filenames of the ERC logs bothered me for some time, so I sat down and wrote a smallish patch, which partly fixes the problem. What I did, was to modify erc-save-buffer-in-logs, to call a custom defun, which will compute the actual filename. The only problem is that this does not work if the logs are not saved through this function, so, the buffer filenames should be set using this customisable function, I think. But that's way beyond my lisp knowledge. Anyway, the patch against last nights CVS is attached below. --- erc.el.orig Sat Nov 24 02:24:25 2001 +++ erc.el Sat Nov 24 14:49:23 2001 @@ -437,6 +437,17 @@ :group 'erc :type 'boolean) +(defcustom erc-generate-log-file-name-p 'erc-generate-log-file-name-default + "A function name to generate a log filename. The function must take +four arguments: BUFFER, TARGET, NICK and SERVER. BUFFER is the buffer +to be saved, TARGET is the name of the channel, or the target of the +query, NICK is the current nick, and SERVER is the server the buffer +is on." + :group 'erc + :type '(choice (const 'erc-generate-log-file-name-default) + (const 'erc-generate-log-file-name-old) + (function-item))) + (defvar erc-grab-buffer-name "*erc-grab*" "The name of the buffer created by `erc-grab-region'.") @@ -5181,6 +5192,13 @@ (buffer-enable-undo)) (set-buffer ob))) +(defun erc-generate-log-file-name-default (buffer target nick server) + "Default log filename generator." + (concat erc-log-channels-directory "/" (buffer-name buffer) ".txt")) +(defun erc-generate-log-file-name-old (buffer target nick server) + "Old-style (#channel!nick@server.txt) log filename generator" + (concat erc-log-channels-directory "/" target "!" nick "@" server ".txt")) + (defun erc-save-buffer-in-logs (&optional buffer) "When the logs are enabled, that is `erc-log-channels' is non-nil and `erc-log-channels-directory' is a valid directory, appends the @@ -5198,8 +5216,9 @@ erc-log-channels-directory (erc-directory-writable-p erc-log-channels-directory)) (append-to-file (point-min) (point-max) - (concat erc-log-channels-directory - "/" (buffer-name buffer) ".txt")) + (eval (list erc-generate-log-file-name-p buffer + (erc-default-target) (erc-current-nick) + erc-announced-server-name))) (erase-buffer) (erc-display-prompt) (goto-char (point-max))) |