From: ueno Date: Fri, 10 Dec 2004 08:11:36 +0000 (+0000) Subject: * riece.el (riece-shrink-buffer): Shrink buffer based on chars X-Git-Tag: riece-1_0_7~99 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e1dba2ee02cb061f5e9f7fd859d5a570f5727fa;p=elisp%2Friece.git * riece.el (riece-shrink-buffer): Shrink buffer based on chars instead of lines. * riece-options.el (riece-shrink-buffer-remove-chars): New user option. (riece-shrink-buffer-remove-lines): Abolish. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 515fa51..f37d34d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2004-12-10 Daiki Ueno + + * riece.el (riece-shrink-buffer): Shrink buffer based on chars + instead of lines. + + * riece-options.el (riece-shrink-buffer-remove-chars): New user option. + (riece-shrink-buffer-remove-lines): Abolish. + 2004-12-08 Daiki Ueno * test/test-riece-log.el (test-riece-log-delete-directory): diff --git a/lisp/riece-options.el b/lisp/riece-options.el index b0975ba..a06a76c 100644 --- a/lisp/riece-options.el +++ b/lisp/riece-options.el @@ -290,17 +290,17 @@ way is to put Riece variables on .emacs or file loaded from there." :type 'integer :group 'riece-options) -(defcustom riece-shrink-buffer-remove-lines 10 - "Number of lines removed when shrinking channel buffers." - :type 'integer - :group 'riece-options) - (defcustom riece-max-buffer-size 65535 "Maximum size of channel buffers." :type '(radio (integer :tag "Number of characters") (const nil)) :group 'riece-options) +(defcustom riece-shrink-buffer-remove-chars (/ riece-max-send-size 2) + "Number of chars removed when shrinking channel buffers." + :type 'integer + :group 'riece-options) + (defcustom riece-format-time-function #'current-time-string "Function to convert the specified time to the human readable form." :type 'function diff --git a/lisp/riece.el b/lisp/riece.el index a7d8c92..b7c18eb 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -337,15 +337,14 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect." (while (> (buffer-size) riece-max-buffer-size) (let* ((inhibit-read-only t) buffer-read-only - (start (point)) - (end (progn (beginning-of-line - (1+ riece-shrink-buffer-remove-lines)) - (point))) - (overlays (riece-overlays-in start end))) + (end (progn + (goto-char riece-shrink-buffer-remove-chars) + (beginning-of-line 2))) + (overlays (riece-overlays-in (point-min) end))) (while overlays (riece-delete-overlay (car overlays)) (setq overlays (cdr overlays))) - (delete-region start end))))) + (delete-region (point-min) end))))) (defun riece-exit () (if riece-save-variables-are-dirty