Function: reftex-truncate

reftex-truncate is a byte-compiled function defined in reftex.el.gz.

Signature

(reftex-truncate STRING NCOLS &optional ELLIPSES PADDING)

Documentation

Truncate STRING to NCOLS characters.

When PADDING is non-nil, and string is shorter than NCOLS, fill with white space to NCOLS characters. When ELLIPSES is non-nil and the string needs to be truncated, replace last 3 characters by dots.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex.el.gz
(defun reftex-truncate (string ncols &optional ellipses padding)
  "Truncate STRING to NCOLS characters.
When PADDING is non-nil, and string is shorter than NCOLS, fill with
white space to NCOLS characters.  When ELLIPSES is non-nil and the
string needs to be truncated, replace last 3 characters by dots."
  (setq string
        (if (<= (length string) ncols)
            string
          (if ellipses
              (concat (substring string 0 (- ncols 3)) "...")
            (substring string 0 ncols))))
  (if padding
      (format (format "%%-%ds" ncols) string)
    string))