]> code.delx.au - gnu-emacs/blobdiff - src/fileio.c
(redisplay_window): Clear force_start field
[gnu-emacs] / src / fileio.c
index f6f99e5e3056751d5656c25026c97cc31c197ea7..33e887cb4c8fd735bd7e262042d7bb4c82d30157 100644 (file)
@@ -1949,7 +1949,18 @@ A prefix arg makes KEEP-TIME non-nil.")
          if (set_file_times (XSTRING (newname)->data, atime, mtime))
            report_file_error ("I/O error", Fcons (newname, Qnil));
        }
+#ifndef MSDOS
+      chmod (XSTRING (newname)->data, st.st_mode & 07777);
+#else /* MSDOS */
+#if defined (__DJGPP__) && __DJGPP__ > 1
+      /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
+         and if it can't, it tells so.  Otherwise, under MSDOS we usually
+         get only the READ bit, which will make the copied file read-only,
+         so it's better not to chmod at all.  */
+      if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
        chmod (XSTRING (newname)->data, st.st_mode & 07777);
+#endif /* DJGPP version 2 or newer */
+#endif /* MSDOS */
     }
 
   close (ifd);
@@ -2347,7 +2358,8 @@ check_executable (filename)
          && len >= 5
          && (stricmp ((suffix = filename + len-4), ".com") == 0
              || stricmp (suffix, ".exe") == 0
-             || stricmp (suffix, ".bat") == 0));
+             || stricmp (suffix, ".bat") == 0)
+         || (st.st_mode & S_IFMT) == S_IFDIR);
 #else /* not DOS_NT */
 #ifdef HAVE_EACCESS
   return (eaccess (filename, 1) >= 0);
@@ -3427,13 +3439,12 @@ to the file, instead of any buffer contents, and END is ignored.")
          nwritten += XINT (end) - tem;
          save_errno = errno;
        }
-
-      if (nwritten == 0)
-       {
-         /* If file was empty, still need to write the annotations */
-         failure = 0 > a_write (desc, "", 0, XINT (start), &annotations);
-         save_errno = errno;
-       }
+    }
+  else
+    {
+      /* If file was empty, still need to write the annotations */
+      failure = 0 > a_write (desc, "", 0, XINT (start), &annotations);
+      save_errno = errno;
     }
 
   immediate_quit = 0;
@@ -4437,7 +4448,10 @@ This applies only to the operation `inhibit-file-name-operation'.");
   Vinhibit_file_name_operation = Qnil;
 
   DEFVAR_LISP ("auto-save-list-file-name", &Vauto_save_list_file_name,
-    "File name in which we write a list of all auto save file names.");
+    "File name in which we write a list of all auto save file names.\n\
+This variable is initialized automatically from `auto-save-list-file-prefix'\n\
+shortly after Emacs reads your `.emacs' file, if you have not yet given it\n\
+a non-nil value.");
   Vauto_save_list_file_name = Qnil;
 
   defsubr (&Sfind_file_name_handler);