From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nathan Trapuzzano Newsgroups: gmane.emacs.bugs Subject: bug#15747: Patch to optionally display raw bytes in hexadecimal Date: Thu, 31 Oct 2013 21:10:56 -0400 Message-ID: <87sivhncyn.fsf@nbtrap.com> References: <87hac0uqtk.fsf@nbtrap.com> <83vc0gdnej.fsf@gnu.org> <87r4b49esd.fsf@nbtrap.com> <83eh73e7y1.fsf@gnu.org> <87y55bvyid.fsf@nbtrap.com> <83zjppct7e.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1383268336 23054 80.91.229.3 (1 Nov 2013 01:12:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Nov 2013 01:12:16 +0000 (UTC) Cc: 15747@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 01 02:12:21 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vc3Hf-0004hI-6a for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Nov 2013 02:12:19 +0100 Original-Received: from localhost ([::1]:59886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vc3He-0005QN-9q for geb-bug-gnu-emacs@m.gmane.org; Thu, 31 Oct 2013 21:12:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vc3HV-0005Q6-Uy for bug-gnu-emacs@gnu.org; Thu, 31 Oct 2013 21:12:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vc3HP-0006wz-94 for bug-gnu-emacs@gnu.org; Thu, 31 Oct 2013 21:12:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vc3HP-0006wv-4W for bug-gnu-emacs@gnu.org; Thu, 31 Oct 2013 21:12:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Vc3HO-0002QF-ED for bug-gnu-emacs@gnu.org; Thu, 31 Oct 2013 21:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nathan Trapuzzano Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Nov 2013 01:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15747 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 15747-submit@debbugs.gnu.org id=B15747.13832682709249 (code B ref 15747); Fri, 01 Nov 2013 01:12:02 +0000 Original-Received: (at 15747) by debbugs.gnu.org; 1 Nov 2013 01:11:10 +0000 Original-Received: from localhost ([127.0.0.1]:55967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vc3GW-0002P5-M7 for submit@debbugs.gnu.org; Thu, 31 Oct 2013 21:11:10 -0400 Original-Received: from outbound-ss-1429.hostmonster.com ([74.220.221.129]:55566) by debbugs.gnu.org with smtp (Exim 4.80) (envelope-from ) id 1Vc3GO-0002Oa-La for 15747@debbugs.gnu.org; Thu, 31 Oct 2013 21:11:07 -0400 Original-Received: (qmail 14418 invoked by uid 0); 1 Nov 2013 01:10:58 -0000 Original-Received: from unknown (HELO host393.hostmonster.com) (66.147.240.193) by oproxy19-pub.mail.unifiedlayer.com with SMTP; 1 Nov 2013 01:10:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbtrap.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=wqyylZ5o/mH+aw199cICa4lvtLqSNFPaPyzFsGjQNWI=; b=ubXOHG2rBkhn5unLjgBqyoEUfP3FY3DuP0CsJKrXIwGe2LCoqRbdEcahbxvDvoGFQQpg9rCQGTly+6IUGF0xwzdIUgQUNocHxom0rLJMnbMYZzDKEBJUZlFpStmuWQxX; Original-Received: from [50.90.253.209] (port=39263 helo=Nathan-GNU) by host393.hostmonster.com with esmtpsa (TLSv1:CAMELLIA128-SHA:128) (Exim 4.80) (envelope-from ) id 1Vc3GM-0008BJ-20; Thu, 31 Oct 2013 19:10:58 -0600 In-Reply-To: <83zjppct7e.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 31 Oct 2013 18:15:33 +0200") User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) X-Identified-User: {1585:host393.hostmonster.com:nbtrapco:nbtrap.com} {sentby:smtp auth 50.90.253.209 authed with nbtrap@nbtrap.com} X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:79841 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > Probably. > >> Also, what do you guys think of making it buffer-local? > > Definitely, IMO. Patch attached. I ended up naming the variable `raw-byte-display-radix'. --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=raw-byte-display-radix.patch Content-Transfer-Encoding: quoted-printable >From 96cbab813bdde2b2aa7ee54bdcd191506e5e9186 Mon Sep 17 00:00:00 2001 From: Nathan Trapuzzano Date: Thu, 25 Jul 2013 15:47:23 -0400 Subject: [PATCH] Define and implement `raw-byte-display-radix' variable. This buffer-local variable allows raw bytes to be displayed with hexadecimal and decimal escape sequences as opposed to traditional octal escapes. --- doc/emacs/ChangeLog | 4 ++++ doc/emacs/display.texi | 5 +++++ doc/lispref/ChangeLog | 4 ++++ doc/lispref/display.texi | 37 +++++++++++++++++++++++++------------ doc/lispref/text.texi | 11 ++++++----- lisp/ChangeLog | 4 ++++ lisp/cus-start.el | 1 + src/ChangeLog | 13 +++++++++++++ src/buffer.c | 7 +++++++ src/buffer.h | 3 +++ src/character.h | 24 ++++++++++++++++++------ src/dispextern.h | 4 ++++ src/indent.c | 18 +++++++++++------- src/xdisp.c | 14 +++++++++++++- 14 files changed, 118 insertions(+), 31 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index eafe608..d418eec 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2013-10-31 Nathan Trapuzzano + + * display.texi (Text Display): Document `raw-byte-display-radix'. + 2013-10-23 Glenn Morris =20 * files.texi, glossary.texi, killing.texi, search.texi, sending.texi: diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 80dffe2..74fe801 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1400,6 +1400,7 @@ character, @code{U+0001}, is displayed as @samp{^A}. =20 @cindex octal escapes @vindex ctl-arrow +@vindex raw-byte-display-radix The raw bytes with codes @code{U+0080} (octal 200) through @code{U+009F} (octal 237) are displayed as @dfn{octal escape sequences}, with the @code{escape-glyph} face. For instance, @@ -1407,6 +1408,10 @@ character code @code{U+0098} (octal 230) is displaye= d as @samp{\230}. If you change the buffer-local variable @code{ctl-arrow} to @code{nil}, the @acronym{ASCII} control characters are also displayed as octal escape sequences instead of caret escape sequences. +Moreover, setting the buffer-local variable +@code{raw-byte-display-radix} to 16 or 10 causes Emacs to display +hexadecimal or decimal escape sequences, respectively, rather than +octal sequences. =20 @vindex nobreak-char-display @cindex non-breaking space diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index a685f1f..5238ce3 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,7 @@ +2013-10-31 Nathan Trapuzzano + + * display.texi (Usual Display): Document `raw-byte-display-radix'. + 2013-10-30 Xue Fuqiao =20 * display.texi (Abstract Display): Improve indexing. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 07ab2c6..20318f6 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -5900,7 +5900,7 @@ instead of @samp{^}); e.g., the @key{DEL} character i= s displayed as @samp{^?}. =20 If @code{ctl-arrow} is @code{nil}, these characters are displayed as -octal escapes (see below). +octal escapes (but see below). =20 This rule also applies to carriage return (character code 13), if that character appears in the buffer. But carriage returns usually do not @@ -5910,11 +5910,14 @@ conversion (@pxref{Coding System Basics}). @cindex octal escapes @item @dfn{Raw bytes} are non-@acronym{ASCII} characters with codes 128 -through 255 (@pxref{Text Representations}). These characters display -as @dfn{octal escapes}: sequences of four glyphs, where the first -glyph is the @acronym{ASCII} code for @samp{\}, and the others are -digit characters representing the character code in octal. (A display -table can specify a glyph to use instead of @samp{\}.) +through 255 (@pxref{Text Representations}). By default, these +characters display as @dfn{octal escapes}: sequences of four glyphs, +where the first glyph is the @acronym{ASCII} code for @samp{\}, and +the others are digit characters representing the character code in +octal. (A display table can specify a glyph to use instead of +@samp{\}.) To display these bytes as hexadecimal or decimal escape +sequences rather than octal, set @code{raw-byte-display-radix} to 16 +or 10, respectively. =20 @item Each non-@acronym{ASCII} character with code above 255 is displayed @@ -5932,11 +5935,11 @@ table, for any character whose entry in the active = display table is specify the characters for which you want special behavior. =20 The following variables affect how certain characters are displayed -on the screen. Since they change the number of columns the characters -occupy, they also affect the indentation functions. They also affect -how the mode line is displayed; if you want to force redisplay of the -mode line using the new values, call the function -@code{force-mode-line-update} (@pxref{Mode Line Format}). +on the screen. Some of these change the number of columns the +characters occupy, which affects the indentation functions. These +also affect the display of characters in the mode line; if you want to +force redisplay of the mode line using the new values, call the +function @code{force-mode-line-update} (@pxref{Mode Line Format}). =20 @defopt ctl-arrow @cindex control characters in display @@ -5944,7 +5947,7 @@ This buffer-local variable controls how control chara= cters are displayed. If it is non-@code{nil}, they are displayed as a caret followed by the character: @samp{^A}. If it is @code{nil}, they are displayed as octal escapes: a backslash followed by three octal -digits, as in @samp{\001}. +digits, as in @samp{\001} (but see below). @end defopt =20 @defopt tab-width @@ -5955,6 +5958,16 @@ is completely independent of the user-settable tab s= tops used by the command @code{tab-to-tab-stop}. @xref{Indent Tabs}. @end defopt =20 +@defopt raw-byte-display-radix +Setting this buffer-local variable to 16 or 10 will cause raw bytes to +be displayed as hexadecimal or decimal escape sequences, respectively, +rather than octal. The sequences will be prepended with @samp{\} (or +whatever glyph the current display table specifies for this purpose), +followed by @samp{x} for hexadecimal or @samp{d} for decimal. All +other values cause raw bytes to be displayed with the default octal +escapes. +@end defopt + @node Display Tables @subsection Display Tables =20 diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index aa19338..06788be 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -2110,11 +2110,12 @@ characters from the beginning of the buffer) and a = column position (counting screen characters from the beginning of a line). =20 These functions count each character according to the number of -columns it occupies on the screen. This means control characters count -as occupying 2 or 4 columns, depending upon the value of -@code{ctl-arrow}, and tabs count as occupying a number of columns that -depends on the value of @code{tab-width} and on the column where the tab -begins. @xref{Usual Display}. +columns it occupies on the screen. This means control characters +count as occupying 2, 4, or 5 columns, depending upon the values of +@code{ctl-arrow} and @code{raw-byte-display-radix}, and tabs count as +occupying a number of columns that depends on the value of +@code{tab-width} and on the column where the tab begins. @xref{Usual +Display}. =20 Column number computations ignore the width of the window and the amount of horizontal scrolling. Consequently, a column value can be diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 58fd55b..a05b7d5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-10-31 Nathan Trapuzzano + + * cus-start.el: Add customization support for `raw-byte-display-radix'. + 2013-10-31 Glenn Morris =20 * Makefile.in (custom-deps, finder-data): No need to setq the target diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 24f8ac3..3711db2 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -139,6 +139,7 @@ Leaving \"Default\" unchecked is equivalent with specif= ying a default of (const :tag "Right to Left" right-to-left) (const :tag "Dynamic, according to paragraph text" nil)) "24.1") + (raw-byte-display-radix display (choice (const 8) (const 10) (const = 16))) ;; callint.c (mark-even-if-inactive editing-basics boolean) ;; callproc.c diff --git a/src/ChangeLog b/src/ChangeLog index fa468c9..09c9de0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2013-10-31 Nathan Trapuzzano + + Define and implement buffer-local `raw_byte_display_radix' for + displaying raw bytes with hexadecimal and decimal escape + sequences. + * buffer.c (init_buffer_once): + * buffer.h (struct buffer): + * character.h (RAW_BYTE_ESCAPE_WIDTH, ASCII_CHAR_WIDTH, CHAR_WIDTH): + * dispextern.h (struct it): Add `raw_byte_display_format' member. + * indent.c (current_column, scan_for_column, string_display_width) + (compute_motion): + * xdisp.c (init_iterator, get_next_display_element): + 2013-10-31 Jan Dj=C3=A4rv =20 * emacs.c (main): Skip -psn args on OSX even if ! isatty (0). diff --git a/src/buffer.c b/src/buffer.c index e44908a..0b1e1a5 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5175,6 +5175,7 @@ init_buffer_once (void) bset_truncate_lines (&buffer_defaults, Qnil); bset_word_wrap (&buffer_defaults, Qnil); bset_ctl_arrow (&buffer_defaults, Qt); + XSETFASTINT (BVAR (&buffer_defaults, raw_byte_display_radix), 8); bset_bidi_display_reordering (&buffer_defaults, Qt); bset_bidi_paragraph_direction (&buffer_defaults, Qnil); bset_cursor_type (&buffer_defaults, Qt); @@ -5244,6 +5245,7 @@ init_buffer_once (void) XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, raw_byte_display_radix), idx); += +idx; XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx; @@ -5716,6 +5718,11 @@ A value of nil means use backslash and octal digits. This variable does not apply to characters whose display is specified in the current display table (if there is one). */); =20 + DEFVAR_PER_BUFFER ("raw-byte-display-radix", &BVAR (current_buffer, raw_= byte_display_radix), + Qintegerp, + doc: /* Radix for displaying raw byte escape sequences. +Legitimate values are 8, 10, and 16. Any other value has the same effect = as 8. */); + DEFVAR_PER_BUFFER ("enable-multibyte-characters", &BVAR (current_buffer, enable_multibyte_characters), Qnil, diff --git a/src/buffer.h b/src/buffer.h index a36c0d1..51fce4d 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -584,6 +584,9 @@ struct buffer /* Non-nil means display ctl chars with uparrow. */ Lisp_Object INTERNAL_FIELD (ctl_arrow); =20 + /* Radix to use for displaying raw byte escape sequences. */ + Lisp_Object INTERNAL_FIELD (raw_byte_display_radix); + /* Non-nil means reorder bidirectional text for display in the visual order. */ Lisp_Object INTERNAL_FIELD (bidi_display_reordering); diff --git a/src/character.h b/src/character.h index d1b781c..5e011b1 100644 --- a/src/character.h +++ b/src/character.h @@ -561,6 +561,12 @@ sanitize_tab_width (EMACS_INT width) return 0 < width && width <=3D 1000 ? width : 8; } =20 +/* Return the display width of a raw byte escape sequence, including + '\', in buffer BUF. */ + +#define RAW_BYTE_ESCAPE_WIDTH(buf) \ + ((XFASTINT (BVAR ((buf), raw_byte_display_radix))) =3D=3D 10 ? 5 : 4) + /* Return the width of ASCII character C. The width is measured by how many columns C will occupy on the screen when displayed in the current buffer. */ @@ -569,10 +575,14 @@ sanitize_tab_width (EMACS_INT width) (c < 0x20 \ ? (c =3D=3D '\t' \ ? SANE_TAB_WIDTH (current_buffer) \ - : (c =3D=3D '\n' ? 0 : (NILP (BVAR (current_buffer, ctl_arrow)) ? 4 = : 2))) \ + : (c =3D=3D '\n' ? 0 : (NILP (BVAR (current_buffer, ctl_arrow)) \ + ? RAW_BYTE_ESCAPE_WIDTH (current_buffer) \ + : 2))) \ : (c < 0x7f \ ? 1 \ - : ((NILP (BVAR (current_buffer, ctl_arrow)) ? 4 : 2)))) + : ((NILP (BVAR (current_buffer, ctl_arrow)) \ + ? RAW_BYTE_ESCAPE_WIDTH (current_buffer) \ + : 2)))) =20 /* Return a non-outlandish value for a character width. */ =20 @@ -586,10 +596,12 @@ sanitize_char_width (EMACS_INT width) columns C will occupy on the screen when displayed in the current buffer. */ =20 -#define CHAR_WIDTH(c) \ - (ASCII_CHAR_P (c) \ - ? ASCII_CHAR_WIDTH (c) \ - : sanitize_char_width (XINT (CHAR_TABLE_REF (Vchar_width_table, c)))) +#define CHAR_WIDTH(c) \ + (ASCII_CHAR_P (c) \ + ? ASCII_CHAR_WIDTH (c) \ + : CHAR_BYTE8_P (c) \ + ? RAW_BYTE_ESCAPE_WIDTH (current_buffer) \ + : sanitize_char_width (XINT (CHAR_TABLE_REF (Vchar_width_table, c))= )) =20 /* If C is a variation selector, return the index of the variation selector (1..256). Otherwise, return 0. */ diff --git a/src/dispextern.h b/src/dispextern.h index dd64ae1..a147ea8 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2391,6 +2391,10 @@ struct it where the `^' can be replaced by a display table entry. */ unsigned ctl_arrow_p : 1; =20 + /* Format string for displaying raw bytes. Determined by + raw_byte_display_radix. */ + const char *raw_byte_display_format; + /* Non-zero means that the current face has a box. */ unsigned face_box_p : 1; =20 diff --git a/src/indent.c b/src/indent.c index d956e62..bf5d5eb 100644 --- a/src/indent.c +++ b/src/indent.c @@ -98,9 +98,9 @@ character_width (int c, struct Lisp_Char_Table *dp) =20 /* Everybody else (control characters, metacharacters) has other widths. We could return their actual widths here, but they - depend on things like ctl_arrow and crud like that, and they're - not very common at all. So we'll just claim we don't know their - widths. */ + depend on things like ctl_arrow, raw_byte_display_radix, and crud + like that, and they're not very common at all. So we'll just + claim we don't know their widths. */ else return 0; } @@ -319,6 +319,7 @@ current_column (void) int c; int tab_width =3D SANE_TAB_WIDTH (current_buffer); bool ctl_arrow =3D !NILP (BVAR (current_buffer, ctl_arrow)); + int raw_byte_escape_width =3D RAW_BYTE_ESCAPE_WIDTH (current_buffer); struct Lisp_Char_Table *dp =3D buffer_display_table (); =20 if (PT =3D=3D last_known_column_point @@ -422,7 +423,7 @@ current_column (void) also takes one column. */ ++col; else - col +=3D (ctl_arrow && c < 0200) ? 2 : 4; + col +=3D (ctl_arrow && c < 0200) ? 2 : raw_byte_escape_width; } } =20 @@ -500,6 +501,7 @@ scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol,= ptrdiff_t *prevcol) { int tab_width =3D SANE_TAB_WIDTH (current_buffer); bool ctl_arrow =3D !NILP (BVAR (current_buffer, ctl_arrow)); + int raw_byte_escape_width =3D RAW_BYTE_ESCAPE_WIDTH (current_buffer); struct Lisp_Char_Table *dp =3D buffer_display_table (); bool multibyte =3D !NILP (BVAR (current_buffer, enable_multibyte_charact= ers)); struct composition_it cmp_it; @@ -657,7 +659,7 @@ scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol,= ptrdiff_t *prevcol) else if (ctl_arrow && (c < 040 || c =3D=3D 0177)) col +=3D 2; else if (c < 040 || c >=3D 0177) - col +=3D 4; + col +=3D raw_byte_escape_width; else col++; } @@ -711,6 +713,7 @@ string_display_width (Lisp_Object string, Lisp_Object b= eg, Lisp_Object end) int c; int tab_width =3D SANE_TAB_WIDTH (current_buffer); bool ctl_arrow =3D !NILP (current_buffer->ctl_arrow); + int raw_byte_escape_width =3D RAW_BYTE_ESCAPE_WIDTH (current_buffer); struct Lisp_Char_Table *dp =3D buffer_display_table (); int b, e; =20 @@ -760,7 +763,7 @@ string_display_width (Lisp_Object string, Lisp_Object b= eg, Lisp_Object end) tab_seen =3D 1; } else - col +=3D (ctl_arrow && c < 0200) ? 2 : 4; + col +=3D (ctl_arrow && c < 0200) ? 2 : raw_byte_escape_width; } =20 if (tab_seen) @@ -1092,6 +1095,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, E= MACS_INT fromvpos, int c =3D 0; int tab_width =3D SANE_TAB_WIDTH (current_buffer); bool ctl_arrow =3D !NILP (BVAR (current_buffer, ctl_arrow)); + int raw_byte_escape_width =3D RAW_BYTE_ESCAPE_WIDTH (current_buffer); struct Lisp_Char_Table *dp =3D window_display_table (win); EMACS_INT selective =3D (INTEGERP (BVAR (current_buffer, selective_display)) @@ -1631,7 +1635,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, E= MACS_INT fromvpos, else if (VECTORP (charvec)) ++hpos; else - hpos +=3D (ctl_arrow && c < 0200) ? 2 : 4; + hpos +=3D (ctl_arrow && c < 0200) ? 2 : raw_byte_escape_width; } } } diff --git a/src/xdisp.c b/src/xdisp.c index 5cd2c2b..ab0d998 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2714,6 +2714,18 @@ init_iterator (struct it *it, struct window *w, /* Are control characters displayed as `^C'? */ it->ctl_arrow_p =3D !NILP (BVAR (current_buffer, ctl_arrow)); =20 + switch (XFASTINT (BVAR (current_buffer, raw_byte_display_radix))) + { + case 10: + it->raw_byte_display_format =3D "d%03d"; + break; + case 16: + it->raw_byte_display_format =3D "x%02X"; + break; + default: + it->raw_byte_display_format =3D "%03o"; + } + /* -1 means everything between a CR and the following line end is invisible. >0 means lines indented more than this value are invisible. */ @@ -6863,7 +6875,7 @@ get_next_display_element (struct it *it) if (CHAR_BYTE8_P (c)) /* Display \200 instead of \17777600. */ c =3D CHAR_TO_BYTE8 (c); - len =3D sprintf (str, "%03o", c); + len =3D sprintf (str, it->raw_byte_display_format, c); =20 XSETINT (it->ctl_chars[0], escape_glyph); for (i =3D 0; i < len; i++) --=20 1.8.4.2 --=-=-=--