unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating.
@ 2016-09-19 10:01 Alan Mackenzie
  2016-09-19 16:52 ` Eli Zaretskii
  2016-09-22 18:23 ` Paul Eggert
  0 siblings, 2 replies; 10+ messages in thread
From: Alan Mackenzie @ 2016-09-19 10:01 UTC (permalink / raw)
  To: 24468

Hello, Emacs.

In Emacs 25.1, I am using the info files built for the distribution
using texinfo 5 (?or 6).  They contain lots of curly quotes.

On my Linux virtual terminal, these are all displayed with the
escape-glyph, which is irritating in the extreme.  The workaround of
customizing escape-glyph to the default face would prevent the effect of
highlighting things like \377 and ^L, which is the proper use of
escape-glyph.

The only other workaround I can think of is rebuilding the Emacs info
files with texinfo 4, but that is not a long term option.

This misuse of the escape-glyph face is hardcoded into
startup--setup-quote-display.  It shouldn't be.

So, I'm reduced to hacking the source code to get what urgently needs to
be a user option.

Please, can we have this facility, at long last, controlled by a
customisable option?

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating.
  2016-09-19 10:01 bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating Alan Mackenzie
@ 2016-09-19 16:52 ` Eli Zaretskii
  2016-09-21 15:04   ` Alan Mackenzie
  2016-09-22 18:23 ` Paul Eggert
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2016-09-19 16:52 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 24468

> Date: Mon, 19 Sep 2016 10:01:01 +0000
> From: Alan Mackenzie <acm@muc.de>
> 
> In Emacs 25.1, I am using the info files built for the distribution
> using texinfo 5 (?or 6).  They contain lots of curly quotes.
> 
> On my Linux virtual terminal, these are all displayed with the
> escape-glyph, which is irritating in the extreme.  The workaround of
> customizing escape-glyph to the default face would prevent the effect of
> highlighting things like \377 and ^L, which is the proper use of
> escape-glyph.

This is not supposed to happen.  Emacs should test at startup whether
the terminal can display these characters, and if not, replace them by
ASCII equivalents.  Please try to figure out why this doesn't work for
you (it does for me, although not on a Linux terminal).

> Please, can we have this facility, at long last, controlled by a
> customisable option?

Let's first understand why the automatic detection doesn't work.  IME,
devising a solution for a problem we don't understand is not a good
idea.

Thanks.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating.
  2016-09-19 16:52 ` Eli Zaretskii
