emacs-devel
[Top][All Lists]
Advanced

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

Re: face for non-ASCII characters


From: Ted Zlatanov
Subject: Re: face for non-ASCII characters
Date: Fri, 15 Apr 2011 17:41:46 -0500
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux)

On Tue, 23 Mar 2010 13:18:05 -0500 Ted Zlatanov <address@hidden> wrote: 

TZ> On Tue, 23 Mar 2010 17:28:01 +0100 Lennart Borgman <address@hidden> wrote: 
LB> Ok, since you found it useful I tried to finish it. See the attachment.

TZ> Stefan, Yidong, what do you think about something like markchars.el
TZ> becoming part of Emacs, so users can turn it on with a global
TZ> customization?  I don't think it has to be a minor mode necessarily but
TZ> I'm no expert in that area.

TZ> If it goes in there are several tasks: picking a variable name, picking
TZ> suitable default faces, (maybe) adding a menu item, and documenting the
TZ> new behavior.  I would really like to make it easily available to Emacs
TZ> users and will help with these tasks.

I worked on markchars.el some more (over 1 year later, heh).  The result
is attached; the commentary explains what it will do:

;;; Commentary:
;;
;; Mark special chars, by default nonascii chars, in modes where they
;; may be confused with regular chars. See `markchars-mode' and
;; `markchars-what'.  There are two modes: confusable detection (where
;; we look for mixed scripts within a word, without using the
;; http://www.unicode.org/reports/tr39/ confusable tables) and pattern
;; detection (where any regular expressions can be matched).
;;
;; The marked text will have the 'markchars property set to either
;; 'confusable or 'pattern and the face set to either
;; `markchars-face-confusable' or `markchars-face-pattern'
;; respectively.

So basically you can choose what to highlight; if you choose to
highlight confusable characters, any strings whose characters have mixed
scripts according to `char-script-table' will be highlighted.  I didn't
use the actual confusables.txt table from
http://www.unicode.org/reports/tr39/ because it's huge and probably not
very useful; the goal is to show suspicious characters and within
individual scripts it's rare to find confusable characters.

It's pretty easy to add more markchar properties and to make the
confusable detection smarter.  Let me know if you find this useful; I
will propose it for the GNU ELPA if so.

Thanks
Ted

Attachment: markchars.el
Description: application/emacs-lisp


reply via email to

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