Replace `iff' in comments.
[bpt/emacs.git] / src / fileio.c
index 50c5a40..26723fa 100644 (file)
@@ -1,13 +1,13 @@
 /* File IO for GNU Emacs.
    Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996,
                  1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006 Free Software Foundation, Inc.
+                 2005, 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs 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)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -2471,7 +2471,7 @@ uid and gid of FILE to NEWNAME.  */)
 
   if (NILP (ok_if_already_exists)
       || INTEGERP (ok_if_already_exists))
-    barf_or_query_if_file_exists (encoded_newname, "copy to it",
+    barf_or_query_if_file_exists (newname, "copy to it",
                                  INTEGERP (ok_if_already_exists), &out_st, 0);
   else if (stat (SDATA (encoded_newname), &out_st) < 0)
     out_st.st_mode = 0;
@@ -2780,7 +2780,7 @@ This is what happens in interactive use with M-x.  */)
 #endif
   if (NILP (ok_if_already_exists)
       || INTEGERP (ok_if_already_exists))
-    barf_or_query_if_file_exists (encoded_newname, "rename to it",
+    barf_or_query_if_file_exists (newname, "rename to it",
                                  INTEGERP (ok_if_already_exists), 0, 0);
 #ifndef BSD4_1
   if (0 > rename (SDATA (encoded_file), SDATA (encoded_newname)))
@@ -2857,7 +2857,7 @@ This is what happens in interactive use with M-x.  */)
 
   if (NILP (ok_if_already_exists)
       || INTEGERP (ok_if_already_exists))
-    barf_or_query_if_file_exists (encoded_newname, "make it a new name",
+    barf_or_query_if_file_exists (newname, "make it a new name",
                                  INTEGERP (ok_if_already_exists), 0, 0);
 
   unlink (SDATA (newname));
@@ -2918,7 +2918,7 @@ This happens for interactive use with M-x.  */)
 
   if (NILP (ok_if_already_exists)
       || INTEGERP (ok_if_already_exists))
-    barf_or_query_if_file_exists (encoded_linkname, "make it a link",
+    barf_or_query_if_file_exists (linkname, "make it a link",
                                  INTEGERP (ok_if_already_exists), 0, 0);
   if (0 > symlink (SDATA (encoded_filename),
                   SDATA (encoded_linkname)))
@@ -5191,7 +5191,7 @@ This does code conversion according to the value of
  * if we do writes that don't end with a carriage return. Furthermore
  * it cannot handle writes of more then 16K. The modified
  * version of "sys_write" in SYSDEP.C (see comment there) copes with
- * this EXCEPT for the last record (iff it doesn't end with a carriage
+ * this EXCEPT for the last record (if it doesn't end with a carriage
  * return). This implies that if your buffer doesn't end with a carriage
  * return, you get one free... tough. However it also means that if
  * we make two calls to sys_write (a la the following code) you can
@@ -5692,11 +5692,9 @@ file modification time, this function returns 0.
 See Info node `(elisp)Modification Time' for more details.  */)
      ()
 {
-  Lisp_Object tcons;
-  tcons = long_to_cons ((unsigned long) current_buffer->modtime);
-  if (CONSP (tcons))
-    return list2 (XCAR (tcons), XCDR (tcons));
-  return tcons;
+  if (! current_buffer->modtime)
+    return make_number (0);
+  return make_time ((time_t) current_buffer->modtime);
 }
 
 DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime,
@@ -5804,7 +5802,11 @@ do_auto_save_unwind (arg)  /* used as unwind-protect function */
   FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
   auto_saving = 0;
   if (stream != NULL)
-    fclose (stream);
+    {
+      BLOCK_INPUT;
+      fclose (stream);
+      UNBLOCK_INPUT;
+    }
   return Qnil;
 }
 
@@ -5934,6 +5936,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer.  */)
        if (STRINGP (b->auto_save_file_name)
            && stream != NULL && do_handled_files == 0)
          {
+           BLOCK_INPUT;
            if (!NILP (b->filename))
              {
                fwrite (SDATA (b->filename), 1,
@@ -5943,6 +5946,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer.  */)
            fwrite (SDATA (b->auto_save_file_name), 1,
                    SBYTES (b->auto_save_file_name), stream);
            putc ('\n', stream);
+           UNBLOCK_INPUT;
          }
 
        if (!NILP (current_only)
@@ -6159,7 +6163,7 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte
   if (NILP (action))
     {
       specdir = Ffile_name_directory (string);
-      val = Ffile_name_completion (name, realdir);
+      val = Ffile_name_completion (name, realdir, Vread_file_name_predicate);
       UNGCPRO;
       if (!STRINGP (val))
        {