Mercurial > hg > xemacs-beta
diff src/dired.c @ 5495:1f0b15040456
Merge.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 01 May 2011 18:44:03 +0100 |
parents | 861f2601a38b 248176c74e6b |
children | 56144c8593a8 |
line wrap: on
line diff
--- a/src/dired.c Sat Feb 20 06:03:00 2010 -0600 +++ b/src/dired.c Sun May 01 18:44:03 2011 +0100 @@ -1,13 +1,13 @@ /* Lisp functions for making directory listings. Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc. - Copyright (C) 2001, 2002, 2010 Ben Wing. + Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. -XEmacs is free software; you can redistribute it and/or modify it +XEmacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. +Free Software Foundation, either version 3 of the License, or (at your +option) any later version. XEmacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @@ -15,9 +15,7 @@ for more details. You should have received a copy of the GNU General Public License -along with XEmacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ /* Synched up with: FSF 19.30. */ @@ -46,6 +44,7 @@ Lisp_Object Qfile_name_completion; Lisp_Object Qfile_name_all_completions; Lisp_Object Qfile_attributes; +Lisp_Object Qfile_system_ignore_case_p; static Lisp_Object close_directory_unwind (Lisp_Object unwind_obj) @@ -180,7 +179,7 @@ unbind_to (speccount); /* This will close the dir */ if (NILP (nosort)) - list = Fsort (Fnreverse (list), Qstring_lessp); + list = list_sort (Fnreverse (list), check_string_lessp_nokey, Qnil, Qnil); RETURN_UNGCPRO (list); } @@ -508,7 +507,7 @@ return bestmatch; if (matchcount == 1 && bestmatchsize == file_name_length) return Qt; - return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); + return Fsubseq (bestmatch, Qzero, make_int (bestmatchsize)); } @@ -772,19 +771,26 @@ return bestmatch; if (matchcount == 1 && bestmatchsize == user_name_length) return Qt; - return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); + return Fsubseq (bestmatch, Qzero, make_int (bestmatchsize)); } Lisp_Object -make_directory_hash_table (const Ibyte *path) +make_directory_hash_table (Lisp_Object path) { DIR *d; - if ((d = qxe_opendir (path))) + if ((d = qxe_opendir (XSTRING_DATA (path)))) { + Lisp_Object hash_table_test = Qequal, hash = Qnil; DIRENTRY *dp; - Lisp_Object hash = - make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL); + + if (!UNBOUNDP (XSYMBOL_FUNCTION (Qfile_system_ignore_case_p)) + && !NILP (call1 (Qfile_system_ignore_case_p, path))) + { + hash_table_test = Qequalp; + } + + hash = make_lisp_hash_table (20, HASH_TABLE_NON_WEAK, hash_table_test); while ((dp = qxe_readdir (d))) { @@ -837,14 +843,13 @@ (filename)) { /* This function can GC. GC checked 1997.06.04. */ - Lisp_Object values[12]; Lisp_Object directory = Qnil; struct stat s; char modes[10]; - Lisp_Object handler; - struct gcpro gcpro1, gcpro2; + Lisp_Object handler, mode, modestring = Qnil, size, gid; + struct gcpro gcpro1, gcpro2, gcpro3; - GCPRO2 (filename, directory); + GCPRO3 (filename, directory, modestring); filename = Fexpand_file_name (filename, Qnil); /* If the file name has special constructs in it, @@ -862,7 +867,7 @@ return Qnil; } -#ifdef BSD4_3 +#ifdef BSD4_2 directory = Ffile_name_directory (filename); #endif @@ -885,49 +890,54 @@ switch (s.st_mode & S_IFMT) { default: - values[0] = Qnil; + mode = Qnil; break; case S_IFDIR: - values[0] = Qt; + mode = Qt; break; #ifdef S_IFLNK case S_IFLNK: - values[0] = Ffile_symlink_p (filename); + mode = Ffile_symlink_p (filename); break; #endif } - values[1] = make_int (s.st_nlink); - values[2] = make_int (s.st_uid); - values[3] = make_int (s.st_gid); - values[4] = make_time (s.st_atime); - values[5] = make_time (s.st_mtime); - values[6] = make_time (s.st_ctime); #ifndef HAVE_BIGNUM - values[7] = make_integer (NUMBER_FITS_IN_AN_EMACS_INT (s.st_size) ? - (EMACS_INT)s.st_size : -1); + size = make_integer (NUMBER_FITS_IN_AN_EMACS_INT (s.st_size) ? + (EMACS_INT)s.st_size : -1); #else - values[7] = make_integer (s.st_size); -#endif + size = make_integer (s.st_size); +#endif filemodestring (&s, modes); - values[8] = make_string ((Ibyte *) modes, 10); -#ifdef BSD4_3 /* file gid will be dir gid */ + modestring = make_string ((Ibyte *) modes, 10); + +#if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */ { struct stat sdir; if (!NILP (directory) && qxe_stat (XSTRING_DATA (directory), &sdir) == 0) - values[9] = (sdir.st_gid != s.st_gid) ? Qt : Qnil; + gid = (sdir.st_gid != s.st_gid) ? Qt : Qnil; else /* if we can't tell, assume worst */ - values[9] = Qt; + gid = Qt; } #else /* file gid will be egid */ - values[9] = (s.st_gid != getegid ()) ? Qt : Qnil; -#endif /* BSD4_3 */ - values[10] = make_int (s.st_ino); - values[11] = make_int (s.st_dev); - UNGCPRO; - return Flist (countof (values), values); + gid = (s.st_gid != getegid ()) ? Qt : Qnil; +#endif /* BSD4_2 or BSD4_3 */ + + RETURN_UNGCPRO (listn (12, + mode, + make_int (s.st_nlink), + make_int (s.st_uid), + make_int (s.st_gid), + make_time (s.st_atime), + make_time (s.st_mtime), + make_time (s.st_ctime), + size, + modestring, + gid, + make_int (s.st_ino), + make_int (s.st_dev))); } @@ -942,6 +952,7 @@ DEFSYMBOL (Qfile_name_completion); DEFSYMBOL (Qfile_name_all_completions); DEFSYMBOL (Qfile_attributes); + DEFSYMBOL (Qfile_system_ignore_case_p); DEFSUBR (Fdirectory_files); DEFSUBR (Ffile_name_completion);