]> code.delx.au - gnu-emacs/blobdiff - lisp/net/mairix.el
Update copyright year to 2015
[gnu-emacs] / lisp / net / mairix.el
index f85983e6e9fa00b210657fde1c90485e518b5362..c1b107932c3961acef17c94f2a796c640bf21c03 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mairix.el --- Mairix interface for Emacs
 
-;; Copyright (C) 2008-201 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2015 Free Software Foundation, Inc.
 
 ;; Author: David Engster <dengste@eml.cc>
 ;; Keywords: mail searching
@@ -222,14 +222,12 @@ Currently there are 'threads and 'flags.")
 
 ;;; RMail
 
-;; Display function:
-(autoload 'rmail "rmail")
-(autoload 'rmail-summary-displayed "rmail")
-(autoload 'rmail-summary "rmailsum")
-(defvar rmail-buffer)
+(declare-function rmail-summary-displayed "rmail" ())
+(declare-function rmail-summary "rmailsum" ()) ; autoloaded in rmail
 
 (defun mairix-rmail-display (folder)
   "Display mbox file FOLDER with RMail."
+  (require 'rmail)
   (let (show-summary)
     ;; If it exists, select existing RMail window
     (when (and (boundp 'rmail-buffer)
@@ -249,6 +247,8 @@ Currently there are 'threads and 'flags.")
     (when show-summary
       (rmail-summary))))
 
+(defvar rmail-buffer)
+
 ;; Fetching mail header field:
 (defun mairix-rmail-fetch-field (field)
   "Get mail header FIELD for current message using RMail."
@@ -757,31 +757,24 @@ VALUES may contain values for editable fields from current article."
     map)
   "'mairix-searches-mode' keymap.")
 
-(defvar mairix-searches-mode-font-lock-keywords)
-
-(defun mairix-searches-mode ()
+(defvar mairix-searches-mode-font-lock-keywords
+  '(("^\\([0-9]+\\)"
+     (1 font-lock-constant-face))
+    ("^[0-9 ]+\\(Name:\\) \\(.*\\)"
+     (1 font-lock-keyword-face) (2 font-lock-string-face))
+    ("^[ ]+\\(Query:\\) \\(.*\\) , "
+     (1 font-lock-keyword-face) (2 font-lock-string-face))
+    (", \\(Threads:\\) \\(.*\\)"
+     (1 font-lock-keyword-face) (2 font-lock-constant-face))
+    ("^\\([A-Z].*\\)$"
+     (1 font-lock-comment-face))
+    ("^[ ]+\\(Folder:\\) \\(.*\\)"
+     (1 font-lock-keyword-face) (2 font-lock-string-face))))
+
+(define-derived-mode mairix-searches-mode fundamental-mode "mairix-searches"
   "Major mode for editing mairix searches."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'mairix-searches-mode)
-  (setq mode-name "mairix-searches")
-  (set-syntax-table text-mode-syntax-table)
-  (use-local-map mairix-searches-mode-map)
-  (make-local-variable 'font-lock-defaults)
-  (setq mairix-searches-mode-font-lock-keywords
-       (list (list "^\\([0-9]+\\)"
-                   '(1 font-lock-constant-face))
-             (list "^[0-9 ]+\\(Name:\\) \\(.*\\)"
-                   '(1 font-lock-keyword-face) '(2 font-lock-string-face))
-             (list "^[ ]+\\(Query:\\) \\(.*\\) , "
-                   '(1 font-lock-keyword-face) '(2 font-lock-string-face))
-             (list ", \\(Threads:\\) \\(.*\\)"
-                   '(1 font-lock-keyword-face) '(2 font-lock-constant-face))
-             (list "^\\([A-Z].*\\)$"
-                   '(1 font-lock-comment-face))
-             (list "^[ ]+\\(Folder:\\) \\(.*\\)"
-                   '(1 font-lock-keyword-face) '(2 font-lock-string-face))))
-  (setq font-lock-defaults '(mairix-searches-mode-font-lock-keywords)))
+  :syntax-table text-mode-syntax-table
+  (setq-local font-lock-defaults '(mairix-searches-mode-font-lock-keywords)))
 
 (defun mairix-build-search-list ()
   "Display saved searches in current buffer."