Update on EUDC LDAP configuration

EUDC LDAP configuration is simpler in Emacs 25. There shouldn’t be a need to call eudc-set-server anymore. All configuration should be declarative like other packages.

Many of the below setq’s are for bad defaults and outright bugs in EUDC. I tried to fix those for Emacs 25. I also updated the EUDC manual with an “LDAP Configuration” section. If you go through that section, rewrite your configuration, and something doesn’t work, please file a bug at bug-gnu-emacs. Likewise, if you have to hack something to make it work for you, please file a bug about it and I’ll look at it and try to fix it properly in Emacs itself.


Get email adress expansion with EUDC and LDAP

Adapt and add the following to your .emacs file:

(require 'ldap)
(require 'eudc)

(setq eudc-default-return-attributes nil
      eudc-strict-return-matches nil)

(setq ldap-ldapsearch-args (quote ("-tt" "-LLL" "-x")))
(setq eudc-inline-query-format '((name)
                                 (firstname name)

(setq ldap-host-parameters-alist
      (quote (("your_server" base "ou=addressbook,dc=your_dc_here,dc=fr"
               binddn "cn=admin,dc=your_dc_here,dc=fr"
               passwd "your_password"))))

(eudc-set-server "your_server" 'ldap t)
(setq eudc-server-hotlist '(("your_server" . ldap)))
(setq eudc-inline-expansion-servers 'hotlist)

(defun enz-eudc-expand-inline()
  (move-end-of-line 1)
  (insert "*")
  (unless (condition-case nil
            (error nil))
    (backward-delete-char-untabify 1))

;; Adds some hooks

(eval-after-load "message"
  '(define-key message-mode-map (kbd "TAB") 'enz-eudc-expand-inline))
(eval-after-load "sendmail"
  '(define-key mail-mode-map (kbd "TAB") 'enz-eudc-expand-inline))
(eval-after-load "post"
  '(define-key post-mode-map (kbd "TAB") 'enz-eudc-expand-inline))

eudc-inline-query doesn’t seem to work for me. With multiple results I always get the message “Multiple matches found; choose one: “ and possible completions are “ <>” (an empty result string). Any ideas? I don’t see any error messages. Queries with single results work fine.

   This may work now in Emacs 25 (i.e., master branch as of 2015-05-16).  If you can, retry and file a bug if it doesn't work.  Re-read the EUDC manual's "LDAP Configuration" section, which has seen a bunch of updates, including an ldapsearch troubleshooting subsection.

Is there a way to perform multiple queries on the same server? --Mitch

   Not yet.  If you still want this feature, please file a bug so that we can discuss how this should work.