unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Character literals for Unicode (control) characters
@ 2016-03-03  5:47 Lars Ingebrigtsen
  2016-03-03  6:20 ` John Wiegley
                   ` (2 more replies)
  0 siblings, 3 replies; 47+ messages in thread
From: Lars Ingebrigtsen @ 2016-03-03  5:47 UTC (permalink / raw)
  To: emacs-devel

I was implementing support for the <bdo> HTML tag the other day.  (It's
for overriding bidi directionality in text.)  This is what I ended up
with:

(defun shr-tag-bdo (dom)
  (let* ((direction (dom-attr dom 'dir))
         (char (cond
                ((equal direction "ltr")
                 #x202d)                ; LRO
                ((equal direction "rtl")
                 #x202e))))             ; RLO
    (when char
      (insert char))
    (shr-generic dom)
    (when char
      (insert #x202c))))                ; PDF

And it just struck me that it would be kinda nice if Emacs had a literal
character syntax for these things.  I mean, we have such a syntax for
some "problematic" ASCII characters already: We recommend writing ?\s
instead of ? , and we recommend writing ?\n instead of ?
, because that's just very confusing.

And then I thought -- well, if we should have a literal syntax for
Unicode control characters, why not for all of them?  We do have the
mapping already in Emacs, so it wouldn't be very difficult to
implement...

So. Three options:

1) Add a new syntax, perhaps something like ?\ucRIGHT-TO-LEFT-OVERRIDE
for the Unicode control characters we care about.

2) Add a syntax for all Unicode characters, like ?\ucPILE-OF-POO.  We
can just write ?💩, so this isn't totally necessary, but perhaps it's
nice?

c) Do nothing, and continue writing code like the code above.  Or start
using the Unicode control characters directly in the code,
but ‮there lies madness‬.  (Note Unicode control characters around the
last part of the previous sentence.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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

end of thread, other threads:[~2016-04-25 17:48 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-03  5:47 Character literals for Unicode (control) characters Lars Ingebrigtsen
2016-03-03  6:20 ` John Wiegley
2016-03-03  6:25   ` Lars Ingebrigtsen
2016-03-03  6:34 ` Drew Adams
2016-03-03 16:11 ` Paul Eggert
2016-03-03 20:48   ` Eli Zaretskii
2016-03-03 23:58     ` Paul Eggert
2016-03-05 15:28   ` Philipp Stephani
2016-03-05 15:39     ` Marcin Borkowski
2016-03-05 16:51       ` Philipp Stephani
2016-03-06  2:27     ` John Wiegley
2016-03-06 15:24       ` Philipp Stephani
2016-03-06 15:54         ` Eli Zaretskii
2016-03-06 17:35           ` Philipp Stephani
2016-03-06 18:08             ` Paul Eggert
2016-03-06 18:28               ` Philipp Stephani
2016-03-06 19:03                 ` Paul Eggert
2016-03-06 19:16                   ` Philipp Stephani
2016-03-06 20:05                     ` Eli Zaretskii
2016-03-13 20:31                       ` Philipp Stephani
2016-03-14 20:03                         ` Paul Eggert
2016-03-14 20:30                           ` Eli Zaretskii
2016-03-15 11:09                             ` Nikolai Weibull
2016-03-15 17:10                               ` Eli Zaretskii
2016-03-16  8:16                                 ` Nikolai Weibull
2016-03-14 21:27                           ` Clément Pit--Claudel
2016-03-14 21:48                             ` Paul Eggert
2016-03-19 16:27                           ` Philipp Stephani
2016-03-20 12:58                             ` Paul Eggert
2016-03-20 13:25                               ` Philipp Stephani
2016-03-25 17:41                                 ` Philipp Stephani
2016-04-22  2:39                                   ` Paul Eggert
2016-04-22  7:57                                     ` Eli Zaretskii
2016-04-22  8:01                                       ` Eli Zaretskii
2016-04-22  9:39                                         ` Elias Mårtenson
2016-04-22 10:01                                           ` Eli Zaretskii
2016-04-25 17:48                                             ` Paul Eggert
2016-03-05 16:35   ` Clément Pit--Claudel
2016-03-05 17:12     ` Paul Eggert
2016-03-05 17:53       ` Clément Pit--Claudel
2016-03-05 18:16         ` Eli Zaretskii
2016-03-05 18:34           ` Clément Pit--Claudel
2016-03-05 18:56             ` Eli Zaretskii
2016-03-05 19:08               ` Drew Adams
2016-03-05 22:52                 ` Clément Pit--Claudel
2016-03-06 15:49           ` Joost Kremers
2016-03-06 16:55             ` Drew Adams

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).