eudc.texi 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058
  1. \input texinfo.tex
  2. @c %**start of header
  3. @setfilename ../../info/eudc.info
  4. @settitle Emacs Unified Directory Client (EUDC) Manual
  5. @include docstyle.texi
  6. @afourpaper
  7. @syncodeindex fn cp
  8. @syncodeindex vr cp
  9. @c %**end of header
  10. @copying
  11. This file documents EUDC version 1.40.0.
  12. EUDC is the Emacs Unified Directory Client, a common interface to
  13. directory servers and contact information.
  14. Copyright @copyright{} 1998, 2000--2016 Free Software Foundation, Inc.
  15. @quotation
  16. Permission is granted to copy, distribute and/or modify this document
  17. under the terms of the GNU Free Documentation License, Version 1.3 or
  18. any later version published by the Free Software Foundation; with no
  19. Invariant Sections, with the Front-Cover Texts being ``A GNU Manual'',
  20. and with the Back-Cover Texts as in (a) below. A copy of the license
  21. is included in the section entitled ``GNU Free Documentation License''.
  22. (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
  23. modify this GNU manual.''
  24. @end quotation
  25. @end copying
  26. @dircategory Emacs network features
  27. @direntry
  28. * EUDC: (eudc). Emacs client for directory servers (LDAP, BBDB).
  29. @end direntry
  30. @footnotestyle end
  31. @titlepage
  32. @title EUDC Manual
  33. @subtitle The Emacs Unified Directory Client
  34. @author by Oscar Figueiredo
  35. @code{1.40.0}
  36. @page
  37. @vskip 0pt plus 1fill
  38. @insertcopying
  39. @end titlepage
  40. @contents
  41. @ifnottex
  42. @node Top
  43. @top Emacs Unified Directory Client
  44. @insertcopying
  45. @end ifnottex
  46. @menu
  47. * Overview:: Summary of EUDC features
  48. * Installation:: How to install EUDC
  49. * Usage:: The various usage possibilities explained
  50. * Credits:: Who's done what
  51. * GNU Free Documentation License:: The license for this documentation.
  52. * Index::
  53. @end menu
  54. @node Overview
  55. @chapter Overview
  56. EUDC, the @dfn{Emacs Unified Directory Client}, provides a common user
  57. interface to access directory servers using different directory
  58. protocols.
  59. Currently supported back-ends are:
  60. @itemize @bullet
  61. @item
  62. LDAP, Lightweight Directory Access Protocol
  63. @item
  64. BBDB, Big Brother's Insidious Database
  65. @end itemize
  66. The main features of the EUDC interface are:
  67. @itemize @bullet
  68. @item
  69. Queries using a customizable form
  70. @item
  71. Inline query expansion (for instance you can expand a name
  72. to an email address in a mail message buffer using a server as an
  73. address book)
  74. @item
  75. Multiple servers can be tried in turn until a match is found for an
  76. inline query
  77. @item
  78. Fast minibuffer queries for email addresses and phone numbers
  79. @item
  80. Interface to BBDB to let you insert server records into your own BBDB database
  81. (@pxref{Top,,BBDB,bbdb,BBDB Manual})
  82. @end itemize
  83. @menu
  84. * LDAP:: What is LDAP ?
  85. * BBDB:: What is BBDB ?
  86. @end menu
  87. @node LDAP
  88. @section LDAP
  89. LDAP, @dfn{the Lightweight Directory Access Protocol}, is a communication
  90. protocol for directory applications defined in RFC 1777.
  91. Quoted from RFC 1777:
  92. @quotation
  93. [LDAP] is designed to provide access to the X.500 Directory while not
  94. incurring the resource requirements of the Directory Access Protocol
  95. (DAP). This protocol is specifically targeted at simple management
  96. applications and browser applications that provide simple read/write
  97. interactive access to the X.500 Directory, and is intended to be a
  98. complement to the DAP itself.
  99. @end quotation
  100. LDAP servers usually store (but are not limited to) information about
  101. people such as their name, phone number, email address, office
  102. location, etc@enddots{} More information about LDAP can be found at
  103. @url{http://www.openldap.org/}.
  104. EUDC requires external support to access LDAP directory servers
  105. (@pxref{LDAP Configuration})
  106. @node BBDB
  107. @section BBDB
  108. BBDB is the @dfn{Big Brother's Insidious Database}, a package for Emacs
  109. originally written by Jamie Zawinski which provides rolodex-like
  110. database functionality featuring tight integration with the Emacs mail
  111. and news readers.
  112. It is often used as an enhanced email address book.
  113. EUDC considers BBDB as a directory server back end just like LDAP,
  114. though BBDB has no client/server protocol and thus always resides
  115. locally on your machine. The point in this is not to offer an
  116. alternate way to query your BBDB database (BBDB itself provides much
  117. more flexible ways to do that), but rather to offer an interface to
  118. your local directory that is consistent with the interface to external
  119. LDAP directories. This is particularly interesting when performing
  120. queries on multiple servers.
  121. EUDC also offers a means to insert results from directory queries into
  122. your own local BBDB (@pxref{Creating BBDB Records})
  123. @node Installation
  124. @chapter Installation
  125. Add the following to your @file{.emacs} init file:
  126. @lisp
  127. (require 'eudc)
  128. @end lisp
  129. This will install EUDC at startup.
  130. After installing EUDC you will find (the next time you launch Emacs) a
  131. new @code{Directory Search} submenu in the @samp{Tools} menu that will
  132. give you access to EUDC.
  133. You may also find it useful to add the following to your @file{.emacs}
  134. initialization file to add a shortcut for email address expansion in
  135. email composition buffers (@pxref{Inline Query Expansion})
  136. @lisp
  137. (eval-after-load
  138. "message"
  139. '(define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
  140. (eval-after-load
  141. "sendmail"
  142. '(define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
  143. @end lisp
  144. @menu
  145. * LDAP Configuration:: EUDC needs external support for LDAP
  146. @end menu
  147. @node LDAP Configuration
  148. @section LDAP Configuration
  149. LDAP support is added by means of @file{ldap.el}, which is part of
  150. Emacs. @file{ldap.el} needs an external program called
  151. @command{ldapsearch}, available as part of OpenLDAP
  152. (@url{http://www.openldap.org/}). The configurations in this section
  153. were tested with OpenLDAP 2.4.23.
  154. Most servers use LDAP-over-SSL these days; the examples here reflect
  155. that. The other possibilities are:
  156. @vindex ldap-host-parameters-alist
  157. @vindex ldap-ldapsearch-args
  158. @itemize @bullet
  159. @item
  160. Servers that do not require authentication or that do not encrypt
  161. authentication traffic.
  162. Include @code{auth simple} in @code{ldap-host-parameters-alist}, which
  163. causes the @code{-x} option to be passed to @command{ldapsearch}.
  164. @item
  165. Servers that require SASL authentication.
  166. Pass any required extra options to @command{ldapsearch} using
  167. @code{ldap-ldapsearch-args}.
  168. @end itemize
  169. The following examples use a base of
  170. @code{ou=people,dc=gnu,dc=org} and the host name
  171. @code{ldap.gnu.org}, a server that supports LDAP-over-SSL (the
  172. @code{ldaps} protocol, with default port @code{636}) and which
  173. requires authentication by the user @code{emacsuser} with password
  174. @code{s3cr3t}.
  175. These configurations are meant to be self-contained; that is, each
  176. provides everything required for sensible TAB-completion of email
  177. fields. BBDB lookups are attempted first; if a matching BBDB entry is
  178. found then EUDC will not attempt any LDAP lookups.
  179. Wildcard LDAP lookups are supported using the @code{*} character. For
  180. example, attempting to TAB-complete the following:
  181. @example
  182. To: * Smith
  183. @end example
  184. @noindent
  185. will return all LDAP entries with surnames that begin with
  186. @code{Smith}. In every LDAP query it makes, EUDC implicitly appends
  187. the wildcard character to the end of the last word.
  188. @menu
  189. * Emacs-only Configuration:: Configure with @file{.emacs}
  190. * External Configuration:: Configure with @file{/etc/openldap/ldap.conf}
  191. * Troubleshooting:: Debug @command{ldapsearch} failures
  192. @end menu
  193. @node Emacs-only Configuration
  194. @subsection Emacs-only Configuration
  195. Emacs can pass most required configuration options via the
  196. @command{ldapsearch} command-line. One exception is certificate
  197. configuration for LDAP-over-SSL, which must be specified in
  198. @file{/etc/openldap/ldap.conf}. On systems that provide such
  199. certificates as part of the @code{OpenLDAP} installation, this can be
  200. as simple as one line:
  201. @example
  202. TLS_CACERTDIR /etc/openldap/certs
  203. @end example
  204. In @file{.emacs}, these expressions suffice to configure EUDC for
  205. LDAP:
  206. @vindex message-mode-map
  207. @findex eudc-expand-inline
  208. @vindex eudc-server-hotlist
  209. @vindex ldap-host-parameters-alist
  210. @lisp
  211. (eval-after-load "message"
  212. '(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
  213. (customize-set-variable 'eudc-server-hotlist
  214. '(("" . bbdb)
  215. ("ldaps://ldap.gnu.org" . ldap)))
  216. (customize-set-variable 'ldap-host-parameters-alist
  217. '(("ldaps://ldap.gnu.org"
  218. base "ou=people,dc=gnu,dc=org"
  219. binddn "gnu\\emacsuser"
  220. passwd ldap-password-read)))
  221. @end lisp
  222. @findex ldap-password-read
  223. @vindex passwd
  224. @vindex password-cache
  225. @vindex password-cache-expiry
  226. @findex password-reset
  227. Specifying the function @code{ldap-password-read} for @code{passwd}
  228. will cause Emacs to prompt interactively for the password. The
  229. password will then be validated and cached, unless
  230. @code{password-cache} is nil. You can customize
  231. @code{password-cache-expiry} to control the duration for which the
  232. password is cached. If you want to clear the cache, call
  233. @code{password-reset}.
  234. @node External Configuration
  235. @subsection External Configuration
  236. Your system may already be configured for a default LDAP server. For
  237. example, @file{/etc/openldap/ldap.conf} might contain:
  238. @example
  239. BASE ou=people,dc=gnu,dc=org
  240. URI ldaps://ldap.gnu.org
  241. TLS_CACERTDIR /etc/openldap/certs
  242. @end example
  243. @cindex bind distinguished name
  244. @cindex binddn
  245. Authentication requires a password, and a @dfn{bind distinguished name
  246. (binddn)} representing the user, in this case,
  247. @code{gnu\emacsuser}. These can be specified in
  248. @file{~/.authinfo.gpg} with the following line:
  249. @example
  250. machine ldaps://ldap.gnu.org binddn gnu\emacsuser password s3cr3t
  251. @end example
  252. Then in the @file{.emacs} init file, these expressions suffice to
  253. configure EUDC for LDAP:
  254. @vindex message-mode-map
  255. @findex eudc-expand-inline
  256. @vindex eudc-server-hotlist
  257. @vindex ldap-host-parameters-alist
  258. @lisp
  259. (eval-after-load "message"
  260. '(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
  261. (customize-set-variable 'eudc-server-hotlist
  262. '(("" . bbdb)
  263. ("ldaps://ldap.gnu.org" . ldap)))
  264. (customize-set-variable 'ldap-host-parameters-alist
  265. '(("ldaps://ldap.gnu.org"
  266. auth-source t)))
  267. @end lisp
  268. For this example where we only care about one server, the server name
  269. can be omitted in @file{~/.authinfo.gpg} and @file{.emacs}, in which
  270. case @command{ldapsearch} defaults to the host name in
  271. @file{/etc/openldap/ldap.conf}.
  272. The @file{~/.authinfo.gpg} line becomes:
  273. @example
  274. binddn gnu\emacsuser password s3cr3t
  275. @end example
  276. @noindent
  277. and the @file{.emacs} expressions become:
  278. @vindex message-mode-map
  279. @findex eudc-expand-inline
  280. @vindex eudc-server-hotlist
  281. @vindex ldap-host-parameters-alist
  282. @lisp
  283. (eval-after-load "message"
  284. '(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
  285. (customize-set-variable 'eudc-server-hotlist
  286. '(("" . bbdb) ("" . ldap)))
  287. (customize-set-variable 'ldap-host-parameters-alist
  288. '(("" auth-source t)))
  289. @end lisp
  290. @node Troubleshooting
  291. @subsection Troubleshooting
  292. If @command{ldapsearch} exits with an error, you'll see a message like
  293. this in the @code{*Messages*} buffer (all on one line):
  294. @example
  295. ldap-search-internal: Failed ldapsearch invocation:
  296. ldapsearch "-Hldaps://ldap.gnu.org" "-bou=people,dc=gnu,dc=org"
  297. "-Dgnu\emacsuser" "-W" "-LL" "-tt" "(&(mail=name*))"
  298. "givenname" "sn" "mail"
  299. @end example
  300. The @command{ldapsearch} command is formatted such that it can be
  301. copied and pasted into a terminal. Set the @command{ldapsearch} debug
  302. level to 5 by appending @code{-d 5} to the command line.
  303. @node Usage
  304. @chapter Usage
  305. This chapter describes the usage of EUDC@. Most functions and
  306. customization options are available through the @samp{Directory Search}
  307. submenu of the @samp{Tools} submenu.
  308. @menu
  309. * Querying Servers:: How queries are performed and handled
  310. * Query Form:: How to use and customize the query form
  311. * Display of Query Results:: Controlling how query results are presented
  312. * Inline Query Expansion:: How to use and customize inline queries
  313. * The Server Hotlist:: How to use and manage the server hotlist
  314. * Multi-server Queries:: How to query multiple servers successively
  315. * Creating BBDB Records:: How to insert query results into your BBDB
  316. * Server/Protocol Locals:: Customizing on a per server/protocol basis
  317. @end menu
  318. @node Querying Servers
  319. @section Querying Servers
  320. EUDC's basic functionality is to let you query a directory server and
  321. return the results back to you. There are several things you may want
  322. to customize in this process.
  323. @menu
  324. * Selecting a Server:: The first thing to do
  325. * Return Attributes:: Configuring what the server should return
  326. * Duplicate Attributes:: What to do when records have duplicate attributes
  327. @end menu
  328. @node Selecting a Server
  329. @subsection Selecting a Server
  330. Before doing any query you will need to set the directory server. You
  331. need to specify the name of the host machine running the server software
  332. and the protocol to use. If you do not set the server in any fashion,
  333. EUDC will ask you for one when you make your first query.
  334. You can set the server by selecting one from your hotlist of servers
  335. (@pxref{The Server Hotlist}) available in the @samp{Server} submenu or
  336. by selecting @samp{New Server} in that same menu.
  337. LDAP servers generally require some configuration before you can perform
  338. queries on them. In particular, the @dfn{search base} must be
  339. configured. If the server you select has no configured search base then
  340. EUDC will propose you to configure it at this point. A customization
  341. buffer will be displayed where you can edit the search base and other
  342. parameters for the server.
  343. @defvar eudc-server
  344. The name or IP address of the remote directory server. A TCP port number
  345. may be specified by appending a colon and a number to the name of the
  346. server. You will not need this unless your server runs on a port other
  347. than the default (which depends on the protocol).
  348. If the directory server resides on your own computer (which is the case
  349. if you use the BBDB back end) then @samp{localhost} is a reasonable value but
  350. it will be ignored anyway.
  351. @end defvar
  352. @defvar eudc-protocol
  353. The directory protocol to use to query the server. Currently supported
  354. protocols in this version of EUDC are @code{ldap} and @code{bbdb}.
  355. @end defvar
  356. @deffn Command eudc-set-server
  357. This command accessible from @samp{New Server} submenu lets you specify a
  358. new directory server and protocol.
  359. @end deffn
  360. @node Return Attributes
  361. @subsection Return Attributes
  362. Directory servers may be configured to return a default set of
  363. attributes for each record matching a query if the query specifies none.
  364. The variable @code{eudc-default-return-attributes} controls the return
  365. attributes you want to see, if different from the server defaults.
  366. @defvar eudc-default-return-attributes
  367. A list of the default attributes to extract from directory entries. If
  368. set to the symbol @code{all} then all available attributes are
  369. returned. A value of @code{nil}, the default, means to return the
  370. default attributes as configured in the server.
  371. @end defvar
  372. The server may return several matching records to a query. Some of the
  373. records may however not contain all the attributes you requested. You can
  374. discard those records.
  375. @defopt eudc-strict-return-matches
  376. If non-@code{nil}, entries that do not contain all the requested return
  377. attributes are ignored. Default is @code{t}.
  378. @end defopt
  379. @node Duplicate Attributes
  380. @subsection Duplicate Attributes
  381. Directory standards may authorize different instances of the same
  382. attribute in a record. For instance the record of a person may contain
  383. several email fields containing different email addresses, in which
  384. case EUDC will consider the attribute duplicated.
  385. EUDC has several methods to deal with duplicated attributes. The
  386. available methods are:
  387. @table @code
  388. @item list
  389. Makes a list with the different values of the duplicate attribute. The
  390. record is returned with only one instance of the attribute with a list
  391. of all the different values as a value. This is the default method that
  392. is used to handle duplicate fields for which no other method has been
  393. specified.
  394. @item first
  395. Discards all the duplicate values of the field keeping only the first
  396. one.
  397. @item concat
  398. Concatenates the different values using a newline as a separator. The
  399. record keeps only one instance of the field the value of which is a
  400. single multi-line string.
  401. @item duplicate
  402. Duplicates the whole record into as many instances as there are different
  403. values for the field. This is the default for the email field. Thus a
  404. record containing 3 different email addresses is duplicated into three
  405. different records each having a single email address. This is
  406. particularly useful in combination with @code{select} as the method to
  407. handle multiple matches in inline expansion queries (@pxref{Inline Query
  408. Expansion}) because you are presented with the 3 addresses in a
  409. selection buffer
  410. @end table
  411. Because a method may not be applicable to all fields, the variable
  412. @code{eudc-duplicate-attribute-handling-method} lets you specify either a
  413. default method for all fields or a method for each individual field.
  414. @defvar eudc-duplicate-attribute-handling-method
  415. A method to handle entries containing duplicate attributes. This is
  416. either an alist of elements @code{(@var{attr} . @var{method})}, or a symbol
  417. @var{method}. The alist form of the variable associates a method to an
  418. individual attribute name; the second form specifies a method applicable
  419. to all attribute names. Available methods are: @code{list},
  420. @code{first}, @code{concat}, and @code{duplicate} (see above). The default is
  421. @code{list}.
  422. @end defvar
  423. @node Query Form
  424. @section Query Form
  425. The simplest way to query your directory server is to use the query
  426. form. You display the query form with the @samp{Query with Form} menu
  427. item or by invoking the command @kbd{M-x eudc-query-form}. The attribute
  428. names presented in this form are defined by the
  429. @code{eudc-query-form-attributes} variable (unless a non-@code{nil}
  430. argument is supplied to @code{eudc-query-form}).
  431. Since the different directory protocols to which EUDC interfaces may
  432. use different names for equivalent attributes, EUDC defines its own set
  433. of attribute names and a mapping between these names and their
  434. protocol-specific equivalent through the variable
  435. @code{eudc-protocol-attributes-translation-alist}. Names currently
  436. defined by EUDC are @code{name}, @code{firstname}, @code{email} and
  437. @code{phone}.
  438. @defvar eudc-query-form-attributes
  439. @findex eudc-get-attribute-list
  440. A list of attributes presented in the query form. Attribute names in
  441. this list should be either EUDC attribute names or valid attribute
  442. names. You can get a list of valid attribute names for the current
  443. protocol with the @samp{List Valid Attribute Names} menu item or the
  444. @kbd{M-x eudc-get-attribute-list} command. Defaults to @code{name},
  445. @code{email} and @code{phone}.
  446. @end defvar
  447. @deffn Command eudc-query-form get-fields-from-server
  448. Display a form to query the directory server. If given a non-@code{nil}
  449. argument the function first queries the server for the existing fields
  450. and displays a corresponding form. Not all protocols may support a
  451. non-@code{nil} argument here.
  452. @end deffn
  453. Since the names of the fields may not be explicit enough or adapted to
  454. be directly displayed as prompt strings in the form, the variable
  455. @code{eudc-user-attribute-names-alist} lets you define more explicit
  456. names for directory attribute names. This variable is ignored if
  457. @code{eudc-use-raw-directory-names} is non-@code{nil}.
  458. @defvar eudc-user-attribute-names-alist
  459. This is an alist of user-defined names for the directory attributes used in
  460. query/response forms. Prompt strings for attributes that are not in this
  461. alist are derived by splitting the attribute name at underscores and
  462. capitalizing the individual words.
  463. @end defvar
  464. @defvar eudc-use-raw-directory-names
  465. If non-@code{nil}, use attributes names as defined in the directory.
  466. Otherwise, directory query/response forms display the user attribute
  467. names defined in @code{eudc-user-attribute-names-alist}.
  468. @end defvar
  469. @node Display of Query Results
  470. @section Display of Query Results
  471. Upon successful completion of a form query, EUDC will display a buffer
  472. containing the results of the query.
  473. The fields that are returned for each record
  474. are controlled by @code{eudc-default-return-attributes} (@pxref{Return
  475. Attributes}).
  476. The display of each individual field can be performed by an arbitrary
  477. function which allows specific processing for binary values, such as
  478. images or audio samples, as well as values with semantics, such as
  479. URLs.
  480. @defvar eudc-attribute-display-method-alist
  481. An alist specifying methods to display attribute values. Each member of
  482. the list is of the form @code{(@var{name} . @var{func})} where
  483. @var{name} is a lowercased string naming a directory attribute
  484. (translated according to @code{eudc-user-attribute-names-alist} if
  485. @code{eudc-use-raw-directory-names} is non-@code{nil}) and @var{func} a
  486. function that will be passed the corresponding attribute values for
  487. display.
  488. @end defvar
  489. This variable has protocol-local definitions (see @pxref{Server/Protocol
  490. Locals}). For instance, it is defined as follows for LDAP:
  491. @lisp
  492. (eudc-protocol-set 'eudc-attribute-display-method-alist
  493. '(("jpegphoto" . eudc-display-jpeg-inline)
  494. ("labeledurl" . eudc-display-url)
  495. ("audio" . eudc-display-sound)
  496. ("labeledurl" . eudc-display-url)
  497. ("url" . eudc-display-url))
  498. 'ldap)
  499. @end lisp
  500. EUDC provides a set of built-in functions to display binary value types:
  501. @defun eudc-display-generic-binary data
  502. Display a button for unidentified binary @var{data}.
  503. @end defun
  504. @defun eudc-display-url url
  505. Display URL and make it clickable.
  506. @end defun
  507. @defun eudc-display-sound data
  508. Display a button to play the sound @var{data}.
  509. @end defun
  510. @defun eudc-display-jpeg-inline data
  511. Display the JPEG @var{data} inline at point if possible.
  512. @end defun
  513. @defun eudc-display-jpeg-as-button data
  514. Display a button for the JPEG @var{data}.
  515. @end defun
  516. Right-clicking on a binary value button pops up a contextual menu with
  517. options to process the value. Among these are saving the attribute
  518. value to a file or sending it to an external viewer command. External
  519. viewers should expect the value on their standard input and should
  520. display it or perform arbitrary processing on it. Messages sent to
  521. standard output are discarded. External viewers are listed in the
  522. variable @code{eudc-external-viewers} which you can customize.
  523. @defvar eudc-external-viewers
  524. This is a list of viewer program specifications. Each specification is
  525. a list whose first element is a string naming the viewer for unique
  526. identification, the second element is the executable program which
  527. should be invoked and the following elements are arguments that should
  528. be passed to the program.
  529. @end defvar
  530. @node Inline Query Expansion
  531. @section Inline Query Expansion
  532. Inline query expansion is a powerful method to get completion from your
  533. directory server. The most common usage is for expanding names to email
  534. addresses in mail message buffers. The expansion is performed by the
  535. command @kbd{M-x eudc-expand-inline} which is available from the
  536. @samp{Expand Inline Query} menu item but can also be conveniently
  537. bound to a key shortcut (@pxref{Installation}). The operation is
  538. controlled by the variables @code{eudc-inline-expansion-format},
  539. @code{eudc-inline-query-format},
  540. @code{eudc-expanding-overwrites-query} and
  541. @code{eudc-multiple-match-handling-method}.
  542. If the query fails for a server, other servers may be tried successively
  543. until one of them finds a match (@pxref{Multi-server Queries}).
  544. @deffn Command eudc-expand-inline replace-p
  545. Query the server and expand the query string before point. The query
  546. string consists of the buffer substring from the point back to the
  547. preceding comma, colon or beginning of
  548. line. @code{eudc-inline-query-format} controls how individual words
  549. are mapped onto directory attribute names. After querying the server
  550. for the given string, the expansion specified by
  551. @code{eudc-inline-expansion-format} is inserted in the buffer at
  552. point. If @var{replace-p} is @code{t} then this expansion replaces the
  553. query string in the buffer. If @code{eudc-expanding-overwrites-query}
  554. is non-@code{nil} then the meaning of @var{replace-p} is negated.
  555. @end deffn
  556. @defvar eudc-inline-query-format
  557. Format of an inline expansion query.
  558. This is actually a list of @var{format}s. A @var{format} is a list of
  559. one or more EUDC attribute names. A @var{format} applies if it contains
  560. as many attributes as individual words in the inline query string. If
  561. several @var{format}s apply then they are tried in order until a match
  562. is found. If @code{nil} all the words will be mapped onto the default
  563. server/protocol attribute name (generally @code{name}).
  564. For instance, use the following
  565. @lisp
  566. (setq eudc-inline-query-format '((name)
  567. (firstname)
  568. (firstname name)))
  569. @end lisp
  570. @noindent
  571. to indicate that single word expansion queries are to be considered as
  572. surnames and if no match is found then they should be tried as first
  573. names. Inline queries consisting of two words are considered as
  574. consisting of a first name followed by a surname. If the query consists
  575. of more than two words, then the first one is considered as the first
  576. name and the remaining words are all considered as surname constituents.
  577. @var{format}s are in fact not limited to EUDC attribute names, you can
  578. use server or protocol specific names in them. It may be safer if you
  579. do so, to set the variable @code{eudc-inline-query-format} in a protocol
  580. or server local fashion (see @pxref{Server/Protocol Locals}).
  581. For instance you could use the following to match up to three words
  582. against the @code{cn} attribute of LDAP servers:
  583. @lisp
  584. (eudc-protocol-set 'eudc-inline-query-format
  585. '((cn)
  586. (cn cn)
  587. (cn cn cn))
  588. 'ldap)
  589. @end lisp
  590. @end defvar
  591. @defvar eudc-inline-expansion-format
  592. This variable lets you control exactly what is inserted into the buffer
  593. upon an inline expansion request. It is a list whose first element is a
  594. string passed to @code{format}. Remaining elements are symbols
  595. corresponding to directory attribute names. The corresponding attribute
  596. values are passed as additional arguments to @code{format}. Default is
  597. @code{("%s" email)} but you may want to consider a value like @code{("%s
  598. <%s>" name email)}
  599. @end defvar
  600. @defvar eudc-multiple-match-handling-method
  601. This variable controls what to do when multiple entries match a query
  602. for an inline expansion. Possible values are:
  603. @table @code
  604. @item first
  605. The first match is considered as being the only one, the others are
  606. discarded.
  607. @item select
  608. A selection buffer pops up where you can choose a particular match. This
  609. is the default value of the variable.
  610. @item all
  611. The expansion uses all records successively
  612. @item abort
  613. An error is signaled. The expansion aborts.
  614. @end table
  615. Default is @code{select}
  616. @end defvar
  617. @node The Server Hotlist
  618. @section The Server Hotlist
  619. EUDC lets you maintain a list of frequently used servers so that you
  620. can easily switch from one to another. This hotlist appears in the
  621. @samp{Server} submenu. You select a server in this list by clicking on
  622. its name. You can add the current server to the list with the command
  623. @kbd{M-x eudc-bookmark-current-server}. The list is contained in the variable
  624. @code{eudc-server-hotlist} which is stored in and retrieved from the file
  625. designated by @code{eudc-options-file}. EUDC also provides a facility to
  626. edit the hotlist interactively (@pxref{The Hotlist Edit Buffer}).
  627. The hotlist is also used to make queries on multiple servers
  628. successively (@pxref{Multi-server Queries}). The order in which the
  629. servers are tried is the order they appear in the hotlist, therefore it
  630. is important to sort the hotlist appropriately.
  631. @deffn Command eudc-bookmark-server server
  632. Add @var{server} to the hotlist of servers
  633. @end deffn
  634. @deffn Command eudc-bookmark-current-server
  635. Add the current server to the hotlist of servers
  636. @end deffn
  637. @defvar eudc-options-file
  638. The name of a file where EUDC stores its internal variables
  639. (the hotlist and the current server). EUDC will try to load
  640. that file upon initialization so, if you choose a file name
  641. different from the defaults @file{~/.eudc-options}, be sure to set this
  642. variable to the appropriate value @emph{before} EUDC is itself
  643. loaded.
  644. @end defvar
  645. @menu
  646. * The Hotlist Edit Buffer:: An interactive hotlist editing facility
  647. @end menu
  648. @node The Hotlist Edit Buffer
  649. @subsection The Hotlist Edit Buffer
  650. The hotlist edit buffer offers a means to manage a list of frequently
  651. used servers. Commands are available in the context pop-up menu
  652. generally bound to the right mouse button. Those commands also have
  653. equivalent key bindings.
  654. @deffn Command eudc-hotlist-add-server
  655. Bound to @kbd{a}.
  656. Add a new server to the hotlist on the line after point
  657. @end deffn
  658. @deffn Command eudc-hotlist-delete-server
  659. Bound to @kbd{d}.
  660. Delete the server on the line point is on
  661. @end deffn
  662. @deffn Command eudc-hotlist-select-server
  663. Bound to @kbd{s}.
  664. Select the server the point is on as the current directory server for
  665. the next queries
  666. @end deffn
  667. @deffn Command eudc-hotlist-transpose-servers
  668. Bound to @kbd{t}.
  669. Bubble up the server the point is on to the top of the list
  670. @end deffn
  671. @deffn Command eudc-hotlist-quit-edit
  672. Bound to @kbd{q}.
  673. Save the changes and quit the hotlist edit buffer. Use @kbd{x} or
  674. @kbd{M-x kill-buffer} to exit without saving.
  675. @end deffn
  676. @node Multi-server Queries
  677. @section Multi-server Queries
  678. When using inline query expansion (@pxref{Inline Query Expansion}), EUDC
  679. can try to query successively a sequence of directory servers until one
  680. of them successfully finds a match for the query.
  681. @defvar eudc-inline-expansion-servers
  682. This variable controls which servers are tried and in which order when
  683. trying to perform an inline query. Possible values are:
  684. @table @code
  685. @item current-server
  686. Only the current directory server is tried
  687. @item hotlist
  688. The servers in the hotlist are tried in order until one finds a match
  689. for the query or @code{eudc-max-servers-to-query} is reached
  690. @item server-then-hotlist
  691. The current server then the servers in the hotlist are tried in the
  692. order they appear in the hotlist until one of them finds a match or
  693. @code{eudc-max-servers-to-query} is reached. This is the default.
  694. @end table
  695. @end defvar
  696. @defvar eudc-max-servers-to-query
  697. This variable indicates the maximum number of servers to query when
  698. performing a multi-server query. The default, @code{nil}, indicates
  699. that all available servers should be tried.
  700. @end defvar
  701. @node Creating BBDB Records
  702. @section Creating BBDB Records
  703. @findex eudc-insert-record-at-point-into-bbdb
  704. @findex eudc-try-bbdb-insert
  705. With EUDC, you can automatically create BBDB records
  706. (@pxref{Top,,BBDB,bbdb,BBDB Manual}) from records you get from a
  707. directory server. You do this by moving point to the appropriate
  708. record in a query result display buffer and invoking the command
  709. @kbd{M-x eudc-insert-record-at-point-into-bbdb} with the
  710. keyboard binding @kbd{b}@footnote{This key binding does not actually
  711. call @code{eudc-insert-record-at-point-into-bbdb} but uses
  712. @code{eudc-try-bbdb-insert} instead.}, or with the menu. EUDC
  713. cannot update an existing BBDB record and will signal an error if you
  714. try to insert a record matching an existing one.
  715. @findex eudc-batch-export-records-to-bbdb
  716. It is also possible to export to BBDB the whole batch of records
  717. contained in the directory query result with the command
  718. @kbd{M-x eudc-batch-export-records-to-bbdb}.
  719. Because directory systems may not enforce a strict record format, local
  720. server installations may use different attribute names and have
  721. different ways to organize the information. Furthermore BBDB has its own
  722. record structure. For these reasons converting a record from its
  723. external directory format to the BBDB format is a highly customizable
  724. process.
  725. @defvar eudc-bbdb-conversion-alist
  726. The value of this variable should be a symbol naming an alist defining a
  727. mapping between BBDB field names onto directory attribute names records.
  728. This is a protocol-local variable and is initialized upon protocol
  729. switch (@pxref{Server/Protocol Locals}). The alist is made of cells of the
  730. form @code{(@var{bbdb-field} . @var{spec-or-list})}.
  731. @var{bbdb-field} is the name of a field
  732. that must be defined in your BBDB environment (standard field names are
  733. @code{name}, @code{company}, @code{net}, @code{phone}, @code{address}
  734. and @code{notes}).
  735. @var{spec-or-list} is either a single mapping specification or a list of
  736. mapping specifications. Lists of mapping specifications are valid for
  737. the @code{phone} and @code{address} BBDB fields only. @var{spec}s are
  738. actually s-expressions which are evaluated as follows:
  739. @table @asis
  740. @item a string
  741. evaluates to itself
  742. @item a symbol
  743. evaluates to the symbol value. Symbols corresponding to directory
  744. attribute names present in the record evaluate to the value of the field
  745. in the record
  746. @item a form
  747. is evaluated as a function. The argument list may contain attribute
  748. names which evaluate to the corresponding values in the record. The form
  749. evaluation should return something appropriate for the particular
  750. @var{bbdb-field} (see @code{bbdb-create-internal}).
  751. @code{eudc-bbdbify-phone} and @code{eudc-bbdbify-address} are provided as
  752. convenience functions to parse phones and addresses.
  753. @end table
  754. @end defvar
  755. @defun eudc-bbdbify-phone phone location
  756. This is a convenience function provided for use in
  757. @code{eudc-bbdb-conversion-alist}. It parses @var{phone} into a vector
  758. compatible with @code{bbdb-create-internal}. @var{phone} is either a string
  759. supposedly containing a phone number or a list of such strings which are
  760. concatenated. @var{location} is used as the phone location for BBDB.
  761. @end defun
  762. @defun eudc-bbdbify-address addr location
  763. This is a convenience function provided for use in
  764. @code{eudc-bbdb-conversion-alist}. It parses @var{addr} into a vector
  765. compatible with @code{bbdb-create-internal}. @var{addr} should be an
  766. address string of no more than four lines or a list of lines. The last
  767. line is searched for the zip code, city and state name. @var{location}
  768. is used as the phone location for BBDB.
  769. @end defun
  770. Note that only a subset of the attributes you selected with
  771. @code{eudc-default-return-attributes} and that are actually displayed may
  772. actually be inserted as part of the newly created BBDB record.
  773. @node Server/Protocol Locals
  774. @section Server/Protocol Locals
  775. EUDC can be customized independently for each server or directory
  776. protocol. All variables can be given local bindings that are activated
  777. when a particular server and/or protocol becomes active. This is much
  778. like buffer-local bindings but on a per server or per protocol basis.
  779. @menu
  780. * Manipulating local bindings:: Functions to set and query local bindings
  781. @end menu
  782. @node Manipulating local bindings
  783. @subsection Manipulating local bindings
  784. EUDC offers functions that let you set and query variables on a per
  785. server or per protocol basis.
  786. The following predicates allow you to test the existence of
  787. server/protocol local bindings for a particular variable.
  788. @defun eudc-server-local-variable-p var
  789. Return non-@code{nil} if @var{var} has server-local bindings
  790. @end defun
  791. @defun eudc-protocol-local-variable-p var
  792. Return non-@code{nil} if @var{var} has protocol-local bindings
  793. @end defun
  794. The following functions allow you to set the value of a variable with
  795. various degrees of locality.
  796. @defun eudc-default-set var val
  797. Set the EUDC default value of @var{var} to @var{val}.
  798. The current binding of @var{var} (if local to the current server or
  799. protocol) is not changed.
  800. @end defun
  801. @defun eudc-protocol-set var val &optional protocol
  802. Set the binding of @var{var} local to @var{protocol} to @var{val}. If
  803. omitted, @var{protocol} defaults to the current value of
  804. @code{eudc-protocol}. The current binding of @var{var} is changed only
  805. if @var{protocol} is omitted.
  806. @end defun
  807. @defun eudc-server-set var val &optional server
  808. Set the binding of @var{var} local to @var{server} to @var{val}. If
  809. omitted, @var{server} defaults to the current value of
  810. @code{eudc-server}. The current binding of @var{var} is changed only if
  811. @var{server} is omitted.
  812. @end defun
  813. @defun eudc-set var val
  814. Set the most local (server, protocol or default) binding of @var{var} to
  815. @var{val}. The current binding of @var{var} is also set to @var{val}.
  816. @end defun
  817. The following variables allow you to query the various bindings of a
  818. variable (local or non-local).
  819. @defun eudc-variable-default-value var
  820. Return the default binding of @var{var} (outside of a particular server
  821. or protocol local binding).
  822. Return @code{unbound} if @var{var} has no EUDC default value.
  823. @end defun
  824. @defun eudc-variable-protocol-value var &optional protocol
  825. Return the value of @var{var} local to @var{protocol}. Return
  826. @code{unbound} if @var{var} has no value local to @var{protocol}.
  827. @var{protocol} defaults to @code{eudc-protocol}.
  828. @end defun
  829. @defun eudc-variable-server-value var [server]
  830. Return the value of @var{var} local to @var{server}.
  831. Return @code{unbound} if @var{var} has no value local to @var{server}.
  832. @var{server} defaults to @code{eudc-server}.
  833. @end defun
  834. Changing a protocol-local or server-local value of a variable has no
  835. effect on its current value. The following command is used to
  836. synchronize the current values of variables with their local values
  837. given the current @code{eudc-server} and @code{eudc-protocol}:
  838. @defun eudc-update-local-variables
  839. Update all EUDC variables according to their local settings.
  840. @end defun
  841. @node Credits
  842. @chapter Credits
  843. EUDC was written by Oscar Figueiredo based on @file{ph.el} by the
  844. same author.
  845. Thanks to Soren Dayton for his suggestions, his enthusiasm and his help
  846. in testing and proofreading the code and docs of @file{ph.el}.
  847. @node GNU Free Documentation License
  848. @appendix GNU Free Documentation License
  849. @include doclicense.texi
  850. @node Index
  851. @unnumbered Index
  852. @printindex cp
  853. @bye