diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-05-23 23:45:50 -0300 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-05-23 23:45:50 -0300 |
commit | a2a25d24350857dda87e28d6b2695cccc41bb32e (patch) | |
tree | 59bf876837e64b92932a52bf8ea8c526de285eb1 /lisp/pcomplete.el | |
parent | 2df215b52612a739eedcc024e47b6a9fa720dfda (diff) | |
download | emacs-a2a25d24350857dda87e28d6b2695cccc41bb32e.tar.gz |
Add an :exit-function for completion-at-point.
* lisp/minibuffer.el (completion--done): New fun.
(completion--do-completion): Use it. New arg `expect-exact'.
(minibuffer-complete, minibuffer-complete-word): Don't output message,
since completion--do-completion does it for us now.
(minibuffer-force-complete): Use completion--done and
completion--replace. Handle sole-completion case with more care.
(minibuffer-complete-and-exit): Use new `expect-exact' arg.
(completion-extra-properties): New var.
(completion-annotate-function): Make obsolete.
(minibuffer-completion-help): Adjust accordingly.
Use completion-list-insert-choice-function.
(completion-at-point, completion-help-at-point):
Bind completion-extra-properties.
(completion-pcm-word-delimiters): Add | (for uniquify, for example).
* lisp/simple.el (completion-list-insert-choice-function): New var.
(completion-setup-function): Preserve it.
(choose-completion): Pay attention to it, shuffle the code a bit.
(choose-completion-string): New arg `insert-function'.
* lisp/textmodes/bibtex.el: Convert to lexical binding.
(bibtex-mode-map): Use completion-at-point.
(bibtex-mode): Use define-derived-mode&completion-at-point-functions.
(bibtex-completion-at-point-function): New fun, from bibtex-complete.
(bibtex-complete): Define as obsolete alias.
(bibtex-complete-internal): Remove.
(bibtex-format-entry): Remove unused sub-group in regexp.
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/pcomplete.el (pcomplete-completions-at-point):
* lisp/comint.el (comint--complete-file-name-data): Use :exit-function
instead of completion-table-with-terminator so it also works for
choose-completion.
Diffstat (limited to 'lisp/pcomplete.el')
-rw-r--r-- | lisp/pcomplete.el | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 2f5dcdfb5e8..932436df8c9 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -527,19 +527,19 @@ Same as `pcomplete' but using the standard completion UI." (funcall pcomplete-norm-func (directory-file-name f)) pcomplete-seen))))))) - (unless (zerop (length pcomplete-termination-string)) - ;; Add a space at the end of completion. Use a terminator-regexp - ;; that never matches since the terminator cannot appear - ;; within the completion field anyway. - (setq table - (apply-partially #'completion-table-with-terminator - (cons pcomplete-termination-string - "\\`a\\`") - table))) (when pcomplete-ignore-case (setq table (apply-partially #'completion-table-case-fold table))) - (list beg (point) table :predicate pred)))))) + (list beg (point) table + :predicate pred + :exit-function + (unless (zerop (length pcomplete-termination-string)) + (lambda (_s finished) + (when (memq finished '(sole finished)) + (if (looking-at + (regexp-quote pcomplete-termination-string)) + (goto-char (match-end 0)) + (insert pcomplete-termination-string))))))))))) ;; I don't think such commands are usable before first setting up buffer-local ;; variables to parse args, so there's no point autoloading it. |