diff lisp/calendar/appt.el @ 118:7d55a9ba150c r20-1b11

Import from CVS: tag r20-1b11
author cvs
date Mon, 13 Aug 2007 09:24:17 +0200
parents 9f59509498e1
children 9b50b4588a93
line wrap: on
line diff
--- a/lisp/calendar/appt.el	Mon Aug 13 09:23:08 2007 +0200
+++ b/lisp/calendar/appt.el	Mon Aug 13 09:24:17 2007 +0200
@@ -688,40 +688,41 @@
 
 ;;; Patching in to existing time code to install our hook.
 
-(defvar display-time-hook nil
-  "*List of functions to be called when the time is updated on the mode line.")
-
-(setq display-time-hook 'appt-check)
 
 (defvar display-time-hook-installed nil)
 
 (defun install-display-time-hook ()
- (if display-time-hook-installed         ;; only do this stuff once!
-    nil
-  (let ((old-fn (if (or (featurep 'reportmail)
-			;; old reportmail without a provide statement
-			(and (fboundp 'display-time-filter-18-55)
-			     (fboundp 'display-time-filter-18-57)))
-		    (if (and (featurep 'itimer)  ; XEmacs reportmail.el
-			     (fboundp 'display-time-timer-function))
-			'display-time-timer-function
-		      ;; older reportmail, or no timer.el.
-		      (if (string-match "18\\.5[0-5]" (emacs-version))
-			  'display-time-filter-18-55
-			'display-time-filter-18-57))
-		  ;; othewise, time.el
-		  (if (and (featurep 'itimer)
-			   (fboundp 'display-time-function)) ; XEmacs
-		      'display-time-function
-		    'display-time-filter))))
+ (unless display-time-hook-installed	; only do this stuff once!
+   (unless (boundp 'display-time-hook)	; Need to wrapper it.
+     (defvar display-time-hook nil
+       "*List of functions to be called when the time is updated on the mode line.")
+     (let ((old-fn (if (or (featurep 'reportmail)
+			   ;; old reportmail without a provide statement
+			   (and (fboundp 'display-time-filter-18-55)
+				(fboundp 'display-time-filter-18-57)))
+		       (if (and (featurep 'itimer)  ; XEmacs reportmail.el
+				(fboundp 'display-time-timer-function))
+			   'display-time-timer-function
+			 ;; older reportmail, or no timer.el.
+			 (if (string-match "18\\.5[0-5]" (emacs-version))
+			     'display-time-filter-18-55
+			   'display-time-filter-18-57))
+		     ;; othewise, time.el
+		     (if (and (featurep 'itimer)
+			      (fboundp 'display-time-function)) ; XEmacs
+			 'display-time-function
+		       'display-time-filter))))
     ;; we're about to redefine it...
-    (fset 'old-display-time-filter (symbol-function old-fn))
-    (fset old-fn
-	  (function (lambda (&rest args)  ;; ...here's the revised definition
-	    "Revised version of the original function: this version calls a hook."
-	    (apply 'old-display-time-filter args)
-	    (run-hooks 'display-time-hook)))))
-  (setq display-time-hook-installed t)
-  ))
+       (fset 'old-display-time-filter (symbol-function old-fn))
+       (fset old-fn
+	     '(lambda (&rest args)  ;; ...here's the revised definition
+		"Revised version of the original function: this version calls a hook."
+		(apply 'old-display-time-filter args)
+		(run-hooks 'display-time-hook)))))
+   (setq display-time-hook-installed t)
+   (if (fboundp 'add-hook)
+       (add-hook 'display-time-hook 'appt-check)
+     (setq display-time-hook (cons appt-check display-time-hook)))
+   ))
 
 (provide 'appt)