comparison lisp/calendar/appt.el @ 48:56c54cf7c5b6 r19-16b90

Import from CVS: tag r19-16b90
author cvs
date Mon, 13 Aug 2007 08:56:04 +0200
parents ec9a17fef872
children 131b0175ea99
comparison
equal deleted inserted replaced
47:11c6df210d7f 48:56c54cf7c5b6
683 (message ""))) 683 (message "")))
684 684
685 685
686 ;;; Patching in to existing time code to install our hook. 686 ;;; Patching in to existing time code to install our hook.
687 687
688 (defvar display-time-hook nil
689 "*List of functions to be called when the time is updated on the mode line.")
690
691 (setq display-time-hook 'appt-check)
692 688
693 (defvar display-time-hook-installed nil) 689 (defvar display-time-hook-installed nil)
694 690
695 (defun install-display-time-hook () 691 (defun install-display-time-hook ()
696 (if display-time-hook-installed ;; only do this stuff once! 692 (unless display-time-hook-installed ; only do this stuff once!
697 nil 693 (unless (boundp 'display-time-hook) ; Need to wrapper it.
698 (let ((old-fn (if (or (featurep 'reportmail) 694 (defvar display-time-hook nil
699 ;; old reportmail without a provide statement 695 "*List of functions to be called when the time is updated on the mode line.")
700 (and (fboundp 'display-time-filter-18-55) 696 (let ((old-fn (if (or (featurep 'reportmail)
701 (fboundp 'display-time-filter-18-57))) 697 ;; old reportmail without a provide statement
702 (if (and (featurep 'itimer) ; XEmacs reportmail.el 698 (and (fboundp 'display-time-filter-18-55)
703 (fboundp 'display-time-timer-function)) 699 (fboundp 'display-time-filter-18-57)))
704 'display-time-timer-function 700 (if (and (featurep 'itimer) ; XEmacs reportmail.el
705 ;; older reportmail, or no timer.el. 701 (fboundp 'display-time-timer-function))
706 (if (string-match "18\\.5[0-5]" (emacs-version)) 702 'display-time-timer-function
707 'display-time-filter-18-55 703 ;; older reportmail, or no timer.el.
708 'display-time-filter-18-57)) 704 (if (string-match "18\\.5[0-5]" (emacs-version))
709 ;; othewise, time.el 705 'display-time-filter-18-55
710 (if (and (featurep 'itimer) 706 'display-time-filter-18-57))
711 (fboundp 'display-time-function)) ; XEmacs 707 ;; othewise, time.el
712 'display-time-function 708 (if (and (featurep 'itimer)
713 'display-time-filter)))) 709 (fboundp 'display-time-function)) ; XEmacs
710 'display-time-function
711 'display-time-filter))))
714 ;; we're about to redefine it... 712 ;; we're about to redefine it...
715 (fset 'old-display-time-filter (symbol-function old-fn)) 713 (fset 'old-display-time-filter (symbol-function old-fn))
716 (fset old-fn 714 (fset old-fn
717 (function (lambda (&rest args) ;; ...here's the revised definition 715 '(lambda (&rest args) ;; ...here's the revised definition
718 "Revised version of the original function: this version calls a hook." 716 "Revised version of the original function: this version calls a hook."
719 (apply 'old-display-time-filter args) 717 (apply 'old-display-time-filter args)
720 (run-hooks 'display-time-hook))))) 718 (run-hooks 'display-time-hook)))))
721 (setq display-time-hook-installed t) 719 (setq display-time-hook-installed t)
722 )) 720 (if (fboundp 'add-hook)
721 (add-hook 'display-time-hook 'appt-check)
722 (setq display-time-hook (cons appt-check display-time-hook)))
723 ))
723 724
724 (provide 'appt) 725 (provide 'appt)