dot/emacs: Better grip on when `M-x calendar' shows things.
[profile] / dot / emacs
index 708ea7b..52a9a1c 100644 (file)
--- a/dot/emacs
+++ b/dot/emacs
 
 (or mdw-fast-startup
     (trap (bbdb-initialize 'gnus 'sendmail 'message)))
-(setq bbdb-file "~/etc/state/bbdb"
+(setq bbdb-file "~/etc/brain/bbdb"
       bbdb-north-american-phone-numbers-p nil
-      bbdb/news-auto-create-p (lambda ()
-                               (string-match "^nnimap\\+"
-                                             gnus-newsgroup-name))
+      bbdb/news-auto-create-p
+      (lambda ()
+       (let ((group gnus-newsgroup-name))
+         (and (string-match "^nnimap\\+" group)
+              (not (string-match ":\\(crap\\|spam\\)\\." group)))))
       bbdb-user-mail-names
       (concat "^"
              "\\(" "\\(mdw\\|markw\\|root\\|postmaster\\)"
                                     "@\\(nationwide-communications\\.co\\.uk\\)")
                             addr)
               (concat "nationwide@" (match-string 1 addr)))
+             ((string-match (concat "^[0-9]+@bugs\\."
+                                    "\\(" "debian\\.org"
+                                    "\\|" "distorted\\.org\\.uk"
+                                    "\\)")
+                            addr)
+              (concat "submit@bugs." (match-string 1 addr)))
              (t addr))))
 
 ;; Customization.
 ;;;--------------------------------------------------------------------------
 ;;; Calendar configuration.
 
-(setq diary-file "~/etc/state/diary")
+(setq diary-file
+      (let ((main-diary "~/etc/brain/diary")
+           (index "~/etc/index.diary"))
+       (if (file-exists-p index)
+           index
+         main-diary)))
 
 ;; Trivial stuff for the sunrise/sunset calculations.
 
 ;; Date format fiddling.
 
 (setq european-calendar-style t
-      calendar-date-style 'european)
-
-(setq diary-date-forms '((day "[-/]" month "[^-/0-9]")
-                        (day " *" monthname "[ \t]*\\(\^M\\|\n\\)")
-                        (backup day " *" monthname "\\W+\\<[^*0-9]")
-                        (day "[-/]" month "[-/]" year "[^0-9]")
-                        (day " *" monthname " *" year "[^0-9]")
-                        (year "[-/]" month "[-/]" day "[^0-9]")
-                        (dayname "\\W")))
+      calendar-date-style 'european
+      calendar-time-display-form
+      '(24-hours ":" minutes
+       (if time-zone " (") time-zone (if time-zone ")")))
+
+(setq diary-date-forms
+      '((day "[-/]" month "[^-/0-9]")
+       (day " *" monthname "[ \t]*\\(\^M\\|\n\\)")
+       (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|[0-9]+[:aApP]\\)")
+       (day "[-/]" month "[-/]" year "[^0-9]")
+       (day " *" monthname " *" year "[^0-9]")
+       (year "[-/]" month "[-/]" day "[^0-9]")
+       (dayname "\\W")))
 
 ;; Fancy diary handling.
 
 (add-hook 'diary-display-hook 'fancy-diary-display)
 (setq diary-list-include-blanks t)
-(add-hook 'list-diary-entries-hook 'sort-diary-entries t)
-(add-hook 'list-diary-entries-hook 'include-other-diary-files)
-(add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
+(cond ((mdw-emacs-version-p 23 1)
+       (add-hook 'list-diary-entries-hook 'diary-include-other-diary-files)
+       (add-hook 'mark-diary-entries-hook 'diary-mark-included-diary-files))
+      (t
+       (add-hook 'list-diary-entries-hook 'include-other-diary-files)
+       (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)))
 
 ;; Appointment management.
 
 ;; Org-mode agenda.
 
 (setq org-agenda-include-diary t
+      org-directory "~/etc/brain.local/"
+      org-default-notes-file (concat org-directory "local.org")
       org-tags-column -77)
 
 ;; Cosmetic stuff.
 
-(setq calendar-view-diary-initially-flag t
-      calendar-view-holidays-initially-flag t)
+(setq calendar-view-diary-initially-flag nil
+      calendar-view-holidays-initially-flag nil
+      calendar-mark-diary-entries-flag t)
 
 (setq display-time-24hr-format t)
 (display-time)
 (column-number-mode 1)
-(trap (if window-system (calendar)))
+(trap
+  (if window-system
+      (let ((calendar-view-diary-initially-flag t))
+       (calendar))))
 
 ;;;--------------------------------------------------------------------------
 ;;; MailCrypt.