A backend plugging into the slime completion mechanism. It can display arglists, docstrings and display the source of a completion candidate.
The newest version can always be found at its GitHub repository.
There is a copy on the EmacsWiki, though it may be outdated:
A variant that is always kept compatible with the latest Slime ELPA package is available at: http://gist.github.com/179847
The first version of this file, for use with an older Slime, can be found at: http://common-lisp.net/pipermail/slime-devel/attachments/20090328/91ce4004/attachment.asc
(defun company-elisp-finder-keyword-backend (command &optional arg &rest ign) "A `company-backend' for finder-keywords." (case command ('prefix (and (require 'finder nil t) (or (company-grab ":group '\\(\\(\\sw\\|\\s_\\)*\\)" 1) (company-grab "Keywords:.*[ \t]+\\(\\(\\sw\\|\\s_\\)*\\)" 1)))) ('candidates (all-completions arg finder-known-keywords)) ('meta (cdr (assoc (intern arg) finder-known-keywords)))))
It fetches the list of functions from php.net if it’s not fetched already, so it does not need a static completion list, only an internet connections:
(defun company-my-php-backend (command &optional arg &rest ignored) (case command ('prefix (and (eq major-mode 'php-mode) (company-grab-symbol))) ('sorted t) ('candidates (all-completions arg (if (and (boundp 'my-php-symbol-hash) my-php-symbol-hash) my-php-symbol-hash (message "Fetching completion list...") (with-current-buffer (url-retrieve-synchronously "http://php.net/quickref.php") (goto-char (point-min)) (if (re-search-forward "<!-- result list start -->" nil t) (let ((end (save-excursion (if (re-search-forward "<!-- result list end -->" nil t) (point))))) (if end (let ((hash (make-hash-table))) (while (re-search-forward ">\\([^<]+\\)</a>" end t) (puthash (match-string 1) t hash)) (setq my-php-symbol-hash hash)))))))))))