Here is a complete solution based on this discussion:
(require 'company) (require 'cl-lib) (defconst sample-completions '("procedural" "functional" "high-level" "low-level" "statically-scoped" "dynamically-scoped")) ;; This function is based on http://sixty-north.com/blog/writing-the-simplest-emacs-company-mode-backend (defun company-sample-backend (command &optional arg &rest ignored) (interactive (list 'interactive)) (let ((my-completions (copy-sequence sample-completions))) (cl-case command (interactive (company-begin-backend 'company-sample-backend)) (prefix (and t ;(eq major-mode 'fundamental-mode) (company-grab-symbol))) (candidates (cl-remove-if-not (lambda (c) (string-prefix-p arg c)) my-completions))))) (define-key company-mode-map (kbd "TAB") 'company-sample-backend) (setq resize-mini-windows t) (defun my-minibuffer-mode () (company-mode 1))
We can now perform the input without altering the normal function of the mini-buffer as follows:
(let ((company-backends (copy-sequence company-backends)) (minibuffer-setup-hook (copy-sequence minibuffer-setup-hook))) (add-to-list 'company-backends 'company-sample-backend) (add-hook 'minibuffer-setup-hook 'my-minibuffer-mode) (read-from-minibuffer "Prompt: "))
Acknowledgement: thank you very much to everyone for their comments.
completion-at-point?read-from-bufferin the post that I cited in my comment above and it still did not work...regexp-builderas the way you describe the interaction is similar to what it does. You may also find sphinxsearch.com to be of interest since it has a query language similar to what you describe and can produce results later useful for completion (it can sort the search results intelligently based on query parameters).