]> code.delx.au - gnu-emacs/blobdiff - lisp/calendar/cal-x.el
from trunk
[gnu-emacs] / lisp / calendar / cal-x.el
index 4c5f3d951fd3056ae18c7112f3b89273d7f0607a..90a4c5d33b8489d2f43160f705ce7ae4acc3a279 100644 (file)
@@ -1,7 +1,7 @@
 ;;; cal-x.el --- calendar windows in dedicated frames
 
 ;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008  Free Software Foundation, Inc.
+;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 ;;         Edward M. Reingold <reingold@cs.uiuc.edu>
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,9 +22,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -92,21 +90,25 @@ Runs `calendar-after-frame-setup-hook', selects frame, iconifies if needed."
       (iconify-or-deiconify-frame)))
 
 ;; c-d-d is only called after (diary) has been run.
-(defvar diary-display-hook)
+(defvar diary-display-function)
 
 (defun calendar-dedicate-diary ()
   "Display and dedicate the window associated with the diary buffer."
   (set-window-dedicated-p
    (display-buffer
-    (if (not (or (memq 'diary-fancy-display diary-display-hook)
-                 (memq 'fancy-diary-display diary-display-hook)))
-        (get-file-buffer diary-file)
-      ;; If there are no diary entries, there won't be a fancy-diary
-      ;; to dedicate, so make a basic one.
-      (or (get-buffer diary-fancy-buffer)
-          (calendar-in-read-only-buffer diary-fancy-buffer
-            (calendar-set-mode-line "Diary Entries")))
-      diary-fancy-buffer))
+    (if (if (listp diary-display-function)
+            (or (memq 'diary-fancy-display diary-display-function)
+                (memq 'fancy-diary-display diary-display-function))
+          (memq diary-display-function '(diary-fancy-display
+                                         fancy-diary-display)))
+        (progn
+          ;; If there are no diary entries, there won't be a fancy-diary
+          ;; to dedicate, so make a basic one.
+          (or (get-buffer diary-fancy-buffer)
+              (calendar-in-read-only-buffer diary-fancy-buffer
+                (calendar-set-mode-line "Diary Entries")))
+          diary-fancy-buffer)
+      (get-file-buffer diary-file)))
    t))
 
 ;;;###cal-autoload