Function: mh-truncate-log-buffer

mh-truncate-log-buffer is a byte-compiled function defined in mh-buffers.el.gz.

Signature

(mh-truncate-log-buffer)

Documentation

If mh-log-buffer is too big then truncate it.

If the number of lines in mh-log-buffer exceeds mh-log-buffer-lines then keep only the last mh-log-buffer-lines. As a side effect the point is set to the end of the log buffer.

The function returns the size of the final size of the log buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-buffers.el.gz
(defun mh-truncate-log-buffer ()
  "If `mh-log-buffer' is too big then truncate it.
If the number of lines in `mh-log-buffer' exceeds
`mh-log-buffer-lines' then keep only the last
`mh-log-buffer-lines'. As a side effect the point is set to the
end of the log buffer.

The function returns the size of the final size of the log buffer."
  (with-current-buffer (get-buffer-create mh-log-buffer)
    (goto-char (point-max))
    (save-excursion
      (when (equal (forward-line (- mh-log-buffer-lines)) 0)
        (delete-region (point-min) (point))))
    (unless (or (bobp)
                (save-excursion
                  (and (equal (forward-line -1) 0) (equal (char-after) ?))))
      (insert "\n\n"))
    (buffer-size)))