From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Character literals for Unicode (control) characters Date: Thu, 03 Mar 2016 05:47:56 +0000 Message-ID: <87r3fsjenn.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1456984132 21089 80.91.229.3 (3 Mar 2016 05:48:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Mar 2016 05:48:52 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 03 06:48:43 2016 Return-path: Envelope-to: ged-emacs-devel@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 1abM7u-0006sj-NW for ged-emacs-devel@m.gmane.org; Thu, 03 Mar 2016 06:48:42 +0100 Original-Received: from localhost ([::1]:60754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abM7u-0003Sa-5Q for ged-emacs-devel@m.gmane.org; Thu, 03 Mar 2016 00:48:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abM7g-0003SR-Bs for emacs-devel@gnu.org; Thu, 03 Mar 2016 00:48:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abM7c-000772-Aw for emacs-devel@gnu.org; Thu, 03 Mar 2016 00:48:28 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:50900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abM7c-00076x-4m for emacs-devel@gnu.org; Thu, 03 Mar 2016 00:48:24 -0500 Original-Received: from [31.55.6.3] (helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1abM7A-0002gn-RQ for emacs-devel@gnu.org; Thu, 03 Mar 2016 06:47:56 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1abM7A-0002gn-RQ MailScanner-NULL-Check: 1457588877.02271@KQUrE2MdJrINH90H71aZfQ X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:200880 Archived-At: I was implementing support for the 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 ?=F0=9F=92=A9, 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 =E2=80=AEthere lies madness=E2=80=AC. (Note Unicode control characters= around the last part of the previous sentence.) --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no