diff options
| author | Thomas Fitzsimmons | 2014-11-13 00:50:01 -0500 |
|---|---|---|
| committer | Thomas Fitzsimmons | 2014-11-13 00:50:01 -0500 |
| commit | 090cbf9b46465ffb46430021be782a4569afd5a6 (patch) | |
| tree | 43a88fc0d751d7bb4be929b05d8b09380d58725e | |
| parent | 83bad90efe943e7c88431b7a71bc1d5cf1304c92 (diff) | |
| download | emacs-090cbf9b46465ffb46430021be782a4569afd5a6.tar.gz emacs-090cbf9b46465ffb46430021be782a4569afd5a6.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/net/eudc-vars.el | 25 | ||||
| -rw-r--r-- | lisp/net/eudc.el | 35 |
3 files changed, 54 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4c9b60ea4cd..3a68f33044d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2014-11-13 Thomas Fitzsimmons <fitzsim@fitzsim.org> | ||
| 2 | |||
| 3 | * net/eudc-vars.el (eudc-server): Adjust docstring to mention | ||
| 4 | eudc-server-hotlist. | ||
| 5 | (eudc-server-hotlist): Move from eudc.el and make defcustom. | ||
| 6 | * net/eudc.el (eudc-server-hotlist): Move to eudc-vars.el. | ||
| 7 | (eudc-set-server): Allow setting protocol to nil. | ||
| 8 | (eudc-expand-inline): Support hotlist-only expansions when server | ||
| 9 | is not set. | ||
| 10 | |||
| 1 | 2014-10-20 Glenn Morris <rgm@gnu.org> | 11 | 2014-10-20 Glenn Morris <rgm@gnu.org> |
| 2 | 12 | ||
| 3 | * Version 24.4 released. | 13 | * Version 24.4 released. |
diff --git a/lisp/net/eudc-vars.el b/lisp/net/eudc-vars.el index 419b764e27e..54995a334c9 100644 --- a/lisp/net/eudc-vars.el +++ b/lisp/net/eudc-vars.el | |||
| @@ -41,7 +41,10 @@ | |||
| 41 | "The name or IP address of the directory server. | 41 | "The name or IP address of the directory server. |
| 42 | A port number may be specified by appending a colon and a | 42 | A port number may be specified by appending a colon and a |
| 43 | number to the name of the server. Use `localhost' if the directory | 43 | number to the name of the server. Use `localhost' if the directory |
| 44 | server resides on your computer (BBDB backend)." | 44 | server resides on your computer (BBDB backend). |
| 45 | |||
| 46 | To specify multiple servers, customize eudc-server-hotlist | ||
| 47 | instead." | ||
| 45 | :type '(choice (string :tag "Server") (const :tag "None" nil)) | 48 | :type '(choice (string :tag "Server") (const :tag "None" nil)) |
| 46 | :group 'eudc) | 49 | :group 'eudc) |
| 47 | 50 | ||
| @@ -49,6 +52,26 @@ server resides on your computer (BBDB backend)." | |||
| 49 | ;; Not to be mistaken with `eudc-supported-protocols' | 52 | ;; Not to be mistaken with `eudc-supported-protocols' |
| 50 | (defvar eudc-known-protocols '(bbdb ph ldap)) | 53 | (defvar eudc-known-protocols '(bbdb ph ldap)) |
| 51 | 54 | ||
| 55 | (defcustom eudc-server-hotlist nil | ||
| 56 | "Directory servers to query. | ||
| 57 | This is an alist of the form (SERVER . PROTOCOL). SERVER is the | ||
| 58 | host name or URI of the server, PROTOCOL is a symbol representing | ||
| 59 | the EUDC backend with which to access the server. | ||
| 60 | |||
| 61 | The BBDB backend ignores SERVER; `localhost' can be used as a | ||
| 62 | placeholder string." | ||
| 63 | :tag "Directory Servers to Query" | ||
| 64 | :type `(repeat (cons :tag "Directory Server" | ||
| 65 | (string :tag "Server Host Name or URI") | ||
| 66 | (choice :tag "Protocol" | ||
| 67 | :menu-tag "Protocol" | ||
| 68 | ,@(mapcar (lambda (s) | ||
| 69 | (list 'const | ||
| 70 | ':tag (symbol-name s) s)) | ||
| 71 | eudc-known-protocols) | ||
| 72 | (const :tag "None" nil)))) | ||
| 73 | :group 'eudc) | ||
| 74 | |||
| 52 | (defvar eudc-supported-protocols nil | 75 | (defvar eudc-supported-protocols nil |
| 53 | "Protocols currently supported by EUDC. | 76 | "Protocols currently supported by EUDC. |
| 54 | This variable is updated when protocol-specific libraries | 77 | This variable is updated when protocol-specific libraries |
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index bf67e4b5911..e038b280979 100644 --- a/lisp/net/eudc.el +++ b/lisp/net/eudc.el | |||
| @@ -76,10 +76,6 @@ | |||
| 76 | 76 | ||
| 77 | (defvar mode-popup-menu) | 77 | (defvar mode-popup-menu) |
| 78 | 78 | ||
| 79 | ;; List of known servers | ||
| 80 | ;; Alist of (SERVER . PROTOCOL) | ||
| 81 | (defvar eudc-server-hotlist nil) | ||
| 82 | |||
| 83 | ;; List of variables that have server- or protocol-local bindings | 79 | ;; List of variables that have server- or protocol-local bindings |
| 84 | (defvar eudc-local-vars nil) | 80 | (defvar eudc-local-vars nil) |
| 85 | 81 | ||
| @@ -688,7 +684,8 @@ server for future sessions." | |||
| 688 | (cons (symbol-name elt) | 684 | (cons (symbol-name elt) |
| 689 | elt)) | 685 | elt)) |
| 690 | eudc-known-protocols))))) | 686 | eudc-known-protocols))))) |
| 691 | (unless (or (member protocol | 687 | (unless (or (null protocol) |
| 688 | (member protocol | ||
| 692 | eudc-supported-protocols) | 689 | eudc-supported-protocols) |
| 693 | (load (concat "eudcb-" (symbol-name protocol)) t)) | 690 | (load (concat "eudcb-" (symbol-name protocol)) t)) |
| 694 | (error "Unsupported protocol: %s" protocol)) | 691 | (error "Unsupported protocol: %s" protocol)) |
| @@ -812,12 +809,21 @@ If REPLACE is non-nil, then this expansion replaces the name in the buffer. | |||
| 812 | Multiple servers can be tried with the same query until one finds a match, | 809 | Multiple servers can be tried with the same query until one finds a match, |
| 813 | see `eudc-inline-expansion-servers'" | 810 | see `eudc-inline-expansion-servers'" |
| 814 | (interactive) | 811 | (interactive) |
| 815 | (if (memq eudc-inline-expansion-servers | 812 | (cond |
| 816 | '(current-server server-then-hotlist)) | 813 | ((eq eudc-inline-expansion-servers 'current-server) |
| 817 | (or eudc-server | 814 | (or eudc-server |
| 818 | (call-interactively 'eudc-set-server)) | 815 | (call-interactively 'eudc-set-server))) |
| 816 | ((eq eudc-inline-expansion-servers 'server-then-hotlist) | ||
| 817 | (or eudc-server | ||
| 818 | ;; Allow server to be nil if hotlist is set. | ||
| 819 | eudc-server-hotlist | ||
| 820 | (call-interactively 'eudc-set-server))) | ||
| 821 | ((eq eudc-inline-expansion-servers 'hotlist) | ||
| 819 | (or eudc-server-hotlist | 822 | (or eudc-server-hotlist |
| 820 | (error "No server in the hotlist"))) | 823 | (error "No server in the hotlist"))) |
| 824 | (t | ||
| 825 | (error "Wrong value for `eudc-inline-expansion-servers': %S" | ||
| 826 | eudc-inline-expansion-servers))) | ||
| 821 | (let* ((end (point)) | 827 | (let* ((end (point)) |
| 822 | (beg (save-excursion | 828 | (beg (save-excursion |
| 823 | (if (re-search-backward "\\([:,]\\|^\\)[ \t]*" | 829 | (if (re-search-backward "\\([:,]\\|^\\)[ \t]*" |
| @@ -840,13 +846,12 @@ see `eudc-inline-expansion-servers'" | |||
| 840 | ((eq eudc-inline-expansion-servers 'hotlist) | 846 | ((eq eudc-inline-expansion-servers 'hotlist) |
| 841 | eudc-server-hotlist) | 847 | eudc-server-hotlist) |
| 842 | ((eq eudc-inline-expansion-servers 'server-then-hotlist) | 848 | ((eq eudc-inline-expansion-servers 'server-then-hotlist) |
| 843 | (cons (cons eudc-server eudc-protocol) | 849 | (if eudc-server |
| 844 | (delete (cons eudc-server eudc-protocol) servers))) | 850 | (cons (cons eudc-server eudc-protocol) |
| 851 | (delete (cons eudc-server eudc-protocol) servers)) | ||
| 852 | eudc-server-hotlist)) | ||
| 845 | ((eq eudc-inline-expansion-servers 'current-server) | 853 | ((eq eudc-inline-expansion-servers 'current-server) |
| 846 | (list (cons eudc-server eudc-protocol))) | 854 | (list (cons eudc-server eudc-protocol))))) |
| 847 | (t | ||
| 848 | (error "Wrong value for `eudc-inline-expansion-servers': %S" | ||
| 849 | eudc-inline-expansion-servers)))) | ||
| 850 | (if (and eudc-max-servers-to-query | 855 | (if (and eudc-max-servers-to-query |
| 851 | (> (length servers) eudc-max-servers-to-query)) | 856 | (> (length servers) eudc-max-servers-to-query)) |
| 852 | (setcdr (nthcdr (1- eudc-max-servers-to-query) servers) nil)) | 857 | (setcdr (nthcdr (1- eudc-max-servers-to-query) servers) nil)) |