aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-05-05 19:32:02 +0000
committerRichard M. Stallman1998-05-05 19:32:02 +0000
commit643c73b90bcfd4f0eafd5681a3539ef49a29821c (patch)
tree89dd965ade3cc31b44b116d762ff2ffcc5a7cea5 /src
parenta558a05d61acede40cb8f11fb1d2d74f1f142846 (diff)
downloademacs-643c73b90bcfd4f0eafd5681a3539ef49a29821c.tar.gz
emacs-643c73b90bcfd4f0eafd5681a3539ef49a29821c.zip
(barf_or_query_if_file_exists): Encode file name.
(Finsert_file_contents): Don't use gap pos to set point if del_range_byte deleted 0 characters.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 099c9e69649..d97e05c37f2 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2144,13 +2144,15 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
2144 struct stat *statptr; 2144 struct stat *statptr;
2145 int quick; 2145 int quick;
2146{ 2146{
2147 register Lisp_Object tem; 2147 register Lisp_Object tem, encoded_filename;
2148 struct stat statbuf; 2148 struct stat statbuf;
2149 struct gcpro gcpro1; 2149 struct gcpro gcpro1;
2150 2150
2151 encoded_filename = ENCODE_FILE (absname);
2152
2151 /* stat is a good way to tell whether the file exists, 2153 /* stat is a good way to tell whether the file exists,
2152 regardless of what access permissions it has. */ 2154 regardless of what access permissions it has. */
2153 if (stat (XSTRING (absname)->data, &statbuf) >= 0) 2155 if (stat (XSTRING (encoded_filename)->data, &statbuf) >= 0)
2154 { 2156 {
2155 if (! interactive) 2157 if (! interactive)
2156 Fsignal (Qfile_already_exists, 2158 Fsignal (Qfile_already_exists,
@@ -3762,7 +3764,14 @@ This does code conversion according to the value of\n\
3762 we are taking from the file. */ 3764 we are taking from the file. */
3763 inserted -= (Z_BYTE - same_at_end) + (same_at_start - BEG_BYTE); 3765 inserted -= (Z_BYTE - same_at_end) + (same_at_start - BEG_BYTE);
3764 del_range_byte (same_at_start, same_at_end, 0); 3766 del_range_byte (same_at_start, same_at_end, 0);
3765 SET_PT_BOTH (GPT, GPT_BYTE); 3767 if (same_at_end != same_at_start)
3768 SET_PT_BOTH (GPT, GPT_BYTE);
3769 else
3770 {
3771 /* Insert from the file at the proper position. */
3772 temp = BYTE_TO_CHAR (same_at_start);
3773 SET_PT_BOTH (temp, same_at_start);
3774 }
3766 3775
3767 insert_1 (conversion_buffer + same_at_start - BEG_BYTE, inserted, 3776 insert_1 (conversion_buffer + same_at_start - BEG_BYTE, inserted,
3768 0, 0, 0); 3777 0, 0, 0);