; Author: Peter Gacs, Sept 30, 1997 ; ; The following macros help you manage a simple but (I find) very ; convenient calendar. ; The calendar is my directory /home/dawn/gacs/n, so you would have to ; change this part accordingly. ; The principle is that each appointment is a separate file, whose name ; guarantees that the appointments are sorted by time in the directory. ; A typical filename is ; 10-01.14:00.colloq ; The great advantage of this system is that as you read your mail, if you ; want to use a mail message to create an appointment you can simply file ; the whole mail message into the file with the appropriate name. If the ; file already exists the message will be appended. ; If you happen to read your mail in emacs then even this process is ; made a little simpler for you. This part is only written for mh-rmail, ; but the principle would be the same for rmail. (defun my-diary () "Opens the calendar directory in dired mode in the other window." (interactive) (find-file-other-window "/home/dawn/gacs/n") ) (define-key ctl-x-map "" 'my-diary) ; now, C-x C-a calls my-diary (defun pad-string (s) "Pads a string smaller than 2 characters by a 0 in front." (cond ((= (length s) 0) "00") ((= (length s) 1) (concat "0" s)) (t s) )) (defun get-calendar-file-name () "Creates a calendar file name." (let ( (Month (pad-string (read-string "Month: "))) (Day (pad-string (read-string "Day: "))) (Hour (pad-string (read-string "Hour: "))) (Minute (pad-string (read-string "Minute: "))) (Topic (read-string "Topic: ")) ) (concat "/home/dawn/gacs/n/" Month "-" Day "." Hour ":" Minute "." Topic) )) (defun new-calendar-file () (interactive) "Opens a new or existing calendar file in the other window." (find-file-other-window (get-calendar-file-name) )) (define-key ctl-x-map "N" 'new-calendar-file) (defun my-mh-add-msg-to-calendar-file () (interactive) "If you use mh in emacs, this writes the current message you are looking at to the calendar file whose data it will ask for." (mh-write-msg-to-file (mh-get-msg-num 't) (get-calendar-file-name) nil )) ; If you use mh in emacs, this is the way to define keys in the ; mh-folder-mode. (add-hook 'mh-folder-mode-hook (lambda () (define-key mh-folder-mode-map "N" 'my-mh-add-msg-to-calendar-file) ))