1. xemacs
  2. erc

Source

erc / erc-log.el

Diff from to

File erc-log.el

  • Ignore whitespace
 	   (set (make-local-variable 'write-file-hooks)
 		'(erc-save-buffer-in-logs))))
     (when erc-log-insert-log-on-open
-      (ignore-errors (insert-file-contents (erc-current-logfile))
-		     (move-marker erc-last-saved-position
-				  (1- (point-max)))))))
+      (let* ((log-file (erc-current-logfile))
+             (log-file-size (nth 7 (file-attributes log-file)))
+             (start (if (and log-file-size
+                             (memq 'erc-truncate-buffer
+				   erc-insert-post-hook))
+                        (- log-file-size erc-max-buffer-size)
+                      0)))
+        (ignore-errors (insert-file-contents log-file nil start
+                                             log-file-size))
+        (move-marker erc-last-saved-position
+                      (1- (point-max)))))))
 
 ;;; Append, so that 'erc-initialize-log-marker keeps running first.
 (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append)