aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2013-02-01 00:03:38 +0100
committerJoakim Verona2013-02-01 00:03:38 +0100
commitae8a4617f3829786fc675b0dd8d818697da6a214 (patch)
treeeeebe5c4f71fc9d5d31084a4edf03b556757c34d /src
parent9658cee25c3e3f97d02f4fa05f9ee4f2f14fd76b (diff)
parent1e77b18e33526319ee8bb9f1ebb28860ad20a4c2 (diff)
downloademacs-ae8a4617f3829786fc675b0dd8d818697da6a214.tar.gz
emacs-ae8a4617f3829786fc675b0dd8d818697da6a214.zip
auto upstream
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/fileio.c36
2 files changed, 32 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bb03ba10bb0..5c13e35306d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12013-01-31 Glenn Morris <rgm@gnu.org>
2
3 * fileio.c (choose_write_coding_system): Make it callable from Lisp.
4 (Fwrite_region): Update for new choose_write_coding_system args.
5 Move the last piece of choose_write_coding_system here. (Bug#13522)
6 (syms_of_fileio): Add choose-write-coding-system.
7
12013-01-30 Eli Zaretskii <eliz@gnu.org> 82013-01-30 Eli Zaretskii <eliz@gnu.org>
2 9
3 * w32.c (sys_open): Zero out the flags for the new file descriptor. 10 * w32.c (sys_open): Zero out the flags for the new file descriptor.
diff --git a/src/fileio.c b/src/fileio.c
index e788bebab61..cd4bd4fa86e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -249,6 +249,7 @@ static Lisp_Object Qfile_acl;
249static Lisp_Object Qset_file_acl; 249static Lisp_Object Qset_file_acl;
250static Lisp_Object Qfile_newer_than_file_p; 250static Lisp_Object Qfile_newer_than_file_p;
251Lisp_Object Qinsert_file_contents; 251Lisp_Object Qinsert_file_contents;
252Lisp_Object Qchoose_write_coding_system;
252Lisp_Object Qwrite_region; 253Lisp_Object Qwrite_region;
253static Lisp_Object Qverify_visited_file_modtime; 254static Lisp_Object Qverify_visited_file_modtime;
254static Lisp_Object Qset_visited_file_modtime; 255static Lisp_Object Qset_visited_file_modtime;
@@ -4615,14 +4616,24 @@ build_annotations_unwind (Lisp_Object arg)
4615 4616
4616/* Decide the coding-system to encode the data with. */ 4617/* Decide the coding-system to encode the data with. */
4617 4618
4618static Lisp_Object 4619DEFUN ("choose-write-coding-system", Fchoose_write_coding_system,
4619choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object filename, 4620 Schoose_write_coding_system, 3, 6, 0,
4620 Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, 4621 doc: /* Choose the coding system for writing a file.
4621 struct coding_system *coding) 4622Arguments are as for `write-region'.
4623This function is for internal use only. It may prompt the user. */ )
4624 (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4625 Lisp_Object append, Lisp_Object visit, Lisp_Object lockname)
4622{ 4626{
4623 Lisp_Object val; 4627 Lisp_Object val;
4624 Lisp_Object eol_parent = Qnil; 4628 Lisp_Object eol_parent = Qnil;
4625 4629
4630 /* Mimic write-region behavior. */
4631 if (NILP (start))
4632 {
4633 XSETFASTINT (start, BEGV);
4634 XSETFASTINT (end, ZV);
4635 }
4636
4626 if (auto_saving 4637 if (auto_saving
4627 && NILP (Fstring_equal (BVAR (current_buffer, filename), 4638 && NILP (Fstring_equal (BVAR (current_buffer, filename),
4628 BVAR (current_buffer, auto_save_file_name)))) 4639 BVAR (current_buffer, auto_save_file_name))))
@@ -4715,10 +4726,6 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
4715 } 4726 }
4716 4727
4717 val = coding_inherit_eol_type (val, eol_parent); 4728 val = coding_inherit_eol_type (val, eol_parent);
4718 setup_coding_system (val, coding);
4719
4720 if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
4721 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
4722 return val; 4729 return val;
4723} 4730}
4724 4731
@@ -4874,9 +4881,14 @@ This calls `write-region-annotate-functions' at the start, and
4874 We used to make this choice before calling build_annotations, but that 4881 We used to make this choice before calling build_annotations, but that
4875 leads to problems when a write-annotate-function takes care of 4882 leads to problems when a write-annotate-function takes care of
4876 unsavable chars (as was the case with X-Symbol). */ 4883 unsavable chars (as was the case with X-Symbol). */
4877 Vlast_coding_system_used 4884 Vlast_coding_system_used =
4878 = choose_write_coding_system (start, end, filename, 4885 Fchoose_write_coding_system (start, end, filename,
4879 append, visit, lockname, &coding); 4886 append, visit, lockname);
4887
4888 setup_coding_system (Vlast_coding_system_used, &coding);
4889
4890 if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
4891 coding.mode |= CODING_MODE_SELECTIVE_DISPLAY;
4880 4892
4881#ifdef CLASH_DETECTION 4893#ifdef CLASH_DETECTION
4882 if (!auto_saving) 4894 if (!auto_saving)
@@ -5861,6 +5873,7 @@ syms_of_fileio (void)
5861 DEFSYM (Qset_file_acl, "set-file-acl"); 5873 DEFSYM (Qset_file_acl, "set-file-acl");
5862 DEFSYM (Qfile_newer_than_file_p, "file-newer-than-file-p"); 5874 DEFSYM (Qfile_newer_than_file_p, "file-newer-than-file-p");
5863 DEFSYM (Qinsert_file_contents, "insert-file-contents"); 5875 DEFSYM (Qinsert_file_contents, "insert-file-contents");
5876 DEFSYM (Qchoose_write_coding_system, "choose-write-coding-system");
5864 DEFSYM (Qwrite_region, "write-region"); 5877 DEFSYM (Qwrite_region, "write-region");
5865 DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime"); 5878 DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime");
5866 DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime"); 5879 DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime");
@@ -6085,6 +6098,7 @@ This includes interactive calls to `delete-file' and
6085 defsubr (&Sdefault_file_modes); 6098 defsubr (&Sdefault_file_modes);
6086 defsubr (&Sfile_newer_than_file_p); 6099 defsubr (&Sfile_newer_than_file_p);
6087 defsubr (&Sinsert_file_contents); 6100 defsubr (&Sinsert_file_contents);
6101 defsubr (&Schoose_write_coding_system);
6088 defsubr (&Swrite_region); 6102 defsubr (&Swrite_region);
6089 defsubr (&Scar_less_than_car); 6103 defsubr (&Scar_less_than_car);
6090 defsubr (&Sverify_visited_file_modtime); 6104 defsubr (&Sverify_visited_file_modtime);