@ 2016-09-21 15:04   ` Alan Mackenzie
  2016-09-21 16:00     ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Mackenzie @ 2016-09-21 15:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 24468

Hello, Eli.

On Mon, Sep 19, 2016 at 07:52:16PM +0300, Eli Zaretskii wrote:
> > Date: Mon, 19 Sep 2016 10:01:01 +0000
> > From: Alan Mackenzie <acm@muc.de>
> > 
> > In Emacs 25.1, I am using the info files built for the distribution
> > using texinfo 5 (?or 6).  They contain lots of curly quotes.

> > On my Linux virtual terminal, these are all displayed with the
> > escape-glyph, which is irritating in the extreme.  The workaround of
> > customizing escape-glyph to the default face would prevent the effect of
> > highlighting things like \377 and ^L, which is the proper use of
> > escape-glyph.

> This is not supposed to happen.  Emacs should test at startup whether
> the terminal can display these characters, and if not, replace them by
> ASCII equivalents.  Please try to figure out why this doesn't work for
> you (it does for me, although not on a Linux terminal).

It _is_ "working" for me.  The function startup--setup-quote-display
determines that my Linux vt can't display the four curly quote
characters.  It's half right (it can display the curly single quotes but
not the curly double quotes).

It then goes on to set up these four characters in the standard display
table, and what it sets up is the equivalent ASCII characters with hard
coded face escape-glyph.  It's this last bit I don't like.  That bit of
the code looks like this:

    (dotimes (i 4)
      (let ((char (aref "`'""" i))
            (repl (aref repls i)))
        (if repl
            (aset (or standard-display-table
                      (setq standard-display-table (make-display-table)))
                  char (vector (make-glyph-code repl 'escape-glyph)))   <=============
          (when standard-display-table
            (aset standard-display-table char nil)))))


> > Please, can we have this facility, at long last, controlled by a
> > customisable option?

> Let's first understand why the automatic detection doesn't work.  IME,
> devising a solution for a problem we don't understand is not a good
> idea.

I think there's no mystery here.  Just my original post wasn't too clear.
I would like there to be a user option to decide whether to put the face
'escape-glyph on these four characters, rather than it being hard coded
at start-up time.  (I have now commented out "'escape-glyph" in my own
copy of Emacs.)

> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating.
  2016-09-21 15:04   ` Alan Mackenzie
@ 2016-09-21 16:00     ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2016-09-21 16:00 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 24468

> Date: Wed, 21 Sep 2016 15:04:09 +0000
> Cc: 24468@debbugs.gnu.org
> From: Alan Mackenzie <acm@muc.de>
> 
> I would like there to be a user option to decide whether to put the face
> 'escape-glyph on these four characters, rather than it being hard coded
> at start-up time.  (I have now commented out "'escape-glyph" in my own
> copy of Emacs.)

IMO, just define a separate face for that, and the rest will be
history.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating.
  2016-09-19 10:01 bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating Alan Mackenzie
  2016-09-19 16:52 ` Eli Zaretskii
@ 2016-09-22 18:23 ` Paul Eggert
  2016-09-22 18:42   ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Paul Eggert @ 2016-09-22 18:23 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 24468

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

> just define a separate face for that

Something like the attached patch, say. Alan, does it work for you?

This patch calls the new face "approximate-glyph" as there are similar 
problems with characters other than quotes and we may want to fix them 
at some point. For example, currently if I read the Emacs manual by 
using M-x info on an ASCII-only terminal, the first screen contains the 
off-putting text "Copyright \u00A9 1985\u20131987, 1993\u20132016". If 
someone ever gets around to changing this to display (say) "Copyright 
(C) 1985-1987, 1993-2016" they can use the approximate-glyph face to 
display the ASCII approximations.


[-- Attachment #2: 0001-New-face-approximate-glyph.patch --]
[-- Type: application/x-patch, Size: 9020 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating.
  2016-09-22 18:23 ` Paul Eggert
@ 2016-09-22 18:42   ` Eli Zaretskii
  2016-09-22 21:10     ` Juri Linkov
  2016-09-22 21:15     ` Paul Eggert
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2016-09-22 18:42 UTC (permalink / raw)
  To: Paul Eggert; +Cc: acm, 24468

> Cc: Eli Zaretskii <eliz@gnu.org>, 24468@debbugs.gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Thu, 22 Sep 2016 11:23:24 -0700
> 
> This patch calls the new face "approximate-glyph"

How about asciify-glyph?

Thanks.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating.
  2016-09-22 18:42   ` Eli Zaretskii
@ 2016-09-22 21:10     ` Juri Linkov
  2016-09-22 21:15     ` Paul Eggert
  1 sibling, 0 replies; 10+ messages in thread
From: Juri Linkov @ 2016-09-22 21:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: acm, Paul Eggert, 24468

>> This patch calls the new face "approximate-glyph"
>
> How about asciify-glyph?

Or confusable-glyph (if this is the right Unicode term)?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating.
  2016-09-22 18:42   ` Eli Zaretskii
  2016-09-22 21:10     ` Juri Linkov
@ 2016-09-22 21:15     ` Paul Eggert
  2016-09-23  7:03       ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Paul Eggert @ 2016-09-22 21:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: acm, 24468

On 09/22/2016 11:42 AM, Eli Zaretskii wrote:
> How about asciify-glyph?

The substitute glyphs might not be ASCII in the future. For example, on 
Fedora 24 the console font 'cp1250' can display µ (U+00B5 MICRO SIGN) 
but not μ (U+03BC GREEK SMALL LETTER MU), and it would be quite 
reasonable for a future version of Emacs to display the latter as the 
former using the approximation-glyph font.

It's true that the name 'approximation-glyph' is long and hard to spell. 
Perhaps we can think of a better font name that doesn't imply ASCII. How 
about 'homo-glyph'? That is more technically accurate anyway, as this 
feature is all about homoglyphs.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating.
  2016-09-22 21:15     ` Paul Eggert
@ 2016-09-23  7:03       ` Eli Zaretskii
  2016-10-17  5:52         ` Paul Eggert
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2016-09-23  7:03 UTC (permalink / raw)
  To: Paul Eggert; +Cc: acm, 24468

> Cc: acm@muc.de, 24468@debbugs.gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Thu, 22 Sep 2016 14:15:53 -0700
> 
> It's true that the name 'approximation-glyph' is long and hard to spell. 

My problem with it is not that it's long, my problem is that it's too
general.  "Approximation" could mean anything.

> Perhaps we can think of a better font name that doesn't imply ASCII. How 
> about 'homo-glyph'? That is more technically accurate anyway, as this 
> feature is all about homoglyphs.

Fine with me, thanks.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating.
  2016-09-23  7:03       ` Eli Zaretskii
@ 2016-10-17  5:52         ` Paul Eggert
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Eggert @ 2016-10-17  5:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: acm, 24468-done

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

Eli Zaretskii wrote:
>> > How about 'homo-glyph'? That is more technically accurate anyway, as this
>> > feature is all about homoglyphs.
> Fine with me, thanks.

I installed it as 'homoglyph' via the attached patch, since when I wrote it up 
'homo-glyph' was confusing: the English word is 'homoglyph' after all.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-New-face-homoglyph.patch --]
[-- Type: text/x-diff; name="0001-New-face-homoglyph.patch", Size: 9155 bytes --]

