Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[bpt/emacs.git] / lisp / net / eudc.el
index b93f7e3..621b9b9 100644 (file)
@@ -1,7 +1,6 @@
 ;;; eudc.el --- Emacs Unified Directory Client
 
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-;;   2007, 2008, 2009  Free Software Foundation, Inc.
+;; Copyright (C) 1998-2013 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
@@ -49,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"))
       (setq plist (cdr (cdr plist))))
     nil))
 
-;; Emacs' plist-get lacks third parameter
+;; Emacs's plist-get lacks third parameter
 (defun eudc-plist-get (plist prop &optional default)
   "Extract a value from a property list.
 PLIST is a property list, which is a list of the form
@@ -352,12 +349,12 @@ accordingly. Otherwise it is set to its EUDC default binding"
 The translation is done according to
 `eudc-protocol-attributes-translation-alist'."
   (if eudc-protocol-attributes-translation-alist
-      (mapcar '(lambda (attribute)
-                (let ((trans (assq (car attribute)
-                                   (symbol-value eudc-protocol-attributes-translation-alist))))
-                  (if trans
-                      (cons (cdr trans) (cdr attribute))
-                    attribute)))
+      (mapcar (lambda (attribute)
+                (let ((trans (assq (car attribute)
+                                   (symbol-value eudc-protocol-attributes-translation-alist))))
+                  (if trans
+                      (cons (cdr trans) (cdr attribute))
+                    attribute)))
              query)
     query))
 
@@ -367,7 +364,7 @@ The translation is done according to
 `eudc-protocol-attributes-translation-alist'."
   (if eudc-protocol-attributes-translation-alist
       (let (trans)
-       (mapcar '(lambda (attribute)
+       (mapcar (lambda (attribute)
                   (setq trans (assq attribute
                                     (symbol-value eudc-protocol-attributes-translation-alist)))
                   (if trans
@@ -693,7 +690,7 @@ server for future sessions."
   (interactive (list
                (read-from-minibuffer "Directory Server: ")
                (intern (completing-read "Protocol: "
-                                        (mapcar '(lambda (elt)
+                                        (mapcar (lambda (elt)
                                                    (cons (symbol-name elt)
                                                          elt))
                                                 eudc-known-protocols)))))
@@ -797,7 +794,7 @@ If none try N - 1 and so forth."
                (> n 0))
       (setq formats
            (delq nil
-                 (mapcar '(lambda (format)
+                 (mapcar (lambda (format)
                             (if (= n
                                    (length format))
                                 format
@@ -830,10 +827,7 @@ see `eudc-inline-expansion-servers'"
   (let* ((end (point))
         (beg (save-excursion
                (if (re-search-backward "\\([:,]\\|^\\)[ \t]*"
-                                       (save-excursion
-                                         (beginning-of-line)
-                                         (point))
-                                       'move)
+                                       (point-at-bol) 'move)
                    (goto-char (match-end 0)))
                (point)))
         (query-words (split-string (buffer-substring beg end) "[ \t]+"))
@@ -1036,8 +1030,7 @@ queries the server for the existing fields and displays a corresponding form."
 (defun eudc-save-options ()
   "Save options to `eudc-options-file'."
   (interactive)
-  (save-excursion
-    (set-buffer (find-file-noselect eudc-options-file t))
+  (with-current-buffer (find-file-noselect eudc-options-file t)
     (goto-char (point-min))
     ;; delete the previous setq
     (let ((standard-output (current-buffer))
@@ -1218,7 +1211,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))
 
@@ -1242,25 +1235,25 @@ This does nothing except loading eudc by autoload side-effect."
   (defvar eudc-tools-menu
     (let ((map (make-sparse-keymap "Directory Search")))
       (define-key map [phone]
-       '(menu-item "Get Phone" eudc-get-phone
-                   :help "Get the phone field of name from the directory server"))
+       `(menu-item ,(purecopy "Get Phone") eudc-get-phone
+                   :help ,(purecopy "Get the phone field of name from the directory server")))
       (define-key map [email]
-       '(menu-item "Get Email" eudc-get-email
-                   :help "Get the email field of NAME from the directory server"))
-      (define-key map [separator-eudc-email] '("--"))
+       `(menu-item ,(purecopy "Get Email") eudc-get-email
+                   :help ,(purecopy "Get the email field of NAME from the directory server")))
+      (define-key map [separator-eudc-email] menu-bar-separator)
       (define-key map [expand-inline]
-       '(menu-item "Expand Inline Query" eudc-expand-inline
-                   :help "Query the directory server, and expand the query string before point"))
+       `(menu-item ,(purecopy "Expand Inline Query") eudc-expand-inline
+                   :help ,(purecopy "Query the directory server, and expand the query string before point")))
       (define-key map [query]
-       '(menu-item "Query with Form" eudc-query-form
-                   :help "Display a form to query the directory server"))
-      (define-key map [separator-eudc-query] '("--"))
+       `(menu-item ,(purecopy "Query with Form") eudc-query-form
+                   :help ,(purecopy "Display a form to query the directory server")))
+      (define-key map [separator-eudc-query] menu-bar-separator)
       (define-key map [new]
-       '(menu-item "New Server" eudc-set-server
-                   :help "Set the directory server to SERVER using PROTOCOL"))
+       `(menu-item ,(purecopy "New Server") eudc-set-server
+                   :help ,(purecopy "Set the directory server to SERVER using PROTOCOL")))
       (define-key map [load]
-       '(menu-item "Load Hotlist of Servers" eudc-load-eudc
-                   :help "Load the Emacs Unified Directory Client"))
+       `(menu-item ,(purecopy "Load Hotlist of Servers") eudc-load-eudc
+                   :help ,(purecopy "Load the Emacs Unified Directory Client")))
       map))
   (fset 'eudc-tools-menu (symbol-value 'eudc-tools-menu)))
  (t
@@ -1296,5 +1289,4 @@ This does nothing except loading eudc by autoload side-effect."
 
 (provide 'eudc)
 
-;; arch-tag: e18872b6-db83-400b-869d-be54e9a4160c
 ;;; eudc.el ends here