aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1997-07-02 02:59:01 +0000
committerRichard M. Stallman1997-07-02 02:59:01 +0000
commit1e1078d626a7cab8656bbb57eed03598fa12b047 (patch)
tree6d4a3b0dd62bd2ae7396eab351aea5e79f1330f9 /src
parent4197cc7ca49781dd30dc3b29438e79ec938cfe92 (diff)
downloademacs-1e1078d626a7cab8656bbb57eed03598fa12b047.tar.gz
emacs-1e1078d626a7cab8656bbb57eed03598fa12b047.zip
(decode_mode_spec_coding): Clean up handling of eol conversions.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index a54ad86e3ba..5b51a25475f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4023,31 +4023,48 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
4023 register char *buf; 4023 register char *buf;
4024 int eol_flag; 4024 int eol_flag;
4025{ 4025{
4026 register Lisp_Object val = coding_system; 4026 Lisp_Object val;
4027
4028 val = coding_system;
4027 4029
4028 if (NILP (val)) /* Not yet decided. */ 4030 if (NILP (val)) /* Not yet decided. */
4029 { 4031 {
4030 *buf++ = '-'; 4032 *buf++ = '-';
4031 if (eol_flag) *buf++ = eol_mnemonic_undecided; 4033 *buf++ = eol_mnemonic_undecided;
4034 /* Don't mention EOL conversion if it isn't decided. */
4032 } 4035 }
4033 else 4036 else
4034 { 4037 {
4038 Lisp_Object eolvalue;
4039
4040 eolvalue = Fget (coding_system, Qeol_type);
4041
4035 while (!NILP (val) && SYMBOLP (val)) 4042 while (!NILP (val) && SYMBOLP (val))
4036 val = Fget (val, Qcoding_system); 4043 {
4044 val = Fget (val, Qcoding_system);
4045 if (NILP (eolvalue))
4046 eolvalue = Fget (coding_system, Qeol_type);
4047 }
4048
4037 *buf++ = XFASTINT (XVECTOR (val)->contents[1]); 4049 *buf++ = XFASTINT (XVECTOR (val)->contents[1]);
4038 if (eol_flag) 4050 if (eol_flag)
4039 { 4051 {
4040 val = Fget (coding_system, Qeol_type); 4052 /* The EOL conversion we are using. */
4041 4053 int eoltype;
4042 if (NILP (val)) /* Not yet decided. */ 4054 /* The EOL conversion that is normal on this system. */
4043 *buf++ = eol_mnemonic_undecided; 4055
4044 else if (VECTORP (val)) /* Not yet decided. */ 4056 if (NILP (eolvalue)) /* Not yet decided. */
4045 *buf++ = eol_mnemonic_undecided; 4057 eoltype = eol_mnemonic_undecided;
4046 else /* INTEGERP (val) -- 1:LF, 2:CRLF, 3:CR */ 4058 else if (VECTORP (eolvalue)) /* Not yet decided. */
4047 *buf++ = (XFASTINT (val) == 1 4059 eoltype = eol_mnemonic_undecided;
4048 ? eol_mnemonic_unix 4060 else /* INTEGERP (eolvalue) -- 0:LF, 1:CRLF, 2:CR */
4049 : (XFASTINT (val) == 2 4061 eoltype = (XFASTINT (eolvalue) == 0
4050 ? eol_mnemonic_dos : eol_mnemonic_mac)); 4062 ? eol_mnemonic_unix
4063 : (XFASTINT (eolvalue) == 1
4064 ? eol_mnemonic_dos : eol_mnemonic_mac));
4065
4066 /* Mention the EOL conversion if it is not the usual one. */
4067 *buf++ = eoltype;
4051 } 4068 }
4052 } 4069 }
4053 return buf; 4070 return buf;