Mercurial > emacs
changeset 105711:834e4fdbe74a
(completion-table-with-terminator): Allow to specify the terminator-regexp.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 22 Oct 2009 16:14:49 +0000 |
parents | eb03599b0d98 |
children | 3f36e4d4d40c |
files | lisp/ChangeLog lisp/minibuffer.el |
diffstat | 2 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu Oct 22 15:27:17 2009 +0000 +++ b/lisp/ChangeLog Thu Oct 22 16:14:49 2009 +0000 @@ -1,5 +1,8 @@ 2009-10-22 Stefan Monnier <monnier@iro.umontreal.ca> + * minibuffer.el (completion-table-with-terminator): Allow to specify + the terminator-regexp. + * simple.el (switch-to-completions): Look for *Completions* in other frames as well.
--- a/lisp/minibuffer.el Thu Oct 22 15:27:17 2009 +0000 +++ b/lisp/minibuffer.el Thu Oct 22 16:14:49 2009 +0000 @@ -200,16 +200,24 @@ and TABLE only (via `apply-partially'). TABLE is a completion table, and TERMINATOR is a string appended to TABLE's completion if it is complete. TERMINATOR is also used to determine the -completion suffix's boundary." +completion suffix's boundary. +TERMINATOR can also be a cons cell (TERMINATOR . TERMINATOR-REGEXP) +in which case TERMINATOR-REGEXP is a regular expression whose submatch +number 1 should match TERMINATOR. This is used when there is a need to +distinguish occurrences of the TERMINATOR strings which are really terminators +from others (e.g. escaped)." (cond ((eq (car-safe action) 'boundaries) (let* ((suffix (cdr action)) (bounds (completion-boundaries string table pred suffix)) - (max (string-match (regexp-quote terminator) suffix))) + (terminator-regexp (if (consp terminator) + (cdr terminator) (regexp-quote terminator))) + (max (string-match terminator-regexp suffix))) (list* 'boundaries (car bounds) (min (cdr bounds) (or max (length suffix)))))) ((eq action nil) (let ((comp (try-completion string table pred))) + (if (consp terminator) (setq terminator (car terminator))) (if (eq comp t) (concat string terminator) (if (and (stringp comp)