aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris2014-08-10 17:38:19 -0700
committerGlenn Morris2014-08-10 17:38:19 -0700
commitf314e84fce8b394da20aa1d69121c74fb34f9a1e (patch)
tree214ada74bd8ae7e7450d5269b03cdf51ed87d11d /src
parentdb2f09ab1be010a06a88269d39fb14c191452f1c (diff)
downloademacs-f314e84fce8b394da20aa1d69121c74fb34f9a1e.tar.gz
emacs-f314e84fce8b394da20aa1d69121c74fb34f9a1e.zip
Revert 2013-01-31 change that decides coding system before backing up
It causes a more serious problem than the one it solves. This closes bug#18141, and reopens bug#13522. * lisp/files.el (basic-save-buffer-2): Revert 2013-01-31 change. * src/fileio.c: Revert 2013-01-31 change. (choose_write_coding_system): No longer callable from Lisp. Move last piece back here from Fwrite_region. (Fwrite_region, syms_of_fileio): Update for above changes. * test/automated/data/files-bug18141.el.gz: New file. * test/automated/files.el (files-test-bug-18141-file): New variable and test.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/fileio.c36
2 files changed, 20 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6ecce26be14..92d90accc60 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12014-08-11 Glenn Morris <rgm@gnu.org>
2
3 * fileio.c: Revert 2013-01-31 change, which chose coding system for
4 writing before backing up, since it causes a more serious problem
5 than the one it solves. (Closes Bug#18141, reopens Bug#13522.)
6 (choose_write_coding_system): No longer callable from Lisp.
7 Move last piece back here from Fwrite_region.
8 (Fwrite_region, syms_of_fileio): Update for above changes.
9
12014-08-09 Martin Rudalics <rudalics@gmx.at> 102014-08-09 Martin Rudalics <rudalics@gmx.at>
2 11
3 * window.c (Fwindow_new_total, Fwindow_new_normal) 12 * window.c (Fwindow_new_total, Fwindow_new_normal)
diff --git a/src/fileio.c b/src/fileio.c
index c87a6f71312..261928dd821 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -323,7 +323,6 @@ static Lisp_Object Qfile_acl;
323static Lisp_Object Qset_file_acl; 323static Lisp_Object Qset_file_acl;
324static Lisp_Object Qfile_newer_than_file_p; 324static Lisp_Object Qfile_newer_than_file_p;
325Lisp_Object Qinsert_file_contents; 325Lisp_Object Qinsert_file_contents;
326static Lisp_Object Qchoose_write_coding_system;
327Lisp_Object Qwrite_region; 326Lisp_Object Qwrite_region;
328static Lisp_Object Qverify_visited_file_modtime; 327static Lisp_Object Qverify_visited_file_modtime;
329static Lisp_Object Qset_visited_file_modtime; 328static Lisp_Object Qset_visited_file_modtime;
@@ -4531,24 +4530,14 @@ build_annotations_unwind (Lisp_Object arg)
4531 4530
4532/* Decide the coding-system to encode the data with. */ 4531/* Decide the coding-system to encode the data with. */
4533 4532
4534DEFUN ("choose-write-coding-system", Fchoose_write_coding_system, 4533static Lisp_Object
4535 Schoose_write_coding_system, 3, 6, 0, 4534choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4536 doc: /* Choose the coding system for writing a file. 4535 Lisp_Object append, Lisp_Object visit, Lisp_Object lockname,
4537Arguments are as for `write-region'. 4536 struct coding_system *coding)
4538This function is for internal use only. It may prompt the user. */ )
4539 (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4540 Lisp_Object append, Lisp_Object visit, Lisp_Object lockname)
4541{ 4537{
4542 Lisp_Object val; 4538 Lisp_Object val;
4543 Lisp_Object eol_parent = Qnil; 4539 Lisp_Object eol_parent = Qnil;
4544 4540
4545 /* Mimic write-region behavior. */
4546 if (NILP (start))
4547 {
4548 XSETFASTINT (start, BEGV);
4549 XSETFASTINT (end, ZV);
4550 }
4551
4552 if (auto_saving 4541 if (auto_saving
4553 && NILP (Fstring_equal (BVAR (current_buffer, filename), 4542 && NILP (Fstring_equal (BVAR (current_buffer, filename),
4554 BVAR (current_buffer, auto_save_file_name)))) 4543 BVAR (current_buffer, auto_save_file_name))))
@@ -4641,6 +4630,10 @@ This function is for internal use only. It may prompt the user. */ )
4641 } 4630 }
4642 4631
4643 val = coding_inherit_eol_type (val, eol_parent); 4632 val = coding_inherit_eol_type (val, eol_parent);
4633 setup_coding_system (val, coding);
4634
4635 if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
4636 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
4644 return val; 4637 return val;
4645} 4638}
4646 4639
@@ -4809,14 +4802,9 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4809 We used to make this choice before calling build_annotations, but that 4802 We used to make this choice before calling build_annotations, but that
4810 leads to problems when a write-annotate-function takes care of 4803 leads to problems when a write-annotate-function takes care of
4811 unsavable chars (as was the case with X-Symbol). */ 4804 unsavable chars (as was the case with X-Symbol). */
4812 Vlast_coding_system_used = 4805 Vlast_coding_system_used
4813 Fchoose_write_coding_system (start, end, filename, 4806 = choose_write_coding_system (start, end, filename,
4814 append, visit, lockname); 4807 append, visit, lockname, &coding);
4815
4816 setup_coding_system (Vlast_coding_system_used, &coding);
4817
4818 if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
4819 coding.mode |= CODING_MODE_SELECTIVE_DISPLAY;
4820 4808
4821#ifdef CLASH_DETECTION 4809#ifdef CLASH_DETECTION
4822 if (open_and_close_file && !auto_saving) 4810 if (open_and_close_file && !auto_saving)
@@ -5861,7 +5849,6 @@ syms_of_fileio (void)
5861 DEFSYM (Qset_file_acl, "set-file-acl"); 5849 DEFSYM (Qset_file_acl, "set-file-acl");
5862 DEFSYM (Qfile_newer_than_file_p, "file-newer-than-file-p"); 5850 DEFSYM (Qfile_newer_than_file_p, "file-newer-than-file-p");
5863 DEFSYM (Qinsert_file_contents, "insert-file-contents"); 5851 DEFSYM (Qinsert_file_contents, "insert-file-contents");
5864 DEFSYM (Qchoose_write_coding_system, "choose-write-coding-system");
5865 DEFSYM (Qwrite_region, "write-region"); 5852 DEFSYM (Qwrite_region, "write-region");
5866 DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime"); 5853 DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime");
5867 DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime"); 5854 DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime");
@@ -6100,7 +6087,6 @@ This includes interactive calls to `delete-file' and
6100 defsubr (&Sdefault_file_modes); 6087 defsubr (&Sdefault_file_modes);
6101 defsubr (&Sfile_newer_than_file_p); 6088 defsubr (&Sfile_newer_than_file_p);
6102 defsubr (&Sinsert_file_contents); 6089 defsubr (&Sinsert_file_contents);
6103 defsubr (&Schoose_write_coding_system);
6104 defsubr (&Swrite_region); 6090 defsubr (&Swrite_region);
6105 defsubr (&Scar_less_than_car); 6091 defsubr (&Scar_less_than_car);
6106 defsubr (&Sverify_visited_file_modtime); 6092 defsubr (&Sverify_visited_file_modtime);