From 26bde696c76d423ae62f191472b5002b58a66230 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 16 Oct 2016 18:48:19 -0700
Subject: [PATCH] New face homoglyph

Suggested by Eli Zaretskii, from a feature request by
Alan Mackenzie (Bug#24468).
* doc/emacs/display.texi (Standard Faces, Text Display):
* etc/NEWS: Document this.
* etc/themes/dichromacy-theme.el, etc/themes/leuven-theme.el:
* etc/themes/light-blue-theme.el, etc/themes/manoj-dark-theme.el:
* etc/themes/tango-dark-theme.el, etc/themes/tango-theme.el:
* etc/themes/wombat-theme.el:
Customize homoglyph to be the same as escape-glyph.
* lisp/cus-theme.el (custom-theme--listed-faces):
Add homoglyph.
* lisp/faces.el (homoglyph): New face.
* lisp/startup.el (startup--setup-quote-display): Use it.
---
 doc/emacs/display.texi         | 10 +++++++---
 etc/NEWS                       |  4 ++++
 etc/themes/dichromacy-theme.el |  1 +
 etc/themes/leuven-theme.el     |  1 +
 etc/themes/light-blue-theme.el |  1 +
 etc/themes/manoj-dark-theme.el |  1 +
 etc/themes/tango-dark-theme.el |  1 +
 etc/themes/tango-theme.el      |  1 +
 etc/themes/wombat-theme.el     |  1 +
 lisp/cus-theme.el              |  3 ++-
 lisp/faces.el                  |  8 ++++++++
 lisp/startup.el                |  2 +-
 12 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index 738d72d..492dfc6 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -657,6 +657,10 @@ Standard Faces
 @item escape-glyph
 The face for displaying control characters and escape sequences
 (@pxref{Text Display}).
+@item homoglyph
+The face for displaying lookalike characters, i.e., characters that
+look like but are not the characters being represented
+(@pxref{Text Display}).
 @item nobreak-space
 The face for displaying no-break space characters (@pxref{Text
 Display}).
@@ -1520,12 +1524,12 @@ Text Display
 
 @cindex curly quotes
 @cindex curved quotes
-@cindex escape-glyph face
+@cindex homoglyph face
   If the curved quotes @samp{‘}, @samp{’}, @samp{“}, and @samp{”} are
 known to look just like @acronym{ASCII} characters, they are shown
-with the @code{escape-glyph} face.  Curved quotes that cannot be
+with the @code{homoglyph} face.  Curved quotes that cannot be
 displayed are shown as their @acronym{ASCII} approximations @samp{`},
-@samp{'}, and @samp{"} with the @code{escape-glyph} face.
+@samp{'}, and @samp{"} with the @code{homoglyph} face.
 
 @node Cursor Display
 @section Displaying the Cursor
diff --git a/etc/NEWS b/etc/NEWS
index 14450a6..45d4e50 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -115,6 +115,10 @@ to control whether to suggest shorter 'M-x' commands or not.
 ** Non-breaking hyphens are now displayed with the 'nobreak-hyphen'
 face instead of the 'escape-glyph' face.
 
++++
+** Approximations to quotes are now displayed with the new 'homoglyph'
+face instead of the 'escape-glyph' face.
+
 ---
 ** 'C-x h' ('mark-whole-buffer') will now avoid marking the prompt
 part of minibuffers.
diff --git a/etc/themes/dichromacy-theme.el b/etc/themes/dichromacy-theme.el
index f8fae70..1e7c509 100644
--- a/etc/themes/dichromacy-theme.el
+++ b/etc/themes/dichromacy-theme.el
@@ -60,6 +60,7 @@ dichromacy
    ;; Escape and prompt faces
    `(minibuffer-prompt ((,class (:weight bold :foreground ,blue))))
    `(escape-glyph ((,class (:foreground ,vermillion))))
+   `(homoglyph ((,class (:foreground ,vermillion))))
    `(error ((,class (:weight bold :slant italic
 			     :foreground ,vermillion))))
    `(warning ((,class (:foreground ,orange))))
diff --git a/etc/themes/leuven-theme.el b/etc/themes/leuven-theme.el
index 75635eb..19d5561 100644
--- a/etc/themes/leuven-theme.el
+++ b/etc/themes/leuven-theme.el
@@ -119,6 +119,7 @@ leuven
    `(minibuffer-prompt ((,class (:weight bold :foreground "black" :background "gold"))))
    `(minibuffer-noticeable-prompt ((,class (:weight bold :foreground "black" :background "gold"))))
    `(escape-glyph ((,class (:foreground "#008ED1"))))
+   `(homoglyph ((,class (:foreground "#008ED1"))))
    `(error ((,class (:foreground "red"))))
    `(warning ((,class (:weight bold :foreground "orange"))))
    `(success ((,class (:foreground "green"))))
diff --git a/etc/themes/light-blue-theme.el b/etc/themes/light-blue-theme.el
index 8c80a66..a2ed71a 100644
--- a/etc/themes/light-blue-theme.el
+++ b/etc/themes/light-blue-theme.el
@@ -48,6 +48,7 @@ light-blue
    `(mode-line-inactive ((,class (:inherit mode-line :background "LightGray" :foreground "grey20" :box (:line-width -1 :color "grey75") :weight light))))
    ;; Escape and prompt faces
    `(escape-glyph ((,class (:background "gold" :foreground "blue" :box (:line-width 1 :color "blue" :style released-button)))))
+   `(homoglyph ((,class (:background "gold" :foreground "blue" :box (:line-width 1 :color "blue" :style released-button)))))
    ;; Font lock faces
    `(font-lock-builtin-face ((,class (:foreground "#b35caf"))))
    `(font-lock-constant-face ((,class (:foreground "#00006DE06DE0"))))
diff --git a/etc/themes/manoj-dark-theme.el b/etc/themes/manoj-dark-theme.el
index b512020..549d11b 100644
--- a/etc/themes/manoj-dark-theme.el
+++ b/etc/themes/manoj-dark-theme.el
@@ -482,6 +482,7 @@ manoj-dark
  '(epa-validity-medium ((t (:italic t :foreground "PaleTurquoise" :slant italic))))
 
  '(escape-glyph ((t (:foreground "cyan"))))
+ '(homoglyph ((t (:foreground "cyan"))))
 
  '(eshell-ls-archive-face ((t (:bold t :foreground "IndianRed"))))
  '(eshell-ls-backup-face ((t (:foreground "Grey"))))
diff --git a/etc/themes/tango-dark-theme.el b/etc/themes/tango-dark-theme.el
index 9ef0276..407c79b 100644
--- a/etc/themes/tango-dark-theme.el
+++ b/etc/themes/tango-dark-theme.el
@@ -78,6 +78,7 @@ tango-dark
    ;; Escape and prompt faces
    `(minibuffer-prompt ((,class (:foreground ,cham-0))))
    `(escape-glyph ((,class (:foreground ,butter-3))))
+   `(homoglyph ((,class (:foreground ,butter-3))))
    `(error ((,class (:foreground ,red-0))))
    `(warning ((,class (:foreground ,orange-1))))
    `(success ((,class (:foreground ,cham-1))))
diff --git a/etc/themes/tango-theme.el b/etc/themes/tango-theme.el
index cda546b..a2d7c84 100644
--- a/etc/themes/tango-theme.el
+++ b/etc/themes/tango-theme.el
@@ -66,6 +66,7 @@ tango
    ;; Escape and prompt faces
    `(minibuffer-prompt ((,class (:weight bold :foreground ,blue-3))))
    `(escape-glyph ((,class (:foreground ,red-3))))
+   `(homoglyph ((,class (:foreground ,red-3))))
    `(error ((,class (:foreground ,red-3))))
    `(warning ((,class (:foreground ,orange-3))))
    `(success ((,class (:foreground ,cham-3))))
diff --git a/etc/themes/wombat-theme.el b/etc/themes/wombat-theme.el
index 08ae12f..6768cce 100644
--- a/etc/themes/wombat-theme.el
+++ b/etc/themes/wombat-theme.el
@@ -46,6 +46,7 @@ wombat
    ;; Escape and prompt faces
    `(minibuffer-prompt ((,class (:foreground "#e5786d"))))
    `(escape-glyph ((,class (:foreground "#ddaa6f" :weight bold))))
+   `(homoglyph ((,class (:foreground "#ddaa6f" :weight bold))))
    ;; Font lock faces
    `(font-lock-builtin-face ((,class (:foreground "#e5786d"))))
    `(font-lock-comment-face ((,class (:foreground "#99968b"))))
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 3160e23..5a20b8e 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -61,7 +61,8 @@ custom-theme-insert-variable-marker
 (defvar custom-theme-insert-face-marker nil)
 
 (defvar custom-theme--listed-faces '(default cursor fixed-pitch
-  variable-pitch escape-glyph minibuffer-prompt highlight region
+  variable-pitch escape-glyph homoglyph
+  minibuffer-prompt highlight region
   shadow secondary-selection trailing-whitespace
   font-lock-builtin-face font-lock-comment-delimiter-face
   font-lock-comment-face font-lock-constant-face
diff --git a/lisp/faces.el b/lisp/faces.el
index 15090e1..d6ec98b 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2470,6 +2470,14 @@ escape-glyph
   :group 'basic-faces
   :version "22.1")
 
+(defface homoglyph
+  '((((background dark)) :foreground "cyan")
+    (((type pc)) :foreground "magenta")
+    (t :foreground "brown"))
+  "Face for lookalike characters."
+  :group 'basic-faces
+  :version "25.2")
+
 (defface nobreak-space
   '((((class color) (min-colors 88)) :inherit escape-glyph :underline t)
     (((class color) (min-colors 8)) :background "magenta")
diff --git a/lisp/startup.el b/lisp/startup.el
index d5225bd..4a04f9c 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -870,7 +870,7 @@ startup--setup-quote-display
         (if repl
             (aset (or standard-display-table
                       (setq standard-display-table (make-display-table)))
-                  char (vector (make-glyph-code repl 'escape-glyph)))
+                  char (vector (make-glyph-code repl 'homoglyph)))
           (when standard-display-table
             (aset standard-display-table char nil)))))))
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-10-17  5:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19 10:01 bug#24468: Emacs 25.1: Use of face escape-glyph on curly quotes is irritating Alan Mackenzie
2016-09-19 16:52 ` Eli Zaretskii
2016-09-21 15:04   ` Alan Mackenzie
2016-09-21 16:00     ` Eli Zaretskii
2016-09-22 18:23 ` Paul Eggert
2016-09-22 18:42   ` Eli Zaretskii
2016-09-22 21:10     ` Juri Linkov
2016-09-22 21:15     ` Paul Eggert
2016-09-23  7:03       ` Eli Zaretskii
2016-10-17  5:52         ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).