diff options
| author | Eli Zaretskii | 2009-07-11 15:45:45 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2009-07-11 15:45:45 +0000 |
| commit | 65156807134f7d430f9e32086a228e4a3ad4f386 (patch) | |
| tree | 831ec08b72d62e076c89a5dfce46b844ad5e7388 /src | |
| parent | be4c6380de40fb19e83df44fe4532275d1d12067 (diff) | |
| download | emacs-65156807134f7d430f9e32086a228e4a3ad4f386.tar.gz emacs-65156807134f7d430f9e32086a228e4a3ad4f386.zip | |
(directory_files_internal_w32_unwind) [WINDOWSNT]: New function.
(directory_files_internal) [WINDOWSNT]: Bind
w32-get-true-file-attributes to either t or nil, depending whether the
filesystem of the directory is fast or slow.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 15 | ||||
| -rw-r--r-- | src/dired.c | 44 |
2 files changed, 59 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a75a48b8b9b..3d952982237 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2009-07-11 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * dired.c (directory_files_internal_w32_unwind) [WINDOWSNT]: New | ||
| 4 | function. | ||
| 5 | (directory_files_internal) [WINDOWSNT]: Bind | ||
| 6 | w32-get-true-file-attributes to either t or nil, depending whether | ||
| 7 | the filesystem of the directory is fast or slow. | ||
| 8 | |||
| 9 | * w32.c (logon_network_drive): Don't assume PATH is an absolute | ||
| 10 | file name. | ||
| 11 | (is_slow_fs): New function. | ||
| 12 | (stat): Use it to determine whether to issue more system calls to | ||
| 13 | get accurate file attributes, when w32-get-true-file-attributes is | ||
| 14 | `local'. | ||
| 15 | |||
| 1 | 2009-07-10 Jan Djärv <jan.h.d@swipnet.se> | 16 | 2009-07-10 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 17 | ||
| 3 | * xfns.c (Fx_select_font): Remember last font selected in | 18 | * xfns.c (Fx_select_font): Remember last font selected in |
diff --git a/src/dired.c b/src/dired.c index 1c2149c7d2c..2d2f196c8ff 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -104,6 +104,7 @@ extern void filemodestring P_ ((struct stat *, char *)); | |||
| 104 | extern int completion_ignore_case; | 104 | extern int completion_ignore_case; |
| 105 | extern Lisp_Object Qcompletion_ignore_case; | 105 | extern Lisp_Object Qcompletion_ignore_case; |
| 106 | extern Lisp_Object Vcompletion_regexp_list; | 106 | extern Lisp_Object Vcompletion_regexp_list; |
| 107 | extern Lisp_Object Vw32_get_true_file_attributes; | ||
| 107 | 108 | ||
| 108 | Lisp_Object Vcompletion_ignored_extensions; | 109 | Lisp_Object Vcompletion_ignored_extensions; |
| 109 | Lisp_Object Qdirectory_files; | 110 | Lisp_Object Qdirectory_files; |
| @@ -115,6 +116,14 @@ Lisp_Object Qfile_attributes_lessp; | |||
| 115 | 116 | ||
| 116 | static int scmp P_ ((unsigned char *, unsigned char *, int)); | 117 | static int scmp P_ ((unsigned char *, unsigned char *, int)); |
| 117 | 118 | ||
| 119 | #ifdef WINDOWSNT | ||
| 120 | Lisp_Object | ||
| 121 | directory_files_internal_w32_unwind (Lisp_Object arg) | ||
| 122 | { | ||
| 123 | Vw32_get_true_file_attributes = arg; | ||
| 124 | return Qnil; | ||
| 125 | } | ||
| 126 | #endif | ||
| 118 | 127 | ||
| 119 | Lisp_Object | 128 | Lisp_Object |
| 120 | directory_files_internal_unwind (dh) | 129 | directory_files_internal_unwind (dh) |
| @@ -146,6 +155,9 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format) | |||
| 146 | int count = SPECPDL_INDEX (); | 155 | int count = SPECPDL_INDEX (); |
| 147 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 156 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 148 | DIRENTRY *dp; | 157 | DIRENTRY *dp; |
| 158 | #ifdef WINDOWSNT | ||
| 159 | Lisp_Object w32_save = Qnil; | ||
| 160 | #endif | ||
| 149 | 161 | ||
| 150 | /* Because of file name handlers, these functions might call | 162 | /* Because of file name handlers, these functions might call |
| 151 | Ffuncall, and cause a GC. */ | 163 | Ffuncall, and cause a GC. */ |
| @@ -194,6 +206,34 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format) | |||
| 194 | record_unwind_protect (directory_files_internal_unwind, | 206 | record_unwind_protect (directory_files_internal_unwind, |
| 195 | make_save_value (d, 0)); | 207 | make_save_value (d, 0)); |
| 196 | 208 | ||
| 209 | #ifdef WINDOWSNT | ||
| 210 | if (attrs) | ||
| 211 | { | ||
| 212 | extern Lisp_Object Qlocal; | ||
| 213 | extern int is_slow_fs (const char *); | ||
| 214 | |||
| 215 | /* Do this only once to avoid doing it (in w32.c:stat) for each | ||
| 216 | file in the directory, when we call Ffile_attributes below. */ | ||
| 217 | record_unwind_protect (directory_files_internal_w32_unwind, | ||
| 218 | Vw32_get_true_file_attributes); | ||
| 219 | w32_save = Vw32_get_true_file_attributes; | ||
| 220 | if (EQ (Vw32_get_true_file_attributes, Qlocal)) | ||
| 221 | { | ||
| 222 | char *dirnm = SDATA (dirfilename); | ||
| 223 | char *fn = alloca (SBYTES (dirfilename) + 1); | ||
| 224 | |||
| 225 | strncpy (fn, SDATA (dirfilename), SBYTES (dirfilename)); | ||
| 226 | fn[SBYTES (dirfilename)] = '\0'; | ||
| 227 | /* w32.c:stat will notice these bindings and avoid calling | ||
| 228 | GetDriveType for each file. */ | ||
| 229 | if (is_slow_fs (fn)) | ||
| 230 | Vw32_get_true_file_attributes = Qnil; | ||
| 231 | else | ||
| 232 | Vw32_get_true_file_attributes = Qt; | ||
| 233 | } | ||
| 234 | } | ||
| 235 | #endif | ||
| 236 | |||
| 197 | directory_nbytes = SBYTES (directory); | 237 | directory_nbytes = SBYTES (directory); |
| 198 | re_match_object = Qt; | 238 | re_match_object = Qt; |
| 199 | 239 | ||
| @@ -310,6 +350,10 @@ directory_files_internal (directory, full, match, nosort, attrs, id_format) | |||
| 310 | BLOCK_INPUT; | 350 | BLOCK_INPUT; |
| 311 | closedir (d); | 351 | closedir (d); |
| 312 | UNBLOCK_INPUT; | 352 | UNBLOCK_INPUT; |
| 353 | #ifdef WINDOWSNT | ||
| 354 | if (attrs) | ||
| 355 | Vw32_get_true_file_attributes = w32_save; | ||
| 356 | #endif | ||
| 313 | 357 | ||
| 314 | /* Discard the unwind protect. */ | 358 | /* Discard the unwind protect. */ |
| 315 | specpdl_ptr = specpdl + count; | 359 | specpdl_ptr = specpdl + count; |