diff options
| author | Stefan Monnier | 2011-02-18 12:18:16 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2011-02-18 12:18:16 -0500 |
| commit | aa56f3613e788df186bef09e2b5414428140377a (patch) | |
| tree | 270df0f00e2e9ec8f9df668bff84c4199d0169f8 /src | |
| parent | 42af913dd467c574bb5ccb8825aab5881d9221e7 (diff) | |
| download | emacs-aa56f3613e788df186bef09e2b5414428140377a.tar.gz emacs-aa56f3613e788df186bef09e2b5414428140377a.zip | |
* lisp/files.el (cd): Make completion obey cd-path.
* lread.c (Qdir_ok): New constant.
(syms_of_lread): Initialize it.
(openp): Don't ignore directories if the predicate returns dir-ok.
Fixes: debbugs:7924
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/lread.c | 17 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 72a9287513d..9839c7fcc98 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2011-02-18 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * lread.c (Qdir_ok): New constant. | ||
| 4 | (syms_of_lread): Initialize it. | ||
| 5 | (openp): Don't ignore directories if the predicate returns dir-ok. | ||
| 6 | |||
| 1 | 2011-02-18 Eli Zaretskii <eliz@gnu.org> | 7 | 2011-02-18 Eli Zaretskii <eliz@gnu.org> |
| 2 | 8 | ||
| 3 | * xdisp.c (display_line): Fix the change made for bug#7939. | 9 | * xdisp.c (display_line): Fix the change made for bug#7939. |
diff --git a/src/lread.c b/src/lread.c index 7e410fcc334..855869cd90d 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1250,7 +1250,9 @@ If SUFFIXES is non-nil, it should be a list of suffixes to append to | |||
| 1250 | file name when searching. | 1250 | file name when searching. |
| 1251 | If non-nil, PREDICATE is used instead of `file-readable-p'. | 1251 | If non-nil, PREDICATE is used instead of `file-readable-p'. |
| 1252 | PREDICATE can also be an integer to pass to the access(2) function, | 1252 | PREDICATE can also be an integer to pass to the access(2) function, |
| 1253 | in which case file-name-handlers are ignored. */) | 1253 | in which case file-name-handlers are ignored. |
| 1254 | This function will normally skip directories, so if you want it to find | ||
| 1255 | directories, make sure the PREDICATE function returns `dir-ok' for them. */) | ||
| 1254 | (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate) | 1256 | (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate) |
| 1255 | { | 1257 | { |
| 1256 | Lisp_Object file; | 1258 | Lisp_Object file; |
| @@ -1260,6 +1262,7 @@ in which case file-name-handlers are ignored. */) | |||
| 1260 | return file; | 1262 | return file; |
| 1261 | } | 1263 | } |
| 1262 | 1264 | ||
| 1265 | static Lisp_Object Qdir_ok; | ||
| 1263 | 1266 | ||
| 1264 | /* Search for a file whose name is STR, looking in directories | 1267 | /* Search for a file whose name is STR, looking in directories |
| 1265 | in the Lisp list PATH, and trying suffixes from SUFFIX. | 1268 | in the Lisp list PATH, and trying suffixes from SUFFIX. |
| @@ -1377,9 +1380,12 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto | |||
| 1377 | if (NILP (predicate)) | 1380 | if (NILP (predicate)) |
| 1378 | exists = !NILP (Ffile_readable_p (string)); | 1381 | exists = !NILP (Ffile_readable_p (string)); |
| 1379 | else | 1382 | else |
| 1380 | exists = !NILP (call1 (predicate, string)); | 1383 | { |
| 1381 | if (exists && !NILP (Ffile_directory_p (string))) | 1384 | Lisp_Object tmp = call1 (predicate, string); |
| 1382 | exists = 0; | 1385 | exists = !NILP (tmp) |
| 1386 | && (EQ (tmp, Qdir_ok) | ||
| 1387 | || !NILP (Ffile_directory_p (string))); | ||
| 1388 | } | ||
| 1383 | 1389 | ||
| 1384 | if (exists) | 1390 | if (exists) |
| 1385 | { | 1391 | { |
| @@ -4377,6 +4383,9 @@ to load. See also `load-dangerous-libraries'. */); | |||
| 4377 | Qfile_truename = intern_c_string ("file-truename"); | 4383 | Qfile_truename = intern_c_string ("file-truename"); |
| 4378 | staticpro (&Qfile_truename) ; | 4384 | staticpro (&Qfile_truename) ; |
| 4379 | 4385 | ||
| 4386 | Qdir_ok = intern_c_string ("dir-ok"); | ||
| 4387 | staticpro (&Qdir_ok); | ||
| 4388 | |||
| 4380 | Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation"); | 4389 | Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation"); |
| 4381 | staticpro (&Qdo_after_load_evaluation) ; | 4390 | staticpro (&Qdo_after_load_evaluation) ; |
| 4382 | 4391 | ||