comparison 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
comparison
equal deleted inserted replaced
117:578fd4947a72 118:7d55a9ba150c
686 (message ""))) 686 (message "")))
687 687
688 688
689 ;;; Patching in to existing time code to install our hook. 689 ;;; Patching in to existing time code to install our hook.
690 690
691 (defvar display-time-hook nil
692 "*List of functions to be called when the time is updated on the mode line.")
693
694 (setq display-time-hook 'appt-check)
695 691
696 (defvar display-time-hook-installed nil) 692 (defvar display-time-hook-installed nil)
697 693
698 (defun install-display-time-hook () 694 (defun install-display-time-hook ()
699 (if display-time-hook-installed ;; only do this stuff once! 695 (unless display-time-hook-installed ; only do this stuff once!
700 nil 696 (unless (boundp 'display-time-hook) ; Need to wrapper it.
701 (let ((old-fn (if (or (featurep 'reportmail) 697 (defvar display-time-hook nil
702 ;; old reportmail without a provide statement 698 "*List of functions to be called when the time is updated on the mode line.")
703 (and (fboundp 'display-time-filter-18-55) 699 (let ((old-fn (if (or (featurep 'reportmail)
704 (fboundp 'display-time-filter-18-57))) 700 ;; old reportmail without a provide statement
705 (if (and (featurep 'itimer) ; XEmacs reportmail.el 701 (and (fboundp 'display-time-filter-18-55)
706 (fboundp 'display-time-timer-function)) 702 (fboundp 'display-time-filter-18-57)))
707 'display-time-timer-function 703 (if (and (featurep 'itimer) ; XEmacs reportmail.el
708 ;; older reportmail, or no timer.el. 704 (fboundp 'display-time-timer-function))
709 (if (string-match "18\\.5[0-5]" (emacs-version)) 705 'display-time-timer-function
710 'display-time-filter-18-55 706 ;; older reportmail, or no timer.el.
711 'display-time-filter-18-57)) 707 (if (string-match "18\\.5[0-5]" (emacs-version))
712 ;; othewise, time.el 708 'display-time-filter-18-55
713 (if (and (featurep 'itimer) 709 'display-time-filter-18-57))
714 (fboundp 'display-time-function)) ; XEmacs 710 ;; othewise, time.el
715 'display-time-function 711 (if (and (featurep 'itimer)
716 'display-time-filter)))) 712 (fboundp 'display-time-function)) ; XEmacs
713 'display-time-function
714 'display-time-filter))))
717 ;; we're about to redefine it... 715 ;; we're about to redefine it...
718 (fset 'old-display-time-filter (symbol-function old-fn)) 716 (fset 'old-display-time-filter (symbol-function old-fn))
719 (fset old-fn 717 (fset old-fn
720 (function (lambda (&rest args) ;; ...here's the revised definition 718 '(lambda (&rest args) ;; ...here's the revised definition
721 "Revised version of the original function: this version calls a hook." 719 "Revised version of the original function: this version calls a hook."
722 (apply 'old-display-time-filter args) 720 (apply 'old-display-time-filter args)
723 (run-hooks 'display-time-hook))))) 721 (run-hooks 'display-time-hook)))))
724 (setq display-time-hook-installed t) 722 (setq display-time-hook-installed t)
725 )) 723 (if (fboundp 'add-hook)
724 (add-hook 'display-time-hook 'appt-check)
725 (setq display-time-hook (cons appt-check display-time-hook)))
726 ))
726 727
727 (provide 'appt) 728 (provide 'appt)