diff options
Diffstat (limited to 'src/dired.c')
| -rw-r--r-- | src/dired.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/dired.c b/src/dired.c index 415f9ac5ae5..9b0f94a0760 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Lisp functions for making directory listings. | 1 | /* Lisp functions for making directory listings. |
| 2 | Copyright (C) 1985-1986, 1993-1994, 1999-2011 Free Software Foundation, Inc. | 2 | Copyright (C) 1985-1986, 1993-1994, 1999-2012 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -229,11 +229,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m | |||
| 229 | int len; | 229 | int len; |
| 230 | int wanted = 0; | 230 | int wanted = 0; |
| 231 | Lisp_Object name, finalname; | 231 | Lisp_Object name, finalname; |
| 232 | struct gcpro inner_gcpro1, inner_gcpro2; | 232 | struct gcpro gcpro1, gcpro2; |
| 233 | 233 | ||
| 234 | len = NAMLEN (dp); | 234 | len = NAMLEN (dp); |
| 235 | name = finalname = make_unibyte_string (dp->d_name, len); | 235 | name = finalname = make_unibyte_string (dp->d_name, len); |
| 236 | GCPRO2_VAR (finalname, name, inner_gcpro); | 236 | GCPRO2 (finalname, name); |
| 237 | 237 | ||
| 238 | /* Note: DECODE_FILE can GC; it should protect its argument, | 238 | /* Note: DECODE_FILE can GC; it should protect its argument, |
| 239 | though. */ | 239 | though. */ |
| @@ -289,23 +289,23 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m | |||
| 289 | /* Construct an expanded filename for the directory entry. | 289 | /* Construct an expanded filename for the directory entry. |
| 290 | Use the decoded names for input to Ffile_attributes. */ | 290 | Use the decoded names for input to Ffile_attributes. */ |
| 291 | Lisp_Object decoded_fullname, fileattrs; | 291 | Lisp_Object decoded_fullname, fileattrs; |
| 292 | struct gcpro innermost_gcpro1, innermost_gcpro2; | 292 | struct gcpro gcpro1, gcpro2; |
| 293 | 293 | ||
| 294 | decoded_fullname = fileattrs = Qnil; | 294 | decoded_fullname = fileattrs = Qnil; |
| 295 | GCPRO2_VAR (decoded_fullname, fileattrs, innermost_gcpro); | 295 | GCPRO2 (decoded_fullname, fileattrs); |
| 296 | 296 | ||
| 297 | /* Both Fexpand_file_name and Ffile_attributes can GC. */ | 297 | /* Both Fexpand_file_name and Ffile_attributes can GC. */ |
| 298 | decoded_fullname = Fexpand_file_name (name, directory); | 298 | decoded_fullname = Fexpand_file_name (name, directory); |
| 299 | fileattrs = Ffile_attributes (decoded_fullname, id_format); | 299 | fileattrs = Ffile_attributes (decoded_fullname, id_format); |
| 300 | 300 | ||
| 301 | list = Fcons (Fcons (finalname, fileattrs), list); | 301 | list = Fcons (Fcons (finalname, fileattrs), list); |
| 302 | UNGCPRO_VAR (innermost_gcpro); | 302 | UNGCPRO; |
| 303 | } | 303 | } |
| 304 | else | 304 | else |
| 305 | list = Fcons (finalname, list); | 305 | list = Fcons (finalname, list); |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | UNGCPRO_VAR (inner_gcpro); | 308 | UNGCPRO; |
| 309 | } | 309 | } |
| 310 | } | 310 | } |
| 311 | 311 | ||
| @@ -401,6 +401,7 @@ determined by the variable `completion-ignored-extensions', which see. */) | |||
| 401 | (Lisp_Object file, Lisp_Object directory, Lisp_Object predicate) | 401 | (Lisp_Object file, Lisp_Object directory, Lisp_Object predicate) |
| 402 | { | 402 | { |
| 403 | Lisp_Object handler; | 403 | Lisp_Object handler; |
| 404 | directory = Fexpand_file_name (directory, Qnil); | ||
| 404 | 405 | ||
| 405 | /* If the directory name has special constructs in it, | 406 | /* If the directory name has special constructs in it, |
| 406 | call the corresponding file handler. */ | 407 | call the corresponding file handler. */ |
| @@ -424,6 +425,7 @@ These are all file names in directory DIRECTORY which begin with FILE. */) | |||
| 424 | (Lisp_Object file, Lisp_Object directory) | 425 | (Lisp_Object file, Lisp_Object directory) |
| 425 | { | 426 | { |
| 426 | Lisp_Object handler; | 427 | Lisp_Object handler; |
| 428 | directory = Fexpand_file_name (directory, Qnil); | ||
| 427 | 429 | ||
| 428 | /* If the directory name has special constructs in it, | 430 | /* If the directory name has special constructs in it, |
| 429 | call the corresponding file handler. */ | 431 | call the corresponding file handler. */ |
| @@ -474,7 +476,6 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 474 | bestmatch = Qnil; | 476 | bestmatch = Qnil; |
| 475 | encoded_file = encoded_dir = Qnil; | 477 | encoded_file = encoded_dir = Qnil; |
| 476 | GCPRO5 (file, dirname, bestmatch, encoded_file, encoded_dir); | 478 | GCPRO5 (file, dirname, bestmatch, encoded_file, encoded_dir); |
| 477 | dirname = Fexpand_file_name (dirname, Qnil); | ||
| 478 | specbind (Qdefault_directory, dirname); | 479 | specbind (Qdefault_directory, dirname); |
| 479 | 480 | ||
| 480 | /* Do completion on the encoded file name | 481 | /* Do completion on the encoded file name |
| @@ -627,7 +628,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 627 | 628 | ||
| 628 | if (includeall && !canexclude) | 629 | if (includeall && !canexclude) |
| 629 | { /* If we have one non-excludable file, we want to exclude the | 630 | { /* If we have one non-excludable file, we want to exclude the |
| 630 | excudable files. */ | 631 | excludable files. */ |
| 631 | includeall = 0; | 632 | includeall = 0; |
| 632 | /* Throw away any previous excludable match found. */ | 633 | /* Throw away any previous excludable match found. */ |
| 633 | bestmatch = Qnil; | 634 | bestmatch = Qnil; |
| @@ -672,11 +673,11 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 672 | if (!NILP (predicate)) | 673 | if (!NILP (predicate)) |
| 673 | { | 674 | { |
| 674 | Lisp_Object val; | 675 | Lisp_Object val; |
| 675 | struct gcpro inner_gcpro1; | 676 | struct gcpro gcpro1; |
| 676 | 677 | ||
| 677 | GCPRO1_VAR (name, inner_gcpro); | 678 | GCPRO1 (name); |
| 678 | val = call1 (predicate, name); | 679 | val = call1 (predicate, name); |
| 679 | UNGCPRO_VAR (inner_gcpro); | 680 | UNGCPRO; |
| 680 | 681 | ||
| 681 | if (NILP (val)) | 682 | if (NILP (val)) |
| 682 | continue; | 683 | continue; |
| @@ -1003,7 +1004,7 @@ so last access time will always be midnight of that day. */) | |||
| 1003 | values[10] = INTEGER_TO_CONS (s.st_ino); | 1004 | values[10] = INTEGER_TO_CONS (s.st_ino); |
| 1004 | values[11] = INTEGER_TO_CONS (s.st_dev); | 1005 | values[11] = INTEGER_TO_CONS (s.st_dev); |
| 1005 | 1006 | ||
| 1006 | return Flist (sizeof(values) / sizeof(values[0]), values); | 1007 | return Flist (sizeof (values) / sizeof (values[0]), values); |
| 1007 | } | 1008 | } |
| 1008 | 1009 | ||
| 1009 | DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0, | 1010 | DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0, |