Commit 23010255 authored by Ulrik Haugen's avatar Ulrik Haugen
Browse files

lyskom-trim-buffer seems to work now.

parent 331ca4db
2000-08-31 Ulrik Haugen <qha@lysator.liu.se>
* lyskom-rest.el (lyskom-trim-buffer): saves point and mark and
resets point, mark and lyskom-last-viewed after taking into
consideration lyskom-trim-buffer-delete-to.
Thu Aug 31 14:38:34 2000 David Byers <davby@sen2.ida.liu.se>
* Release av 0.46-BETA-Q
......
......@@ -774,19 +774,28 @@ found in lyskom-membership, a blocking call to the server is made."
(defvar lyskom-trim-buffer-delete-to)
(defun lyskom-trim-buffer ()
"Trim the size of a lyskom buffer to lyskom-max-buffer-size"
"Trim the size of a lyskom buffer to lyskom-max-buffer-size
returns t if it trimmed the buffer, nil otherwise."
(when (and kom-max-buffer-size
(> (- (buffer-size) kom-trim-buffer-minimum) kom-max-buffer-size))
(lyskom-save-excursion
(let ((lyskom-trim-buffer-delete-to (- (buffer-size)
kom-max-buffer-size))
(old-point (point))
(old-mark (mark))
(inhibit-read-only t))
(goto-char (point-min))
(while (< (point) lyskom-trim-buffer-delete-to)
(forward-line 1))
(setq lyskom-trim-buffer-delete-to (point))
(run-hooks 'lyskom-trim-buffer-hook)
(delete-region (point-min) lyskom-trim-buffer-delete-to)))))
(delete-region (point-min) lyskom-trim-buffer-delete-to)
(setq lyskom-last-viewed
(- (+ lyskom-last-viewed 1) lyskom-trim-buffer-delete-to))
(set-mark (- (+ old-mark 1) lyskom-trim-buffer-delete-to))
(goto-char (- (+ old-point 1) lyskom-trim-buffer-delete-to))))
t))
(defun lyskom-garb-lyskom-buffer-to-file ()
"Appends the deleted initial portions of the buffer to a file.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment