emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: non-break-space in tutorial


From: Juri Linkov
Subject: Re: non-break-space in tutorial
Date: Sun, 29 May 2005 19:08:48 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>     A better indication for non-breaking spaces and hyphens is the same
>     as for whitespace highlighting enabled with show-trailing-whitespace,
>     i.e. displaying non-breaking spaces and hyphens in a special face
>     with a non-default background color without adding \.
>
> Would you like to write a patch do this, so people can try it and see
> if they like it better?

The patch below eliminates the backslash before non-breaking spaces
and hyphens.  Without the backslash non-breaking spaces need to be
highlighted by background instead of foreground, so foreground colors
were changed to background colors with values not standing out too
much on the default background.  The same face with backgroung color
affects also displaying control characters, for good reason, since
they share the same goal of highlighting dangerous characters.

The user option `show-nonbreak-escape' can be renamed to `show-nonbreak-space'
(by analogy with `show-trailing-whitespace') or removed at all.  Users who
dislike highlighting of control characters and non-breaking space can set
the face to the void value.

Index: src/xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.1014
diff -u -r1.1014 xdisp.c
--- src/xdisp.c 27 May 2005 16:59:55 -0000      1.1014
+++ src/xdisp.c 29 May 2005 15:18:14 -0000
@@ -5165,10 +5165,9 @@
              if (it->c == 0x8a0 || it->c == 0x8ad
                  || it->c == 0xf20 || it->c == 0xf2d)
                {
-                 XSETINT (it->ctl_chars[0], escape_glyph);
                  g = it->c;
-                 XSETINT (it->ctl_chars[1], g);
-                 ctl_len = 2;
+                 XSETINT (it->ctl_chars[0], g);
+                 ctl_len = 1;
                  goto display_control;
                }
 
Index: lisp/faces.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/faces.el,v
retrieving revision 1.309
diff -u -r1.309 faces.el
--- lisp/faces.el       23 May 2005 18:30:20 -0000      1.309
+++ lisp/faces.el       29 May 2005 15:18:55 -0000
@@ -2079,11 +2079,11 @@
   :group 'whitespace           ; like `show-trailing-whitespace'
   :group 'basic-faces)
 
-(defface escape-glyph '((((background dark)) :foreground "cyan")
+(defface escape-glyph '((((background dark)) :background "rosybrown4")
                        ;; See the comment in minibuffer-prompt for
                        ;; the reason not to use blue on MS-DOS.
-                       (((type pc)) :foreground "magenta")
-                       (t :foreground "blue"))
+                       (((type pc)) :background "magenta")
+                       (t :background "rosybrown1"))
   "Face for characters displayed as ^-sequences or \-sequences."
   :group 'basic-faces)
 

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]