Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
f676868d
Commit
f676868d
authored
Apr 05, 1994
by
Karl Heuer
Browse files
(file_name_completion): Honor completion-regexp-list.
parent
c4d460ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
64 deletions
+83
-64
src/dired.c
src/dired.c
+83
-64
No files found.
src/dired.c
View file @
f676868d
...
...
@@ -93,6 +93,7 @@ extern struct re_pattern_buffer searchbuf;
#endif
extern
int
completion_ignore_case
;
extern
Lisp_Object
Vcompletion_regexp_list
;
extern
Lisp_Object
Ffind_file_name_handler
();
Lisp_Object
Vcompletion_ignored_extensions
;
...
...
@@ -375,80 +376,98 @@ file_name_completion (file, dirname, all_flag, ver_flag)
}
}
/* Unless an ignored-extensions match was found,
process this name as a completion */
if
(
passcount
||
!
CONSP
(
tem
))
/* If an ignored-extensions match was found,
don't process this name as a completion. */
if
(
!
passcount
&&
CONSP
(
tem
))
continue
;
if
(
!
passcount
)
{
/* Update computation of how much all possible completions match */
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
,
elt
,
zero
);
if
(
NILP
(
tem
))
break
;
}
if
(
CONSP
(
regexps
))
continue
;
}
matchcount
++
;
/* Update computation of how much all possible completions match */
if
(
all_flag
||
NILP
(
bestmatch
))
matchcount
++
;
if
(
all_flag
||
NILP
(
bestmatch
))
{
/* This is a possible completion */
if
(
directoryp
)
{
/* This is a possible completion */
if
(
directoryp
)
{
/* This completion is a directory; make it end with '/' */
name
=
Ffile_name_as_directory
(
make_string
(
dp
->
d_name
,
len
));
}
else
name
=
make_string
(
dp
->
d_name
,
len
);
if
(
all_flag
)
{
bestmatch
=
Fcons
(
name
,
bestmatch
);
}
else
{
bestmatch
=
name
;
bestmatchsize
=
XSTRING
(
name
)
->
size
;
}
/* This completion is a directory; make it end with '/' */
name
=
Ffile_name_as_directory
(
make_string
(
dp
->
d_name
,
len
));
}
else
name
=
make_string
(
dp
->
d_name
,
len
);
if
(
all_flag
)
{
bestmatch
=
Fcons
(
name
,
bestmatch
);
}
else
{
compare
=
min
(
bestmatchsize
,
len
);
p1
=
XSTRING
(
bestmatch
)
->
data
;
p2
=
(
unsigned
char
*
)
dp
->
d_name
;
matchsize
=
scmp
(
p1
,
p2
,
compare
);
if
(
matchsize
<
0
)
matchsize
=
compare
;
if
(
completion_ignore_case
)
bestmatch
=
name
;
bestmatchsize
=
XSTRING
(
name
)
->
size
;
}
}
else
{
compare
=
min
(
bestmatchsize
,
len
);
p1
=
XSTRING
(
bestmatch
)
->
data
;
p2
=
(
unsigned
char
*
)
dp
->
d_name
;
matchsize
=
scmp
(
p1
,
p2
,
compare
);
if
(
matchsize
<
0
)
matchsize
=
compare
;
if
(
completion_ignore_case
)
{
/* If this is an exact match except for case,
use it as the best match rather than one that is not
an exact match. This way, we get the case pattern
of the actual match. */
if
((
matchsize
==
len
&&
matchsize
+
!!
directoryp
<
XSTRING
(
bestmatch
)
->
size
)
||
/* If there is no exact match ignoring case,
prefer a match that does not change the case
of the input. */
(((
matchsize
==
len
)
==
(
matchsize
+
!!
directoryp
==
XSTRING
(
bestmatch
)
->
size
))
/* If there is more than one exact match aside from
case, and one of them is exact including case,
prefer that one. */
&&
!
bcmp
(
p2
,
XSTRING
(
file
)
->
data
,
XSTRING
(
file
)
->
size
)
&&
bcmp
(
p1
,
XSTRING
(
file
)
->
data
,
XSTRING
(
file
)
->
size
)))
{
/* If this is an exact match except for case,
use it as the best match rather than one that is not
an exact match. This way, we get the case pattern
of the actual match. */
if
((
matchsize
==
len
&&
matchsize
+
!!
directoryp
<
XSTRING
(
bestmatch
)
->
size
)
||
/* If there is no exact match ignoring case,
prefer a match that does not change the case
of the input. */
(((
matchsize
==
len
)
==
(
matchsize
+
!!
directoryp
==
XSTRING
(
bestmatch
)
->
size
))
/* If there is more than one exact match aside from
case, and one of them is exact including case,
prefer that one. */
&&
!
bcmp
(
p2
,
XSTRING
(
file
)
->
data
,
XSTRING
(
file
)
->
size
)
&&
bcmp
(
p1
,
XSTRING
(
file
)
->
data
,
XSTRING
(
file
)
->
size
)))
{
bestmatch
=
make_string
(
dp
->
d_name
,
len
);
if
(
directoryp
)
bestmatch
=
Ffile_name_as_directory
(
bestmatch
);
}
bestmatch
=
make_string
(
dp
->
d_name
,
len
);
if
(
directoryp
)
bestmatch
=
Ffile_name_as_directory
(
bestmatch
);
}
/* If this dirname all matches, see if implicit following
slash does too. */
if
(
directoryp
&&
compare
==
matchsize
&&
bestmatchsize
>
matchsize
&&
p1
[
matchsize
]
==
'/'
)
matchsize
++
;
bestmatchsize
=
matchsize
;
}
/* If this dirname all matches, see if implicit following
slash does too. */
if
(
directoryp
&&
compare
==
matchsize
&&
bestmatchsize
>
matchsize
&&
p1
[
matchsize
]
==
'/'
)
matchsize
++
;
bestmatchsize
=
matchsize
;
}
}
closedir
(
d
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment