Finally do something about the famous "midnight bug"
authorSteve Youngs <steve@sxemacs.org>
Sat, 30 Jun 2012 14:51:35 +0000 (00:51 +1000)
committerSteve Youngs <steve@sxemacs.org>
Sat, 30 Jun 2012 14:51:35 +0000 (00:51 +1000)
For years my SXEmacs would crash at midnight if I were running Sawfish and
no SXEmacs frame had the focus.  And even though this changeset doesn't
actually fix the bug, it does mean it won't get triggered again.

* 12-cal-sy.el (sy-update-diary-font-lock-keywords): Removed.
Also remove the #'run-at-time call

* 12-cal-sy.el (calendar-move-hook): Have it update the displayed
diary entries as you move to different dates.

* 12-cal-sy.el (calendar-mode-hook): Update the font-lock keywords
here.

Signed-off-by: Steve Youngs <steve@sxemacs.org>
12-cal-sy.el

index 93a798c..fdfaa81 100644 (file)
@@ -5,7 +5,7 @@
 ;;     Author: Steve Youngs <steve@sxemacs.org>
 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
 ;;    Created: <2007-12-02>
-;; Time-stamp: <Friday Jun 29, 2012 16:25:18 steve>
+;; Time-stamp: <Sunday Jul  1, 2012 00:45:19 steve>
 ;;   Download: <http://bastard.steveyoungs.com/~steve/SXEmacs/inits/>
 ;;   HTMLised: <http://bastard.steveyoungs.com/~steve/SXEmacs/htmlinits/12-cal-sy.html>
 ;;   Git Repo: git clone http://git.sxemacs.org/syinit
@@ -145,15 +145,6 @@ for a fontified Diary buffer."
 
 (defvar fancy-diary-font-lock-keywords (fancy-diary-font-lock-keywords))
 
-(defun sy-update-diary-font-lock-keywords ()
-  (sit-for 1.1)
-  (setq fancy-diary-font-lock-keywords (fancy-diary-font-lock-keywords))
-  ;(with-current-buffer (get-buffer-create fancy-diary-buffer)
-  ;  (font-lock-fontify-buffer))
-  )
-
-(run-at-time "23:59:59" 86400 'sy-update-diary-font-lock-keywords)
-
 ;:*=======================
 ;:* Display ISO week numbers
 ;;
@@ -250,6 +241,11 @@ characters on the line."
             (include-other-diary-files)))
 (add-hook 'mark-diary-entries-hook #'mark-included-diary-files)
 (add-hook 'today-visible-calendar-hook #'calendar-mark-today)
+(add-hook 'calendar-move-hook #'(lambda () (diary-view-entries 1)))
+(add-hook 'calendar-mode-hook
+         #'(lambda ()
+             (setq fancy-diary-font-lock-keywords
+                   (fancy-diary-font-lock-keywords))))
 
 ;:*=======================
 ;:* Appointments