Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!sics.se!sics.se!jw From: jw@sics.se (Johan Widen) Newsgroups: comp.emacs Subject: Re: Character display (8-bit character fix) Message-ID: Date: 28 Dec 89 18:44:33 GMT References: <7230@pt.cs.cmu.edu> Sender: news@sics.se Distribution: gnu Organization: Swedish Institute of Computer Science, Kista Lines: 198 In-Reply-To: cline@PROOF.ERGO.CS.CMU.EDU's message of 6 Dec 89 19:19:17 GMT >>>>> In article <7230@pt.cs.cmu.edu>, cline@PROOF.ERGO.CS.CMU.EDU (Kenneth Cline) writes: cline> Incorporating the diffs for buffer.c, indent.c and xdisp.c below will cline> cause emacs to display 255 character fonts (newline is special) in cline> buffers with local variable ctl-arrow set to any value other than T or cline> NIL. cline> This change will be obsolete when version 19 is released, but it is cline> nonetheless useful for the time being. It has been pointed out that cline> answering questions about the availability of version 19 takes time cline> away from writing the code, so please be patient. There seems to be a problem with the patch: it lets control characters get through. The following complete patch will display 8-bit characters as themselves but will display control characters according to the ^C convention. *** /tmp/,RCSt1a05022 Thu Dec 28 19:33:09 1989 --- buffer.c Thu Dec 7 21:00:44 1989 *************** *** 1297,1305 **** Automatically becomes local when set in any fashion."); DEFVAR_PER_BUFFER ("ctl-arrow", &bf_cur->ctl_arrow, ! "*Non-nil means display control chars with uparrow.\n\ Nil means use backslash and octal digits.\n\ ! Automatically becomes local when set in any fashion."); DEFVAR_PER_BUFFER ("truncate-lines", &bf_cur->truncate_lines, "*Non-nil means do not display continuation lines;\n\ --- 1297,1308 ---- Automatically becomes local when set in any fashion."); DEFVAR_PER_BUFFER ("ctl-arrow", &bf_cur->ctl_arrow, ! "*t means display control chars with uparrow.\n\ Nil means use backslash and octal digits.\n\ ! Otherwise assume that control and meta chars are printable.\n\ ! Automatically becomes local when set in any fashion.\n\ ! \n\ ! This is an Ergo local feature."); DEFVAR_PER_BUFFER ("truncate-lines", &bf_cur->truncate_lines, "*Non-nil means do not display continuation lines;\n\ *** /tmp/,RCSt1a05027 Thu Dec 28 19:33:34 1989 --- indent.c Wed Dec 27 10:56:26 1989 *************** *** 67,73 **** register int tab_seen; register int post_tab; register int tab_width = XINT (bf_cur->tab_width); ! int ctl_arrow = !NULL (bf_cur->ctl_arrow); if (point == last_known_column_point && bf_modified == last_known_column_modified) --- 67,74 ---- register int tab_seen; register int post_tab; register int tab_width = XINT (bf_cur->tab_width); ! int ctl_arrow = (!NULL (bf_cur->ctl_arrow)) ! + (EQ (bf_cur->ctl_arrow, Qt)); if (point == last_known_column_point && bf_modified == last_known_column_modified) *************** *** 109,115 **** tab_seen = 1; } else ! col += (ctl_arrow && c < 0200) ? 2 : 4; } if (tab_seen) --- 110,117 ---- tab_seen = 1; } else ! col += (ctl_arrow == 1 && c >= 0177) ? 1 : ! (ctl_arrow && c < 0200) ? 2 : 4; } if (tab_seen) *************** *** 231,237 **** register int goal; register int end = NumCharacters; register int tab_width = XINT (bf_cur->tab_width); ! register int ctl_arrow = !NULL (bf_cur->ctl_arrow); Lisp_Object val; --- 233,240 ---- register int goal; register int end = NumCharacters; register int tab_width = XINT (bf_cur->tab_width); ! register int ctl_arrow = (!NULL (bf_cur->ctl_arrow)) ! + (EQ (bf_cur->ctl_arrow, Qt)); Lisp_Object val; *************** *** 258,263 **** --- 261,268 ---- col += tab_width - 1; col = col / tab_width * tab_width; } + else if (ctl_arrow == 1 && c >= 040) + continue; else if (ctl_arrow && (c < 040 || c == 0177)) col++; else if (c < 040 || c >= 0177) *************** *** 306,312 **** register int pos; register int c; register int tab_width = XFASTINT (bf_cur->tab_width); ! register int ctl_arrow = !NULL (bf_cur->ctl_arrow); int selective = XTYPE (bf_cur->selective_display) == Lisp_Int ? XINT (bf_cur->selective_display) --- 311,318 ---- register int pos; register int c; register int tab_width = XFASTINT (bf_cur->tab_width); ! register int ctl_arrow = (!NULL (bf_cur->ctl_arrow)) ! + (EQ (bf_cur->ctl_arrow, Qt)); int selective = XTYPE (bf_cur->selective_display) == Lisp_Int ? XINT (bf_cur->selective_display) *************** *** 370,376 **** } } else ! cpos += (ctl_arrow && c < 0200) ? 2 : 4; if (HPOS (cpos) >= width && (HPOS (cpos) > width --- 376,382 ---- } } else ! cpos += (ctl_arrow == 1 && c >= 040 ) ? 1 : (ctl_arrow && c < 0200) ? 2 : 4; if (HPOS (cpos) >= width && (HPOS (cpos) > width *** /tmp/,RCSt1a05032 Thu Dec 28 19:33:45 1989 --- xdisp.c Wed Dec 27 10:56:23 1989 *************** *** 1203,1209 **** register char *p1prev; register struct display_line *line; int tab_width = XINT (bf_cur->tab_width); ! int ctl_arrow = !NULL (bf_cur->ctl_arrow); int width = XFASTINT (w->width) - 1 - (XFASTINT (w->width) + XFASTINT (w->left) != screen_width); struct position val; --- 1203,1210 ---- register char *p1prev; register struct display_line *line; int tab_width = XINT (bf_cur->tab_width); ! int ctl_arrow = (!NULL (bf_cur->ctl_arrow)) ! + (EQ (bf_cur->ctl_arrow, Qt)); int width = XFASTINT (w->width) - 1 - (XFASTINT (w->width) + XFASTINT (w->left) != screen_width); struct position val; *************** *** 1319,1324 **** --- 1320,1331 ---- } break; } + else if (ctl_arrow == 1 && c >= 040) + { + if (p1 >= startp) + *p1 = c; + p1++; + } else if (c < 0200 && ctl_arrow) { if (p1 >= startp) *************** *** 1917,1922 **** --- 1924,1935 ---- p1++; } while ((p1 - start + hscroll - (hscroll > 0)) % tab_width); + } + else if (buffer_defaults.ctl_arrow == 1 && c >= 040) + { + if (p1 >= start) + *p1 = c; + p1++; } else if (c < 0200 && buffer_defaults.ctl_arrow) { -- Johan Widen SICS, PO Box 1263, S-164 28 KISTA, SWEDEN Internet: jw@sics.se Tel: +46 8 752 15 32 Ttx: 812 61 54 SICS S Fax: +46 8 751 72 30