# define lstat stat
#endif
+#ifndef FILE_SYSTEM_CASE
+#define FILE_SYSTEM_CASE(filename) (filename)
+#endif
+
/* Nonzero during writing of auto-save files */
int auto_saving;
extern int minibuffer_auto_raise;
+extern int history_delete_duplicates;
+
/* These variables describe handlers that have "already" had a chance
to handle the current operation.
if (!NILP (handler))
return call2 (handler, Qfile_name_directory, filename);
-#ifdef FILE_SYSTEM_CASE
filename = FILE_SYSTEM_CASE (filename);
-#endif
beg = SDATA (filename);
#ifdef DOS_NT
beg = strcpy (alloca (strlen (beg) + 1), beg);
UNGCPRO;
}
-#ifdef VMS
- /* Filenames on VMS are always upper case. */
- name = Fupcase (name);
-#endif
-#ifdef FILE_SYSTEM_CASE
name = FILE_SYSTEM_CASE (name);
-#endif
-
nm = SDATA (name);
#ifdef DOS_NT
slash = p;
}
if (p[0] == '-')
-#ifndef VMS4_4
- /* VMS pre V4.4,convert '-'s in filenames. */
+#ifdef NO_HYPHENS_IN_FILENAMES
if (lbrack == rbrack)
{
- if (dots < 2) /* this is to allow negative version numbers */
+ /* Avoid clobbering negative version numbers. */
+ if (dots < 2)
p[0] = '_';
}
else
-#endif /* VMS4_4 */
+#endif /* NO_HYPHENS_IN_FILENAMES */
if (lbrack > rbrack &&
((p[-1] == '.' || p[-1] == '[' || p[-1] == '<') &&
(p[1] == '.' || p[1] == ']' || p[1] == '>')))
lose = 1;
-#ifndef VMS4_4
+#ifdef NO_HYPHENS_IN_FILENAMES
else
p[0] = '_';
-#endif /* VMS4_4 */
+#endif /* NO_HYPHENS_IN_FILENAMES */
/* count open brackets, reset close bracket pointer */
if (p[0] == '[' || p[0] == '<')
lbrack++, brack = 0;
}
else
{
-#ifndef VMS4_4
+#ifdef NO_HYPHENS_IN_FILENAMES
if (*p == '-' &&
o[-1] != '[' && o[-1] != '<' && o[-1] != '.' &&
p[1] != ']' && p[1] != '>' && p[1] != '.')
*p = '_';
-#endif /* VMS4_4 */
+#endif /* NO_HYPHENS_IN_FILENAMES */
*o++ = *p++;
}
#else /* not VMS */
unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil.
A number as third arg means request confirmation if NEWNAME already exists.
This is what happens in interactive use with M-x.
-Fourth arg KEEP-TIME non-nil means give the new file the same
+Always sets the file modes of the output file to match the input file.
+Fourth arg KEEP-TIME non-nil means give the output file the same
last-modified time as the old one. (This works on only some systems.)
-A prefix arg makes KEEP-TIME non-nil.
-Also set the file modes of the target file to match the source file. */)
+A prefix arg makes KEEP-TIME non-nil. */)
(file, newname, ok_if_already_exists, keep_time)
Lisp_Object file, newname, ok_if_already_exists, keep_time;
{
if (!NILP (Vcoding_system_for_read))
val = Vcoding_system_for_read;
- else if (! NILP (replace))
- /* In REPLACE mode, we can use the same coding system
- that was used to visit the file. */
- val = current_buffer->buffer_file_coding_system;
else
{
/* Don't try looking inside a file for a coding system
if (! NILP (Ffboundp (Qafter_insert_file_set_coding)))
{
- insval = call1 (Qafter_insert_file_set_coding, make_number (inserted));
+ insval = call2 (Qafter_insert_file_set_coding, make_number (inserted),
+ visit);
if (! NILP (insval))
{
CHECK_NUMBER (insval);
before any other event (mouse or keypress) is handeled. */)
()
{
-#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON)
+#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (HAVE_CARBON)
if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
&& use_dialog_box
&& use_file_dialog
GCPRO2 (insdef, default_filename);
-#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON)
+#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (HAVE_CARBON)
if (! NILP (Fnext_read_file_uses_dialog_p ()))
{
/* If DIR contains a file name, split it. */
if (replace_in_history)
/* Replace what Fcompleting_read added to the history
with what we will actually return. */
- XSETCAR (Fsymbol_value (Qfile_name_history), double_dollars (val));
+ {
+ Lisp_Object val1 = double_dollars (val);
+ tem = Fsymbol_value (Qfile_name_history);
+ if (history_delete_duplicates)
+ XSETCDR (tem, Fdelete (val1, XCDR(tem)));
+ XSETCAR (tem, val1);
+ }
else if (add_to_history)
{
/* Add the value to the history--but not if it matches
Lisp_Object val1 = double_dollars (val);
tem = Fsymbol_value (Qfile_name_history);
if (! CONSP (tem) || NILP (Fequal (XCAR (tem), val1)))
- Fset (Qfile_name_history,
- Fcons (val1, tem));
+ {
+ if (history_delete_duplicates) tem = Fdelete (val1, tem);
+ Fset (Qfile_name_history, Fcons (val1, tem));
+ }
}
return val;