Function: calendar-insert-at-column

calendar-insert-at-column is a byte-compiled function defined in calendar.el.gz.

Signature

(calendar-insert-at-column INDENT STRING TRUNCATE)

Documentation

Move to column INDENT, adding spaces as needed.

Inserts STRING so that it ends at INDENT. STRING is either a literal string, or a sexp to evaluate to return such. Truncates STRING to length TRUNCATE, and ensures a trailing space.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/calendar.el.gz
(defun calendar-insert-at-column (indent string truncate)
  "Move to column INDENT, adding spaces as needed.
Inserts STRING so that it ends at INDENT.  STRING is either a
literal string, or a sexp to evaluate to return such.  Truncates
STRING to length TRUNCATE, and ensures a trailing space."
  (if (not (ignore-errors (stringp (setq string (eval string t)))))
      (calendar-move-to-column indent)
    (if (> (string-width string) truncate)
        (setq string (truncate-string-to-width string truncate)))
    (or (string-match " $" string)
        (setq string (concat (if (= (string-width string) truncate)
                                 (substring string 0 -1)
                               string)
                             ;; Avoid inserting text properties unless
                             ;; we have to (ie, non-unit-width chars).
                             ;; This is by no means essential.
                             (if (= (string-width string) (length string))
                                 " "
                               ;; Cribbed from buff-menu.el.
                               (propertize
                                " " 'display `(space :align-to ,indent))))))
    (calendar-move-to-column (- indent (string-width string)))
    (insert string)))