This is a diary-display-hook that will show a week’s worth of diary appointments in a graph-like view.
You can download the code from Lisp:weekly-view.el.
Attention, do not forget to download http://sacha.free.net.ph/notebook/emacs/cal-desk-calendar.el too.
(require 'weekly-view)
(add-hook 'diary-display-hook 'fancy-diary-display-week-graph)
Here’s an example of what I’m talking about:
| Sunday | Monday | Tuesday |Wednesday | Thursday | Friday | Saturday | ----------------------------------------------------------------------------------- 8:00| | | | | | | | 8:30| | | | | | | | 9:00| | | | | | | | 9:30| | | | | | | | 10:00| | | | | | | | 10:30| | | | | | | | 11:00| | |Quality Co| | | | | 11:30| | |ntrol/Regu| | | | | 12:00| | |lartory Af| | | | | 12:30| | |airs meeti| | | | | 13:00| | | | | | | | 13:30| | | | | | | | 14:00| | | | | | | | 14:30| | | | | | | | 15:00| |Pick up Jo| |Pick up Jo| | | | 15:30| |sh########| |sh########| | | | 16:00| | | | | | | | 16:30| | | | | |Weely Stat| | 17:00| | | | | |us Meeting| | 17:30| | | | | |##########| | -----------------------------------------------------------------------------------
fancy-diary-display-week-graph shows each time when I save a buffer, I have copied code from function fancy-schedule-display-desk-calendar of cal-desk-calendar.el checked for if any appointment is present then only show weekly view.
(defun fancy-diary-display-week-graph-if-appt ()
"Show weekly view only when appointments is there."
(if (or (not diary-entries-list)
(and (not (cdr diary-entries-list))
(string-equal (car (cdr (car diary-entries-list))) "")))
(let* ((holiday-list (if holidays-in-diary-buffer
(check-calendar-holidays original-date)))
(msg (format "No diary entries for %s %s"
(concat date-string (if holiday-list ":" ""))
(mapconcat 'identity holiday-list "; "))))
(if (<= (length msg) (frame-width))
(message msg)
(set-buffer (get-buffer-create holiday-buffer))
(setq buffer-read-only nil)
(calendar-set-mode-line date-string)
(erase-buffer)
(insert (mapconcat 'identity holiday-list "\n"))
(goto-char (point-min))
(set-buffer-modified-p nil)
(setq buffer-read-only t)
(display-buffer holiday-buffer)
(message "No diary entries for %s" date-string)))
(fancy-diary-display-week-graph)))
(require 'weekly-view)
(add-hook 'diary-display-function 'fancy-diary-display-week-graph-if-appt)