Function: calendar-set-mode-line

calendar-set-mode-line is a byte-compiled function defined in calendar.el.gz.

Signature

(calendar-set-mode-line STR)

Documentation

Set mode line to STR, centered, surrounded by dashes.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/calendar.el.gz
(defun calendar-set-mode-line (str)
  "Set mode line to STR, centered, surrounded by dashes."
  (let* ((edges (window-edges))
         ;; As per doc of window-width, total visible mode-line length.
         (width (- (nth 2 edges) (car edges))))
    ;; Hack for --daemon.  See bug #2199.
    ;; If no frame exists yet, we have no idea what width to use.
    (and (= width 10)
         (not window-system)
         (setq width (string-to-number (or (getenv "COLUMNS") "80"))))
    (setq mode-line-format
          (if buffer-file-name
              `("-" mode-line-modified
                ,(calendar-string-spread (list str) ?- (- width 6))
                "---")
            (calendar-string-spread (list str) ?- width)))))