From: Gergely N. <alg...@bo...> - 2001-11-28 18:18:59
|
Greetings! In erc.el 1.152, when erc-truncate-buffer-on-save is nil, when saving the buffer, erc will skip the first (length erc-prompt) chars, because erc-last-saved-position was set to (point-max), which was after the erc prompt. However, when typing stuff in, the prompt will get replaced by the channel trafic, this resulting logs like this: [2001-11-28] <mhp> foo ERC> -11-28] <mhp> bar So, I changed the way the end point is calculated to subtract the necessary value from (point-max), making the logs nicer: [2001-11-28] <mhp> foo [2001-11-28] <mhp> bar The patch is attached below, comments and friends are welcome. (I'm not entirely sure this is the correct fix, but it appears to work for me) --- erc.el Tue Nov 27 20:24:48 2001 +++ erc.el-mhp Wed Nov 28 13:39:20 2001 @@ -5299,13 +5299,15 @@ (when (and erc-log-channels erc-log-channels-directory (erc-directory-writable-p erc-log-channels-directory)) - (append-to-file erc-last-saved-position (point-max) file) + (append-to-file erc-last-saved-position (- (point-max) + (+ 1 (length + erc-prompt))) file) (if erc-truncate-buffer-on-save (progn (erase-buffer) (setq erc-last-saved-position (point-max)) (erc-display-prompt)) - (setq erc-last-saved-position (point-max))) + (setq erc-last-saved-position (- (point-max) (+ 1 (length erc-prompt))))) (goto-char (point-max))) (set-buffer-modified-p nil) (setq buffer-file-name file))) |