Function: org-agenda-prepare-window

org-agenda-prepare-window is a byte-compiled function defined in org-agenda.el.gz.

Signature

(org-agenda-prepare-window ABUF FILTER-ALIST)

Documentation

Setup agenda buffer in the window.

ABUF is the buffer for the agenda window. FILTER-ALIST is an alist of filters we need to apply when org-agenda-persistent-filter is non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
(defun org-agenda-prepare-window (abuf filter-alist)
  "Setup agenda buffer in the window.
ABUF is the buffer for the agenda window.
FILTER-ALIST is an alist of filters we need to apply when
`org-agenda-persistent-filter' is non-nil."
  (let* ((awin (get-buffer-window abuf)) wconf)
    (cond
     ((equal (current-buffer) abuf) nil)
     (awin (select-window awin))
     ((not (setq wconf (current-window-configuration))))
     ((eq org-agenda-window-setup 'current-window)
      (pop-to-buffer-same-window abuf))
     ((eq org-agenda-window-setup 'other-window)
      (switch-to-buffer-other-window abuf))
     ((eq org-agenda-window-setup 'other-frame)
      (switch-to-buffer-other-frame abuf))
     ((eq org-agenda-window-setup 'other-tab)
      (if (fboundp 'switch-to-buffer-other-tab)
	  (switch-to-buffer-other-tab abuf)
	(user-error "Your version of Emacs does not have tab bar support")))
     ((eq org-agenda-window-setup 'only-window)
      (pop-to-buffer abuf '(org-display-buffer-full-frame)))
     ((eq org-agenda-window-setup 'reorganize-frame)
      (pop-to-buffer abuf '(org-display-buffer-split))))
    (setq org-agenda-tag-filter (cdr (assq 'tag filter-alist)))
    (setq org-agenda-category-filter (cdr (assq 'cat filter-alist)))
    (setq org-agenda-effort-filter (cdr (assq 'effort filter-alist)))
    (setq org-agenda-regexp-filter (cdr (assq 're filter-alist)))
    ;; Additional test in case agenda is invoked from within agenda
    ;; buffer via elisp link.
    (unless (equal (current-buffer) abuf)
      (pop-to-buffer-same-window abuf))
    (setq org-agenda-pre-window-conf
	  (or wconf org-agenda-pre-window-conf))))