aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Fitzsimmons2022-03-14 17:33:42 -0400
committerThomas Fitzsimmons2022-03-14 17:36:35 -0400
commite56eb02a256a9875dedb2d9bba11b1eff7f487f8 (patch)
tree811bf41cab32f211eb9cceac44fe89315ab7a352
parent5c13c33e0c1b8b2ada18896e7a74b4d31007b09e (diff)
downloademacs-e56eb02a256a9875dedb2d9bba11b1eff7f487f8.tar.gz
emacs-e56eb02a256a9875dedb2d9bba11b1eff7f487f8.zip
EUDC: Fix a bug and some docstrings
* lisp/net/eudc.el (eudc-register-protocol): Add doc string. (eudc-expand-inline): Add TRY-ALL-SERVERS to docstring. (eudc-query-with-words): Fix early-return bug reported by Alexander Adolf. (eudc-menu): Add doc string. (eudc-install-menu): Likewise.
-rw-r--r--lisp/net/eudc.el39
1 files changed, 21 insertions, 18 deletions
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index 98d0565c2f5..7bbf54ee6cd 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -298,8 +298,8 @@ accordingly. Otherwise it is set to its EUDC default binding."
298;;}}} 298;;}}}
299 299
300 300
301;; Add PROTOCOL to the list of supported protocols
302(defun eudc-register-protocol (protocol) 301(defun eudc-register-protocol (protocol)
302 "Add PROTOCOL to the list of supported protocols."
303 (unless (memq protocol eudc-supported-protocols) 303 (unless (memq protocol eudc-supported-protocols)
304 (setq eudc-supported-protocols 304 (setq eudc-supported-protocols
305 (cons protocol eudc-supported-protocols)) 305 (cons protocol eudc-supported-protocols))
@@ -764,7 +764,8 @@ If SAVE-QUERY-AS-KILL is non-nil, then save the pre-expansion
764text to the kill ring. `eudc-expansion-save-query-as-kill' being 764text to the kill ring. `eudc-expansion-save-query-as-kill' being
765non-nil inverts the meaning of SAVE-QUERY-AS-KILL. 765non-nil inverts the meaning of SAVE-QUERY-AS-KILL.
766Multiple servers can be tried with the same query until one finds a match, 766Multiple servers can be tried with the same query until one finds a match,
767see `eudc-inline-expansion-servers'." 767see `eudc-inline-expansion-servers'. If TRY-ALL-SERVERS is
768non-nil, collect results from all servers."
768 (interactive) 769 (interactive)
769 (let* ((end (point)) 770 (let* ((end (point))
770 (beg (save-excursion 771 (beg (save-excursion
@@ -853,22 +854,22 @@ keep collecting results from subsequent servers after the first match."
853 (eudc-format-query query-words (car query-formats)) 854 (eudc-format-query query-words (car query-formats))
854 (eudc-translate-attribute-list 855 (eudc-translate-attribute-list
855 (cdr eudc-inline-expansion-format))))) 856 (cdr eudc-inline-expansion-format)))))
856 (if response 857 (when response
857 ;; Process response through eudc-inline-expansion-format. 858 ;; Process response through eudc-inline-expansion-format.
858 (dolist (r response) 859 (dolist (r response)
859 (let ((response-string 860 (let ((response-string
860 (apply #'format 861 (apply #'format
861 (car eudc-inline-expansion-format) 862 (car eudc-inline-expansion-format)
862 (mapcar 863 (mapcar
863 (lambda (field) 864 (lambda (field)
864 (or (cdr (assq field r)) 865 (or (cdr (assq field r))
865 "")) 866 ""))
866 (eudc-translate-attribute-list 867 (eudc-translate-attribute-list
867 (cdr eudc-inline-expansion-format)))))) 868 (cdr eudc-inline-expansion-format))))))
868 (if (> (length response-string) 0) 869 (if (> (length response-string) 0)
869 (push response-string response-strings)) 870 (push response-string response-strings))))
870 (when (not try-all-servers) 871 (when (not try-all-servers)
871 (throw 'found nil)))))))) 872 (throw 'found nil))))))
872 (catch 'found 873 (catch 'found
873 ;; Loop on the servers. 874 ;; Loop on the servers.
874 (dolist (server servers) 875 (dolist (server servers)
@@ -1103,6 +1104,7 @@ queries the server for the existing fields and displays a corresponding form."
1103 :help "Set the directory server to SERVER using PROTOCOL"])) 1104 :help "Set the directory server to SERVER using PROTOCOL"]))
1104 1105
1105(defun eudc-menu () 1106(defun eudc-menu ()
1107 "Return easy menu for EUDC."
1106 (let (command) 1108 (let (command)
1107 (append '("Directory Servers") 1109 (append '("Directory Servers")
1108 (list 1110 (list
@@ -1134,6 +1136,7 @@ queries the server for the existing fields and displays a corresponding form."
1134 eudc-tail-menu))) 1136 eudc-tail-menu)))
1135 1137
1136(defun eudc-install-menu () 1138(defun eudc-install-menu ()
1139 "Install EUDC menu."
1137 (define-key 1140 (define-key
1138 global-map 1141 global-map
1139 [menu-bar tools directory-search] 1142 [menu-bar tools directory-search]