> +;; Experimental completion-at-point function. I'm not sure this is a > +;; good idea yet -- with a large enough EBDB database, nearly any > +;; string is completable, meaning the other completion-at-point > +;; functions will rarely get a chance. > +(defun ebdb-completion-at-point-function () [...] > + (when completions > + (list start (point) > + (mapcar > + (lambda (str) > + ;; Gross. > + (if (string-match-p "@" str) > + str > + (capitalize str))) > + completions) > + '(:exclusive no))))) Completion-at-point-functions are expected to be cheap/fast (it's normal to call it in post-command-hook) and in order to work correctly the completion table it returns should ideally not depend on the text between START and END (i.e. it's OK to look at the text between START..END in order to choose between an email completion table and a file completion table, but it shouldn't throw away emails just because they don't seem to match the text between START..END). Also in order to be effective, you want them to be selective, e.g. only match when we're pretty sure that the completion-table we return is relevant (e.g. we're on a "To:" line in a message-mode buffer), so it usually depends on the major mode in which it's used. EBDB might elect not to provide a completion-at-point-function but instead to provide only a completion-table (or a bunch of completion tables). Then message-mode could use that completion-table when it determines that we're completing an email address. Stefan
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4