Function: gnus-search--complete-key-data
gnus-search--complete-key-data is a byte-compiled function defined in
gnus-search.el.gz.
Signature
(gnus-search--complete-key-data)
Documentation
Potentially return completion data for a search key or value.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-search.el.gz
(defun gnus-search--complete-key-data ()
"Potentially return completion data for a search key or value."
(let* ((key-start (save-excursion
(or (re-search-backward " " (minibuffer-prompt-end) t)
(goto-char (minibuffer-prompt-end)))
(skip-chars-forward " -")
(point)))
(after-colon (save-excursion
(when (re-search-backward ":" key-start t)
(1+ (point)))))
in-string)
(if after-colon
;; We're in the value part of a key:value pair, which we
;; only handle in a contact-completion context.
(when (and gnus-search-contact-tables
(save-excursion
(re-search-backward "\\<-?\\(\\w+\\):" key-start t)
(member (match-string 1)
'("from" "to" "cc"
"bcc" "recipient" "address"))))
(setq in-string (nth 3 (syntax-ppss)))
(list (if in-string (1+ after-colon) after-colon)
(point) (apply #'completion-table-merge
gnus-search-contact-tables)
:exit-function
(lambda (str status)
;; If the value contains spaces, make sure it's
;; quoted.
(when (and (memql status '(exact finished))
(or (string-search " " str)
in-string))
(unless (looking-at-p "\\s\"")
(insert "\""))
;; Unless we already have an opening quote...
(unless in-string
(save-excursion
(goto-char after-colon)
(insert "\"")))))))
(list
key-start (point) gnus-search-expandable-keys
:exit-function (lambda (_s status)
(when (memql status '(exact finished))
(insert ":")))))))