aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-05-29 13:57:30 +0000
committerGerd Moellmann2001-05-29 13:57:30 +0000
commit7bdba03c119b57522ed4246ab1586a7c6bc3ff66 (patch)
tree02ff4f769fe7b65b4843914eecb13dd5b6fee1d9 /src
parent3d0e328b95392f983a70a940ed311a6d1fda9b8d (diff)
downloademacs-7bdba03c119b57522ed4246ab1586a7c6bc3ff66.tar.gz
emacs-7bdba03c119b57522ed4246ab1586a7c6bc3ff66.zip
(Fcall_process): Deal with decode_coding returning
CODING_FINISH_INCONSISTENT_EOL.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/callproc.c66
2 files changed, 70 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 32b377031a2..9c80466e787 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12001-05-29 Gerd Moellmann <gerd@gnu.org>
2
3 * callproc.c (Fcall_process): Deal with decode_coding returning
4 CODING_FINISH_INCONSISTENT_EOL.
5
12001-05-28 Gerd Moellmann <gerd@gnu.org> 62001-05-28 Gerd Moellmann <gerd@gnu.org>
2 7
3 * xmenu.c (xmenu_show) [!HAVE_MULTILINGUAL_MENU]: Don't overwrite 8 * xmenu.c (xmenu_show) [!HAVE_MULTILINGUAL_MENU]: Don't overwrite
diff --git a/src/callproc.c b/src/callproc.c
index 59de2393586..9101f264cce 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1,5 +1,6 @@
1/* Synchronous subprocess invocation for GNU Emacs. 1/* Synchronous subprocess invocation for GNU Emacs.
2 Copyright (C) 1985,86,87,88,93,94,95,99,2000 Free Software Foundation, Inc. 2 Copyright (C) 1985,86,87,88,93,94,95,99, 2000, 2001
3 Free Software Foundation, Inc.
3 4
4This file is part of GNU Emacs. 5This file is part of GNU Emacs.
5 6
@@ -779,10 +780,13 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
779 repeat_decoding: 780 repeat_decoding:
780 size = decoding_buffer_size (&process_coding, nread); 781 size = decoding_buffer_size (&process_coding, nread);
781 decoding_buf = (char *) xmalloc (size); 782 decoding_buf = (char *) xmalloc (size);
783
782 if (process_coding.cmp_data) 784 if (process_coding.cmp_data)
783 process_coding.cmp_data->char_offset = PT; 785 process_coding.cmp_data->char_offset = PT;
786
784 decode_coding (&process_coding, bufptr, decoding_buf, 787 decode_coding (&process_coding, bufptr, decoding_buf,
785 nread, size); 788 nread, size);
789
786 if (display_on_the_fly 790 if (display_on_the_fly
787 && saved_coding.type == coding_type_undecided 791 && saved_coding.type == coding_type_undecided
788 && process_coding.type != coding_type_undecided) 792 && process_coding.type != coding_type_undecided)
@@ -797,10 +801,70 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
797 carryover = nread; 801 carryover = nread;
798 continue; 802 continue;
799 } 803 }
804
800 if (process_coding.produced > 0) 805 if (process_coding.produced > 0)
801 insert_1_both (decoding_buf, process_coding.produced_char, 806 insert_1_both (decoding_buf, process_coding.produced_char,
802 process_coding.produced, 0, 1, 0); 807 process_coding.produced, 0, 1, 0);
803 xfree (decoding_buf); 808 xfree (decoding_buf);
809
810 if (process_coding.result == CODING_FINISH_INCONSISTENT_EOL)
811 {
812 Lisp_Object eol_type, coding;
813
814 if (process_coding.eol_type == CODING_EOL_CR)
815 {
816 /* CRs have been replaced with LFs. Undo
817 that in the text inserted above. */
818 unsigned char *p;
819
820 move_gap_both (PT, PT_BYTE);
821
822 p = BYTE_POS_ADDR (pt_byte_orig);
823 for (; p < GPT_ADDR; ++p)
824 if (*p == '\n')
825 *p = '\r';
826 }
827 else if (process_coding.eol_type == CODING_EOL_CRLF)
828 {
829 /* CR LFs have been replaced with LFs. Undo
830 that by inserting CRs in front of LFs in
831 the text inserted above. */
832 EMACS_INT bytepos, old_pt, old_pt_byte, nCR;
833
834 old_pt = PT;
835 old_pt_byte = PT_BYTE;
836 nCR = 0;
837
838 for (bytepos = PT_BYTE - 1;
839 bytepos >= pt_byte_orig;
840 --bytepos)
841 if (FETCH_BYTE (bytepos) == '\n')
842 {
843 EMACS_INT charpos = BYTE_TO_CHAR (bytepos);
844 TEMP_SET_PT_BOTH (charpos, bytepos);
845 insert_1_both ("\r", 1, 1, 0, 1, 0);
846 ++nCR;
847 }
848
849 TEMP_SET_PT_BOTH (old_pt + nCR, old_pt_byte + nCR);
850 }
851
852 /* Set the coding system symbol to that for
853 Unix-like EOL. */
854 eol_type = Fget (saved_coding.symbol, Qeol_type);
855 if (VECTORP (eol_type)
856 && ASIZE (eol_type) == 3
857 && SYMBOLP (AREF (eol_type, CODING_EOL_LF)))
858 coding = AREF (eol_type, CODING_EOL_LF);
859 else
860 coding = saved_coding.symbol;
861
862 process_coding.symbol = coding;
863 process_coding.eol_type = CODING_EOL_LF;
864 process_coding.mode
865 &= ~CODING_MODE_INHIBIT_INCONSISTENT_EOL;
866 }
867
804 nread -= process_coding.consumed; 868 nread -= process_coding.consumed;
805 carryover = nread; 869 carryover = nread;
806 if (carryover > 0) 870 if (carryover > 0)