--- irchat.el.old Wed Jul 23 12:44:12 2003 +++ irchat.el Mon Mar 15 21:51:53 2004 @@ -1241,6 +1241,17 @@ (irchat-insert string (cons irchat-Private-buffer (pure-irc-users-get-chan irchat-nickname)) pattern)) +(defun irchat-pj-expire-lines (threshold lines) + (and + (numberp threshold) + (<= threshold (count-lines (point-min) (point-max))) + (or (numberp lines) (setq lines (/ threshold 10))) + (let ((buffer-read-only nil)) + (save-excursion + (goto-line (1+ lines)) + (beginning-of-line) + (delete-region (point-min) (point)))))) + (defun irchat-insert (body &optional chans pattern flag head) (let (opoint chan buf win visible) (while chans @@ -1250,6 +1261,7 @@ (if (setq buf (if (bufferp chan) chan (irchat-Channel-exist chan))) (save-excursion (set-buffer buf) + (irchat-pj-expire-lines irchat-pj-expire-chanbuf-threshold irchat-pj-expire-chanbuf-lines) (setq opoint (point)) (goto-char (point-max)) (if (setq win (get-buffer-window buf)) @@ -1261,7 +1273,6 @@ (stringp irchat-previous-pattern) (string= pattern irchat-previous-pattern)) (progn - ;;(previous-line 1) (forward-line -1) (if flag (if irchat-print-time (forward-char 6)) @@ -1293,9 +1304,11 @@ (or visible (save-excursion (set-buffer irchat-Others-buffer) - (if (> (point-max) irchat-others-high-watermark) - (let ((buffer-read-only nil)) - (delete-region 1 (- (point-max) irchat-others-low-watermark)))) + (if irchat-pj-expire-other-threshold + (irchat-pj-expire-lines irchat-pj-expire-other-threshold irchat-pj-expire-other-lines) + (if (> (point-max) irchat-others-high-watermark) + (let ((buffer-read-only nil)) + (delete-region 1 (- (point-max) irchat-others-low-watermark))))) (goto-char (point-max)) (let ((buffer-read-only nil)) (if irchat-print-time @@ -1320,6 +1333,7 @@ ;; end (save-excursion (set-buffer irchat-Dialogue-buffer) + (irchat-pj-expire-lines irchat-pj-expire-dialogue-threshold irchat-pj-expire-dialogue-lines) (let ((opoint (point))) (goto-char (point-max)) (let ((buffer-read-only nil)) --- irchat-vars.el.old Tue Mar 16 01:01:34 2004 +++ irchat-vars.el Tue Mar 16 00:53:50 2004 @@ -336,6 +336,26 @@ (defvar irchat-pj-startup-interval 2) +(defvar irchat-pj-expire-chanbuf-threshold nil + "Delete channel buffer if buffer line number is more than this value") + +(defvar irchat-pj-expire-chanbuf-lines nil + "Delete lines of channel buffer") + +(defvar irchat-pj-expire-other-threshold nil + "Delete other buffer if buffer line number is more than this value +If nil, use irchat-others-high-watermark as maximal characters") + +(defvar irchat-pj-expire-other-lines nil + "Delete lines of other buffer +This variable is used only when `irchat-pj-expire-other-threshold' is non-nil") + +(defvar irchat-pj-expire-dialogue-threshold nil + "Delete channel buffer if buffer line number is more than this value") + +(defvar irchat-pj-expire-dialogue-lines nil + "Delete lines of dialogue buffer") + ;; That's all (provide 'irchat-vars)