From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Neil Roberts via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#44236: [PATCH] xdisp: Apply nobreak-char-display to all characters of blankp Date: Wed, 28 Oct 2020 12:37:27 +0100 Message-ID: <20201028113727.107967-1-bpeeluk@yahoo.co.uk> References: <83imavelpg.fsf@gnu.org> Reply-To: Neil Roberts Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15924"; mail-complaints-to="usenet@ciao.gmane.io" To: 44236@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 28 12:38:36 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXjmm-00044D-Rl for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Oct 2020 12:38:36 +0100 Original-Received: from localhost ([::1]:34486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXjmj-0000yU-NO for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Oct 2020 07:38:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXjmK-0000y4-9t for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2020 07:38:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35950) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kXjmD-00078X-Oi for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2020 07:38:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kXjmD-0002dC-Lr for bug-gnu-emacs@gnu.org; Wed, 28 Oct 2020 07:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Neil Roberts Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Oct 2020 11:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44236 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 44236-submit@debbugs.gnu.org id=B44236.160388507210095 (code B ref 44236); Wed, 28 Oct 2020 11:38:01 +0000 Original-Received: (at 44236) by debbugs.gnu.org; 28 Oct 2020 11:37:52 +0000 Original-Received: from localhost ([127.0.0.1]:47496 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXjm4-0002ck-4D for submit@debbugs.gnu.org; Wed, 28 Oct 2020 07:37:52 -0400 Original-Received: from sonic310-57.consmr.mail.ir2.yahoo.com ([77.238.177.30]:41517) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXjm0-0002cN-JA for 44236@debbugs.gnu.org; Wed, 28 Oct 2020 07:37:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1603885060; bh=gHMEfYDGKpj4k1X77w1qafK4B0amO+pV593s0NaY37c=; h=From:To:Subject:Date:In-Reply-To:References:From:Subject; b=OK2av5+lk38yZE7SP8meVn6M6ph4lT4k+S2XV2anZgZqkITPv4e7p+GPB23MFh8O42VnG/K4hd+zeiONWlSLOZ7gOhRf0CCTLqjQoFhOTK1J0WhwRJg+R4fr/nnT7817X9+dOktUbByUI85aXrnWkeUmLbMNisRqVUVQe8uvsL0ivYx5T8hPY8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7C0_zuQexiJ yh.YG0yTJY.XWYWE36EU1dEaeI9W2pK44Oa4Ek97z8UwHP2ljn7c1Fk5b85eLUcMMHYvWkOqANS_ 0Fu0xlpsjw1P5t8Ca6Fg5MF7hNSnAMWc.zlK2k6ygkRrKSDHl21gF8SYv2zWdYs7RDL5YAdW47ga w8h0Bx_mbjFFgT7yn1xhLArUnddkqYpGDLC1wtlJxGRxPe_JDa6zHAfOyn5FsJiSaDSSpdxvpfe. 8yRXxBhLh1IZvNFPhMNRISTI3eTJfxhr6hZ85wkt_Hm4rBCDiSVGil210Ja5eOhVHSnlSC5qFedg 5YnVpHRLhtRlczfvir98HAnblbbx9G9UFPI16ntExBkLV3MZa5MoUlOxWFJwZOnFUn0kz2ZTHCVI PnIc.CiUQH7oqzCVgjFn64frFpbfE18gzq3mmQJ2bS Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ir2.yahoo.com with HTTP; Wed, 28 Oct 2020 11:37:40 +0000 Original-Received: by smtp412.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 2f9d2e67bb9157b21ff27fe828710223; Wed, 28 Oct 2020 11:37:38 +0000 (UTC) X-Mailer: git-send-email 2.25.4 In-Reply-To: <83imavelpg.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:191850 Archived-At: nobreak-char-display is documented as making Emacs display all non-ASCII chars that have the same appearance as an ASCII space using a special face. In practice however, this was limited to nbsp and the hyphen characters. When using a monospace font, there are many other characters that resemble an ASCII space, such as U+202F NARROW NO-BREAK SPACE. That is like the normal non-breaking space character except that it is slightly narrower. In the French language, this character is supposed to be used before most punctuation marks such as question marks and quote characters, so it is quite prevalent. For that reason it would be nice if it was displayed differently like the regular non-breaking space. This patch makes it show all non-ASCII characters from the Unicode horizontal space class using the special face. * src/xdisp.c (get_next_display_element): Use blankp to test whether to use the nobreak_space face. --- doc/emacs/display.texi | 3 ++- etc/NEWS | 8 ++++++++ src/xdisp.c | 5 +++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git doc/emacs/display.texi doc/emacs/display.texi index 6f1bc802b8..ccc945c3af 100644 --- doc/emacs/display.texi +++ doc/emacs/display.texi @@ -1605,7 +1605,8 @@ Text Display realization, e.g., by yanking; for instance, source code compilers typically do not treat non-@acronym{ASCII} spaces as whitespace characters. To deal with this problem, Emacs displays such characters -specially: it displays @code{U+00A0} (no-break space) with the +specially: it displays @code{U+00A0} (no-break space) and other +characters from the Unicode horizontal space class with the @code{nobreak-space} face, and it displays @code{U+00AD} (soft hyphen), @code{U+2010} (hyphen), and @code{U+2011} (non-breaking hyphen) with the @code{nobreak-hyphen} face. To disable this, change diff --git etc/NEWS etc/NEWS index 7dbd3d51fa..dcf9a75723 100644 --- etc/NEWS +++ etc/NEWS @@ -163,6 +163,14 @@ your init file: (setq frame-title-format '(multiple-frames "%b" ("" invocation-name "@" system-name))) ++++ +** 'nobreak-char-display' now also affects all non-ASCII Unicode horizontal space characters. +The documented intention of this variable is to cause Emacs to display +characters that could be confused with a space character using a +different face. Previously this was limited only to NBSP and hyphen +characters. Now it covers all of the Unicode space characters, +including narrow NBSP, which has the same appearance. + * Editing Changes in Emacs 28.1 diff --git src/xdisp.c src/xdisp.c index 5a62cd6eb5..cf30ba9479 100644 --- src/xdisp.c +++ src/xdisp.c @@ -7555,7 +7555,7 @@ get_next_display_element (struct it *it) non-ASCII spaces and hyphens specially. */ if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display)) { - if (c == NO_BREAK_SPACE) + if (blankp (c)) nonascii_space_p = true; else if (c == SOFT_HYPHEN || c == HYPHEN || c == NON_BREAKING_HYPHEN) @@ -34740,7 +34740,8 @@ syms_of_xdisp (void) same appearance as an ASCII space or hyphen, using the `nobreak-space' or `nobreak-hyphen' face respectively. -U+00A0 (no-break space), U+00AD (soft hyphen), U+2010 (hyphen), and +All of the non-ASCII characters in the Unicode horizontal whitespace +character class, as well as U+00AD (soft hyphen), U+2010 (hyphen), and U+2011 (non-breaking hyphen) are affected. Any other non-nil value means to display these characters as an escape -- 2.25.4