From: Kim F. Storm Date: Fri, 5 Nov 2004 12:33:07 +0000 (+0000) Subject: (Ffile_modes): Doc fix. X-Git-Tag: ttn-vms-21-2-B4~4176 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d4a42098b27cfecb4b22c03e0fe4bc85b0e81d51;p=emacs.git (Ffile_modes): Doc fix. (auto_save_1): Check for Ffile_modes nil value. --- diff --git a/src/ChangeLog b/src/ChangeLog index ce45e97514f..a38c3f7baeb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-11-05 Kim F. Storm + + * fileio.c (Ffile_modes): Doc fix. + (auto_save_1): Check for Ffile_modes nil value. + 2004-11-05 Kim F. Storm * xselect.c (struct selection_event_queue, selection_queue) diff --git a/src/fileio.c b/src/fileio.c index 4b5f4942566..aa37c296eb3 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3366,7 +3366,8 @@ This is the sort of file that holds an ordinary stream of data bytes. */) } DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, - doc: /* Return mode bits of file named FILENAME, as an integer. */) + doc: /* Return mode bits of file named FILENAME, as an integer. +Return nil, if file does not exist or is not accessible. */) (filename) Lisp_Object filename; { @@ -5712,17 +5713,21 @@ Lisp_Object auto_save_1 () { struct stat st; + Lisp_Object modes; + + auto_save_mode_bits = 0666; /* Get visited file's mode to become the auto save file's mode. */ - if (! NILP (current_buffer->filename) - && stat (SDATA (current_buffer->filename), &st) >= 0) - /* But make sure we can overwrite it later! */ - auto_save_mode_bits = st.st_mode | 0600; - else if (! NILP (current_buffer->filename)) - /* Remote files don't cooperate with stat. */ - auto_save_mode_bits = XINT (Ffile_modes (current_buffer->filename)) | 0600; - else - auto_save_mode_bits = 0666; + if (! NILP (current_buffer->filename)) + { + if (stat (SDATA (current_buffer->filename), &st) >= 0) + /* But make sure we can overwrite it later! */ + auto_save_mode_bits = st.st_mode | 0600; + else if ((modes = Ffile_modes (current_buffer->filename), + INTEGERP (modes))) + /* Remote files don't cooperate with stat. */ + auto_save_mode_bits = XINT (modes) | 0600; + } return Fwrite_region (Qnil, Qnil, @@ -6190,7 +6195,7 @@ before any other event (mouse or keypress) is handeled. */) #endif return Qnil; } - + DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 6, 0, doc: /* Read file name, prompting with PROMPT and completing in directory DIR. Value is not expanded---you must call `expand-file-name' yourself.