Function: cvs-insert-strings

cvs-insert-strings is a byte-compiled function defined in pcvs-util.el.gz.

Signature

(cvs-insert-strings STRINGS)

Documentation

Insert a list of STRINGS into the current buffer.

Uses columns to keep the listing readable but compact.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/pcvs-util.el.gz
;;;;
;;;; string processing
;;;;

(defun cvs-insert-strings (strings)
  "Insert a list of STRINGS into the current buffer.
Uses columns to keep the listing readable but compact."
  (when (consp strings)
    (let* ((length (apply #'max (mapcar #'length strings)))
	   (wwidth (1- (window-width)))
	   (columns (min
		     ;; At least 2 columns; at least 2 spaces between columns.
		     (max 2 (/ wwidth (+ 2 length)))
		     ;; Don't allocate more columns than we can fill.
		     ;; Windows can't show less than 3 lines anyway.
		     (max 1 (/ (length strings) 2))))
	   (colwidth (/ wwidth columns)))
      ;; Use tab-width rather than indent-to.
      (setq tab-width colwidth)
      ;; The insertion should be "sensible" no matter what choices were made.
      (dolist (str strings)
	(unless (bolp)
          (insert " \t")
          (when (< wwidth (+ (max colwidth (length str)) (current-column)))
            (delete-char -2) (insert "\n")))
        (insert str)))))