diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-03-30 05:17:30 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-03-30 05:17:30 +0000 |
commit | 98518d159187fe4ac98d53a7d6726552a6e24443 (patch) | |
tree | d6e208a318983539964dff9a3c52a426dbf0cea8 /src/minibuf.c | |
parent | d2b16b4edb7245dffbc7aa564b06f29201d1cc03 (diff) | |
download | emacs-98518d159187fe4ac98d53a7d6726552a6e24443.tar.gz |
(Vcompletion_regexp_list): New var.
(syms_of_minibuf): Set up Lisp var.
(Ftry_completion, Fall_completions):
Limit possible completions to strings matching those regexps.
Diffstat (limited to 'src/minibuf.c')
-rw-r--r-- | src/minibuf.c | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index 6ab992b5c1c..428e82b216c 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -87,6 +87,10 @@ Lisp_Object Qminibuffer_setup_hook, Vminibuffer_setup_hook; int completion_ignore_case; +/* List of regexps that should restrict possible completions. */ + +Lisp_Object Vcompletion_regexp_list; + /* Nonzero means raise the minibuffer frame when the minibuffer is entered. */ @@ -656,12 +660,27 @@ The argument given to PREDICATE is the alist element or the symbol from the obar /* Is this element a possible completion? */ - if (XTYPE (eltstring) == Lisp_String && - XSTRING (string)->size <= XSTRING (eltstring)->size && - 0 > scmp (XSTRING (eltstring)->data, XSTRING (string)->data, - XSTRING (string)->size)) + if (XTYPE (eltstring) == Lisp_String + && XSTRING (string)->size <= XSTRING (eltstring)->size + && 0 > scmp (XSTRING (eltstring)->data, XSTRING (string)->data, + XSTRING (string)->size)) { /* Yes. */ + Lisp_Object regexps; + Lisp_Object zero; + XFASTINT (zero) = 0; + + /* Ignore this element if it fails to match all the regexps. */ + for (regexps = Vcompletion_regexp_list; CONSP (regexps); + regexps = XCONS (regexps)->cdr) + { + tem = Fstring_match (XCONS (regexps)->car, eltstring, zero); + if (NILP (tem)) + break; + } + if (CONSP (regexps)) + continue; + /* Ignore this element if there is a predicate and the predicate doesn't like it. */ @@ -855,6 +874,21 @@ The argument given to PREDICATE is the alist element or the symbol from the obar XSTRING (string)->size)) { /* Yes. */ + Lisp_Object regexps; + Lisp_Object zero; + XFASTINT (zero) = 0; + + /* Ignore this element if it fails to match all the regexps. */ + for (regexps = Vcompletion_regexp_list; CONSP (regexps); + regexps = XCONS (regexps)->cdr) + { + tem = Fstring_match (XCONS (regexps)->car, eltstring, zero); + if (NILP (tem)) + break; + } + if (CONSP (regexps)) + continue; + /* Ignore this element if there is a predicate and the predicate doesn't like it. */ @@ -1581,6 +1615,10 @@ Each minibuffer output is added with\n\ "*Non-nil means entering the minibuffer raises the minibuffer's frame."); minibuffer_auto_raise = 0; + DEFVAR_LISP ("completion-regexp-list", &Vcompletion_regexp_list, + "List of regexps that should restrict possible completions."); + Vcompletion_regexp_list = Qnil; + defsubr (&Sread_from_minibuffer); defsubr (&Seval_minibuffer); defsubr (&Sread_minibuffer); |