Function: eudc-expand-inline
eudc-expand-inline is an autoloaded, interactive and byte-compiled
function defined in eudc.el.gz.
Signature
(eudc-expand-inline &optional SAVE-QUERY-AS-KILL TRY-ALL-SERVERS)
Documentation
Query the directory server, and expand the query string before point.
The query string consists of the buffer substring from the point back to
the preceding comma, colon or beginning of line.
The variable eudc-inline-query-format controls how to associate the
individual inline query words with directory attribute names.
After querying the server for the given string, the expansion specified by
eudc-inline-expansion-format is inserted in the buffer at point.
If SAVE-QUERY-AS-KILL is non-nil, then save the pre-expansion
text to the kill ring. eudc-expansion-save-query-as-kill being
non-nil inverts the meaning of SAVE-QUERY-AS-KILL.
Multiple servers can be tried with the same query until one finds a match,
see eudc-inline-expansion-servers. If TRY-ALL-SERVERS is
non-nil, collect results from all servers.
Probably introduced at or before Emacs version 29.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/net/eudc.el.gz
;;;###autoload
(defun eudc-expand-inline (&optional save-query-as-kill try-all-servers)
"Query the directory server, and expand the query string before point.
The query string consists of the buffer substring from the point back to
the preceding comma, colon or beginning of line.
The variable `eudc-inline-query-format' controls how to associate the
individual inline query words with directory attribute names.
After querying the server for the given string, the expansion specified by
`eudc-inline-expansion-format' is inserted in the buffer at point.
If SAVE-QUERY-AS-KILL is non-nil, then save the pre-expansion
text to the kill ring. `eudc-expansion-save-query-as-kill' being
non-nil inverts the meaning of SAVE-QUERY-AS-KILL.
Multiple servers can be tried with the same query until one finds a match,
see `eudc-inline-expansion-servers'. If TRY-ALL-SERVERS is
non-nil, collect results from all servers."
(interactive)
(let* ((end (point))
(beg (save-excursion
(if (re-search-backward "\\([:,]\\|^\\)[ \t]*"
(line-beginning-position) 'move)
(goto-char (match-end 0)))
(point)))
(query-words (split-string (buffer-substring-no-properties beg end)
"[ \t]+"))
(response-strings (eudc-query-with-words query-words try-all-servers)))
(if (null response-strings)
(error "No match")
(if (or
(and save-query-as-kill (not eudc-expansion-save-query-as-kill))
(and (not save-query-as-kill) eudc-expansion-save-query-as-kill))
(kill-ring-save beg end))
(cond
((or (= (length response-strings) 1)
(null eudc-multiple-match-handling-method)
(eq eudc-multiple-match-handling-method 'first))
(delete-region beg end)
(insert (car response-strings)))
((eq eudc-multiple-match-handling-method 'select)
(eudc-select response-strings beg end))
((eq eudc-multiple-match-handling-method 'all)
(delete-region beg end)
(insert (mapconcat #'identity response-strings ", ")))
((eq eudc-multiple-match-handling-method 'abort)
(error "There is more than one match for the query"))))))