Subject: bug#11211: 23.3; Gnus - eudc/ldap - inline expansion does not work

From: Thomas Fitzsimmons <[email-masked]>
Date: Sun, 14 Dec 2014 20:35:24 -0500

[email-masked] (Kamil Jońca) writes:

> Glenn Morris <[email-masked]> writes:
>
>> Kamil Jońca wrote:
>>
>>> Debugger entered--Lisp error: (error "No match")
>>>   signal(error ("No match"))
>>>   (condition-case signal (progn (setq response ...) (if ... ... ... ... ...) (or ... ...)) (error (or ... ...) (signal ... ...)))
>>>   (let* ((end ...) (beg ...) (query-words ...) query-formats
>>> response response-string response-strings (eudc-former-server
>>> eudc-server) (eudc-former-protocol eudc-protocol) servers) (setq
>>> servers (copy-sequence eudc-server-hotlist)) (setq servers (cond
>>> ... ... ... ...)) (if (and eudc-max-servers-to-query ...) (setcdr
>>> ... nil)) (condition-case signal (progn ... ... ...) (error
>>> ... ...)))
>>>   eudc-expand-inline()
>>
>> I'm afraid that's not much more informative. There are some variables
>> you can set so that the lists don't get abbreviated, but I forget
>> precisely which ones they are. Anyway, a full backtrace probably isn't
>> going to help too much. All that happens is that it fails to find a
>> match for some reason.
>>
>> I'm afraid I have no idea how to configure eudc so that I can test this
>> myself, and I don't have any ldap servers to test it with anyway.
>>
>> If you can use edebug, you might try looking into this more yourself.
>> If as you say it works in other contexts, then the problem may be
>> something simple like it not extracting the correct string from the
>> buffer in the first place.
>>
> I noticed by accident that it related to
> (eudc-inline-expansion-format)
>
> with its default setting
> ("%s" email)
> inline expansion seems to work
> But i prefer to expand entries to something like
>
> Kamil Jońca <[email-masked]>
> and with setting ("%s %s <%s>" firstname name email)
> this does not work.
> Am I missing something with setting this variable?
> KJ

Can you try running ldapsearch on the command-line, with the same
arguments that you see in the strace output?

One possibility is that the server is returning results that contain
LDAP attribute names that Emacs is not expecting.

The relevant code is in lisp/net/eudc.el:

   [...]
   ;; Loop on query-formats
   (while query-formats
     (setq response
           (eudc-query
            (eudc-format-query query-words (car query-formats))
            (eudc-translate-attribute-list
             (cdr eudc-inline-expansion-format))))
     (if response
         (throw 'found response))
     (setq query-formats (cdr query-formats)))
   [...]

If I hard-code a wrong value list in place of:

   (eudc-translate-attribute-list
    (cdr eudc-inline-expansion-format))

(I tried '(givenname sk mail)), then inline expansion fails with "No
match", but form expansion still works.

eudc-translate-attribute-list converts the inline expansion format based
on the attribute values in eudc-ldap-attributes-translation-alist:

   (defvar eudc-ldap-attributes-translation-alist
     '((name . sn)
       (firstname . givenname)
       (email . mail)
       (phone . telephonenumber))
     "Alist mapping EUDC attribute names to LDAP names.")

See if there are differences between sn, givenname, and the attribute
values you see in the command line output.

Thomas