Mercurial > emacs
comparison lisp/calendar/calendar.el @ 101938:0c901689da73
(calendar-window-list): Ignore invisible windows.
(calendar-set-mode-line): Fall back to a default width if we seem to be
called from daemon. (Bug#2199)
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 11 Feb 2009 04:02:16 +0000 |
parents | 3d527c23c151 |
children | 3206ad427d3c |
comparison
equal
deleted
inserted
replaced
101937:e6f035f6e27e | 101938:0c901689da73 |
---|---|
1721 | 1721 |
1722 (defun calendar-window-list () | 1722 (defun calendar-window-list () |
1723 "List of all calendar-related windows." | 1723 "List of all calendar-related windows." |
1724 (let ((calendar-buffers (calendar-buffer-list)) | 1724 (let ((calendar-buffers (calendar-buffer-list)) |
1725 list) | 1725 list) |
1726 ;; Using 0 rather than t for last argument - see bug#2199. | |
1727 ;; This is only used with calendar-hide-window, which ignores | |
1728 ;; iconified frames anyway, so could use 'visible rather than 0. | |
1726 (walk-windows (lambda (w) | 1729 (walk-windows (lambda (w) |
1727 (if (memq (window-buffer w) calendar-buffers) | 1730 (if (memq (window-buffer w) calendar-buffers) |
1728 (push w list))) | 1731 (push w list))) |
1729 nil t) | 1732 nil 0) |
1730 list)) | 1733 list)) |
1731 | 1734 |
1732 (defun calendar-buffer-list () | 1735 (defun calendar-buffer-list () |
1733 "List of all calendar-related buffers (as buffers, not strings)." | 1736 "List of all calendar-related buffers (as buffers, not strings)." |
1734 (let (buffs) | 1737 (let (buffs) |
2459 (defun calendar-set-mode-line (str) | 2462 (defun calendar-set-mode-line (str) |
2460 "Set mode line to STR, centered, surrounded by dashes." | 2463 "Set mode line to STR, centered, surrounded by dashes." |
2461 (let* ((edges (window-edges)) | 2464 (let* ((edges (window-edges)) |
2462 ;; As per doc of window-width, total visible mode-line length. | 2465 ;; As per doc of window-width, total visible mode-line length. |
2463 (width (- (nth 2 edges) (car edges)))) | 2466 (width (- (nth 2 edges) (car edges)))) |
2467 ;; Hack for --daemon. See bug #2199. | |
2468 ;; If no frame exists yet, we have no idea what width to use. | |
2469 (and (= width 10) | |
2470 (not window-system) | |
2471 (setq width (or (getenv "COLUMNS") 80))) | |
2464 (setq mode-line-format | 2472 (setq mode-line-format |
2465 (if buffer-file-name | 2473 (if buffer-file-name |
2466 `("-" mode-line-modified | 2474 `("-" mode-line-modified |
2467 ,(calendar-string-spread (list str) ?- (- width 6)) | 2475 ,(calendar-string-spread (list str) ?- (- width 6)) |
2468 "---") | 2476 "---") |