Commit bade4804 authored by Johan Sundström's avatar Johan Sundström
Browse files

Bugfix and featuritis in lyskom-trim-buffer to accommodate for my automatic kombuffer log hook.

parent 16be11db
2000-07-30 Johan Sundstrm <jhs@lysator.liu.se>
* lyskom-rest.el (lyskom-trim-buffer): Point no longer flickers
when trimming the buffer.
(lyskom-trim-buffer-hook): New hook; run before the trimming.
(lyskom-trim-buffer-delete-to): New variable; how far the buffer
will be trimmed, useful in lyskom-trim-buffer-hook functions.
(lyskom-garb-lyskom-buffer-to-file): Fairly ugly hack for flowing
the trimmed portion of the lyskom buffer into a file. Ought to use
some configurable variable for the filename.
* commands2.el (kom-next-unread-kom): More info, as suggested by
Hans Persson. Tells whether there are any other sessions
whatsoever when there are no other sessions with unread texts.
......
......@@ -766,18 +766,33 @@ found in lyskom-membership, a blocking call to the server is made."
;;;; ================================================================
;;;; Scrolling and text insertion.
(defvar lyskom-trim-buffer-delete-to)
(defun lyskom-trim-buffer ()
"Trim the size of a lyskom buffer to lyskom-max-buffer-size"
(save-excursion
(if (and kom-max-buffer-size
(when (and kom-max-buffer-size
(> (buffer-size) kom-max-buffer-size))
(let ((delchars (- (buffer-size) kom-max-buffer-size))
(inhibit-read-only t))
(goto-char (point-min))
(while (< (point) delchars)
(forward-line 1))
(delete-region (point-min) (point))))))
(lyskom-save-excursion
(let ((lyskom-trim-buffer-delete-to (- (buffer-size)
kom-max-buffer-size))
(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)))))
(defun lyskom-garb-lyskom-buffer-to-file ()
"Appends the deleted initial portions of the buffer to a file.
Put this function in your lyskom-trim-buffer-hook and set
kom-max-buffer-size to something clever, and the trimmed text
will automagically flow into your lyskom log file."
(append-to-file 1 lyskom-trim-buffer-delete-to
(expand-file-name (concat "~/" (buffer-name) "-history"))))
;(add-hook 'lyskom-trim-buffer-hook 'jhs-garb-lyskom-buffer-to-file)
(defun lyskom-scroll ()
"Scroll screen if necessary.
......
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