summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-07-02 02:59:01 +0000
committerRichard M. Stallman <rms@gnu.org>1997-07-02 02:59:01 +0000
commit2030c82f987033cc55186f73c923044ee55be5b1 (patch)
tree4219f6c6dd8b8a615d92ebd21bdaea1ccc7cc902 /src
parenta178a35bc54e919e249afaf274754cc6effed095 (diff)
downloademacs-2030c82f987033cc55186f73c923044ee55be5b1.tar.gz
(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)
register char *buf;
int eol_flag;
{
- register Lisp_Object val = coding_system;
+ Lisp_Object val;
+
+ val = coding_system;
if (NILP (val)) /* Not yet decided. */
{
*buf++ = '-';
- if (eol_flag) *buf++ = eol_mnemonic_undecided;
+ *buf++ = eol_mnemonic_undecided;
+ /* Don't mention EOL conversion if it isn't decided. */
}
else
{
+ Lisp_Object eolvalue;
+
+ eolvalue = Fget (coding_system, Qeol_type);
+
while (!NILP (val) && SYMBOLP (val))
- val = Fget (val, Qcoding_system);
+ {
+ val = Fget (val, Qcoding_system);
+ if (NILP (eolvalue))
+ eolvalue = Fget (coding_system, Qeol_type);
+ }
+
*buf++ = XFASTINT (XVECTOR (val)->contents[1]);
if (eol_flag)
{
- val = Fget (coding_system, Qeol_type);
-
- if (NILP (val)) /* Not yet decided. */
- *buf++ = eol_mnemonic_undecided;
- else if (VECTORP (val)) /* Not yet decided. */
- *buf++ = eol_mnemonic_undecided;
- else /* INTEGERP (val) -- 1:LF, 2:CRLF, 3:CR */
- *buf++ = (XFASTINT (val) == 1
- ? eol_mnemonic_unix
- : (XFASTINT (val) == 2
- ? eol_mnemonic_dos : eol_mnemonic_mac));
+ /* The EOL conversion we are using. */
+ int eoltype;
+ /* The EOL conversion that is normal on this system. */
+
+ if (NILP (eolvalue)) /* Not yet decided. */
+ eoltype = eol_mnemonic_undecided;
+ else if (VECTORP (eolvalue)) /* Not yet decided. */
+ eoltype = eol_mnemonic_undecided;
+ else /* INTEGERP (eolvalue) -- 0:LF, 1:CRLF, 2:CR */
+ eoltype = (XFASTINT (eolvalue) == 0
+ ? eol_mnemonic_unix
+ : (XFASTINT (eolvalue) == 1
+ ? eol_mnemonic_dos : eol_mnemonic_mac));
+
+ /* Mention the EOL conversion if it is not the usual one. */
+ *buf++ = eoltype;
}
}
return buf;