]> code.delx.au - gnu-emacs/blobdiff - lisp/net/eudc.el
Update copyright year to 2015
[gnu-emacs] / lisp / net / eudc.el
index 3f24a78cbbe403b4b3be655e419ed8ea6d8d1256..0f2fc0be7bd8e53218eade81fcd7a6ef2aa3d7cc 100644 (file)
@@ -1,9 +1,9 @@
-;;; eudc.el --- Emacs Unified Directory Client
+;;; eudc.el --- Emacs Unified Directory Client -*- coding: utf-8 -*-
 
-;; Copyright (C) 1998-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2015 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
-;; Maintainer: Pavel Janík <Pavel@Janik.cz>
+;; Maintainer: Pavel Janík <Pavel@Janik.cz>
 ;; Keywords: comm
 
 ;; This file is part of GNU Emacs.
@@ -48,9 +48,7 @@
 
 (eval-and-compile
   (if (not (fboundp 'make-overlay))
-      (require 'overlay))
-  (if (not (fboundp 'unless))
-      (require 'cl)))
+      (require 'overlay)))
 
 (unless (fboundp 'custom-menu-create)
   (autoload 'custom-menu-create "cus-edit"))
@@ -520,12 +518,12 @@ otherwise they are formatted according to `eudc-user-attribute-names-alist'."
           precords))
        (insert "\n")
        (widget-create 'push-button
-                      :notify (lambda (&rest ignore)
+                      :notify (lambda (&rest _ignore)
                                 (eudc-query-form))
                       "New query")
        (widget-insert " ")
        (widget-create 'push-button
-                      :notify (lambda (&rest ignore)
+                      :notify (lambda (&rest _ignore)
                                 (kill-this-buffer))
                       "Quit")
        (eudc-mode)
@@ -654,7 +652,7 @@ Each copy is added a new field containing one of the values of FIELD."
     result))
 
 
-(defun eudc-mode ()
+(define-derived-mode eudc-mode special-mode "EUDC"
   "Major mode used in buffers displaying the results of directory queries.
 There is no sense in calling this command from a buffer other than
 one containing the results of a directory query.
@@ -665,15 +663,9 @@ These are the special commands of EUDC mode:
     n -- Move to next record.
     p -- Move to previous record.
     b -- Insert record at point into the BBDB database."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'eudc-mode)
-  (setq mode-name "EUDC")
-  (use-local-map eudc-mode-map)
   (if (not (featurep 'xemacs))
       (easy-menu-define eudc-emacs-menu eudc-mode-map "" (eudc-menu))
-    (setq mode-popup-menu (eudc-menu)))
-  (run-mode-hooks 'eudc-mode-hook))
+    (setq mode-popup-menu (eudc-menu))))
 
 ;;}}}
 
@@ -997,17 +989,17 @@ queries the server for the existing fields and displays a corresponding form."
          fields)
     (widget-insert "\n\n")
     (widget-create 'push-button
-                  :notify (lambda (&rest ignore)
+                  :notify (lambda (&rest _ignore)
                             (eudc-process-form))
                   "Query Server")
     (widget-insert " ")
     (widget-create 'push-button
-                  :notify (lambda (&rest ignore)
+                  :notify (lambda (&rest _ignore)
                             (eudc-query-form))
                   "Reset Form")
     (widget-insert " ")
     (widget-create 'push-button
-                  :notify (lambda (&rest ignore)
+                  :notify (lambda (&rest _ignore)
                             (kill-this-buffer))
                   "Quit")
     (goto-char pt)
@@ -1086,7 +1078,7 @@ queries the server for the existing fields and displays a corresponding form."
 (defun eudc-move-to-next-record ()
   "Move to next record, in a buffer displaying directory query results."
   (interactive)
-  (if (not (eq major-mode 'eudc-mode))
+  (if (not (derived-mode-p 'eudc-mode))
       (error "Not in a EUDC buffer")
     (let ((pt (next-overlay-change (point))))
       (if (< pt (point-max))
@@ -1096,7 +1088,7 @@ queries the server for the existing fields and displays a corresponding form."
 (defun eudc-move-to-previous-record ()
   "Move to previous record, in a buffer displaying directory query results."
   (interactive)
-  (if (not (eq major-mode 'eudc-mode))
+  (if (not (derived-mode-p 'eudc-mode))
       (error "Not in a EUDC buffer")
     (let ((pt (previous-overlay-change (point))))
       (if (> pt (point-min))
@@ -1124,7 +1116,7 @@ queries the server for the existing fields and displays a corresponding form."
          (overlay-get (car (overlays-at (point))) 'eudc-record))
      :help "Insert record at point into the BBDB database"]
     ["Insert All Records into BBDB" eudc-batch-export-records-to-bbdb
-     (and (eq major-mode 'eudc-mode)
+     (and (derived-mode-p 'eudc-mode)
          (or (featurep 'bbdb)
              (prog1 (locate-library "bbdb") (message ""))))
      :help "Insert all the records returned by a directory query into BBDB"]
@@ -1213,7 +1205,7 @@ queries the server for the existing fields and displays a corresponding form."
 ;;; Load the options file
 (if (and (not noninteractive)
         (and (locate-library eudc-options-file)
-             (progn (message "") t))   ; Remove modeline message
+             (progn (message "") t))   ; Remove mode line message
         (not (featurep 'eudc-options-file)))
     (load eudc-options-file))