1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-23 18:47:57 +00:00

Change eudc-server-hotlist from a defvar to a defcustom

* net/eudc-vars.el (eudc-server): Adjust docstring to mention
eudc-server-hotlist.
(eudc-server-hotlist): Move from eudc.el and make defcustom.
* net/eudc.el (eudc-server-hotlist): Move to eudc-vars.el.
(eudc-set-server): Allow setting protocol to nil.
(eudc-expand-inline): Support hotlist-only expansions when server
is not set.
This commit is contained in:
Thomas Fitzsimmons 2014-11-13 00:50:01 -05:00
parent 83bad90efe
commit 090cbf9b46
3 changed files with 54 additions and 16 deletions

View File

@ -1,3 +1,13 @@
2014-11-13 Thomas Fitzsimmons <fitzsim@fitzsim.org>
* net/eudc-vars.el (eudc-server): Adjust docstring to mention
eudc-server-hotlist.
(eudc-server-hotlist): Move from eudc.el and make defcustom.
* net/eudc.el (eudc-server-hotlist): Move to eudc-vars.el.
(eudc-set-server): Allow setting protocol to nil.
(eudc-expand-inline): Support hotlist-only expansions when server
is not set.
2014-10-20 Glenn Morris <rgm@gnu.org>
* Version 24.4 released.

View File

@ -41,7 +41,10 @@
"The name or IP address of the directory server.
A port number may be specified by appending a colon and a
number to the name of the server. Use `localhost' if the directory
server resides on your computer (BBDB backend)."
server resides on your computer (BBDB backend).
To specify multiple servers, customize eudc-server-hotlist
instead."
:type '(choice (string :tag "Server") (const :tag "None" nil))
:group 'eudc)
@ -49,6 +52,26 @@ server resides on your computer (BBDB backend)."
;; Not to be mistaken with `eudc-supported-protocols'
(defvar eudc-known-protocols '(bbdb ph ldap))
(defcustom eudc-server-hotlist nil
"Directory servers to query.
This is an alist of the form (SERVER . PROTOCOL). SERVER is the
host name or URI of the server, PROTOCOL is a symbol representing
the EUDC backend with which to access the server.
The BBDB backend ignores SERVER; `localhost' can be used as a
placeholder string."
:tag "Directory Servers to Query"
:type `(repeat (cons :tag "Directory Server"
(string :tag "Server Host Name or URI")
(choice :tag "Protocol"
:menu-tag "Protocol"
,@(mapcar (lambda (s)
(list 'const
':tag (symbol-name s) s))
eudc-known-protocols)
(const :tag "None" nil))))
:group 'eudc)
(defvar eudc-supported-protocols nil
"Protocols currently supported by EUDC.
This variable is updated when protocol-specific libraries

View File

@ -76,10 +76,6 @@
(defvar mode-popup-menu)
;; List of known servers
;; Alist of (SERVER . PROTOCOL)
(defvar eudc-server-hotlist nil)
;; List of variables that have server- or protocol-local bindings
(defvar eudc-local-vars nil)
@ -688,7 +684,8 @@ server for future sessions."
(cons (symbol-name elt)
elt))
eudc-known-protocols)))))
(unless (or (member protocol
(unless (or (null protocol)
(member protocol
eudc-supported-protocols)
(load (concat "eudcb-" (symbol-name protocol)) t))
(error "Unsupported protocol: %s" protocol))
@ -812,12 +809,21 @@ If REPLACE is non-nil, then this expansion replaces the name in the buffer.
Multiple servers can be tried with the same query until one finds a match,
see `eudc-inline-expansion-servers'"
(interactive)
(if (memq eudc-inline-expansion-servers
'(current-server server-then-hotlist))
(or eudc-server
(call-interactively 'eudc-set-server))
(cond
((eq eudc-inline-expansion-servers 'current-server)
(or eudc-server
(call-interactively 'eudc-set-server)))
((eq eudc-inline-expansion-servers 'server-then-hotlist)
(or eudc-server
;; Allow server to be nil if hotlist is set.
eudc-server-hotlist
(call-interactively 'eudc-set-server)))
((eq eudc-inline-expansion-servers 'hotlist)
(or eudc-server-hotlist
(error "No server in the hotlist")))
(t
(error "Wrong value for `eudc-inline-expansion-servers': %S"
eudc-inline-expansion-servers)))
(let* ((end (point))
(beg (save-excursion
(if (re-search-backward "\\([:,]\\|^\\)[ \t]*"
@ -840,13 +846,12 @@ see `eudc-inline-expansion-servers'"
((eq eudc-inline-expansion-servers 'hotlist)
eudc-server-hotlist)
((eq eudc-inline-expansion-servers 'server-then-hotlist)
(cons (cons eudc-server eudc-protocol)
(delete (cons eudc-server eudc-protocol) servers)))
(if eudc-server
(cons (cons eudc-server eudc-protocol)
(delete (cons eudc-server eudc-protocol) servers))
eudc-server-hotlist))
((eq eudc-inline-expansion-servers 'current-server)
(list (cons eudc-server eudc-protocol)))
(t
(error "Wrong value for `eudc-inline-expansion-servers': %S"
eudc-inline-expansion-servers))))
(list (cons eudc-server eudc-protocol)))))
(if (and eudc-max-servers-to-query
(> (length servers) eudc-max-servers-to-query))
(setcdr (nthcdr (1- eudc-max-servers-to-query) servers) nil))