From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#52459: 28.0.90; prin1-to-string does not escape bidi control characters despite print-escape-control-characters=t Date: Mon, 13 Dec 2021 21:38:30 +0200 Message-ID: <83pmq0l2h5.fsf@gnu.org> References: <83v8ztmu75.fsf@gnu.org> <93d63756-f75d-c53e-de02-2e8270d07311@daniel-mendler.de> <83r1agn184.fsf@gnu.org> <0eabc668-ecb2-8f77-17cf-f9cb6dcf0626@daniel-mendler.de> <0504d4a8-1a4b-a451-d7d3-fea1c116b96d@daniel-mendler.de> <8335mwmssm.fsf@gnu.org> <7027aad4-d156-12ae-7356-4d55be5716b1@daniel-mendler.de> <83wnk8l9ha.fsf@gnu.org> <2511c498-1e36-07b2-b9b8-5849902cd416@daniel-mendler.de> <83tufcl5qd.fsf@gnu.org> <4ac4a4ce-2bb4-4120-d52d-665a029cab4e@daniel-mendler.de> <83sfuwl4mf.fsf@gnu.org> <83r1agl3um.fsf@gnu.org> <0491af1e-b57d-c5bd-c17d-b9bc1ef34929@daniel-mendler.de> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13717"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 52459@debbugs.gnu.org To: Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 13 20:40:38 2021 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 1mwrBe-0003IN-8q for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 13 Dec 2021 20:40:38 +0100 Original-Received: from localhost ([::1]:33434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwrBd-0005Mp-9m for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 13 Dec 2021 14:40:37 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:39838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwrA6-0004P4-Dp for bug-gnu-emacs@gnu.org; Mon, 13 Dec 2021 14:39:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwrA6-00009X-5Y for bug-gnu-emacs@gnu.org; Mon, 13 Dec 2021 14:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mwrA6-0002yl-3Y for bug-gnu-emacs@gnu.org; Mon, 13 Dec 2021 14:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Dec 2021 19:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52459 X-GNU-PR-Package: emacs Original-Received: via spool by 52459-submit@debbugs.gnu.org id=B52459.163942432611430 (code B ref 52459); Mon, 13 Dec 2021 19:39:02 +0000 Original-Received: (at 52459) by debbugs.gnu.org; 13 Dec 2021 19:38:46 +0000 Original-Received: from localhost ([127.0.0.1]:56882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwr9p-0002yH-VO for submit@debbugs.gnu.org; Mon, 13 Dec 2021 14:38:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwr9m-0002y0-3O for 52459@debbugs.gnu.org; Mon, 13 Dec 2021 14:38:45 -0500 Original-Received: from [2001:470:142:3::e] (port=42160 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwr9g-0008W4-Bs; Mon, 13 Dec 2021 14:38:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=N0AaKjVARnJ54nWMjZ7CD+xi++DHuUmMcs4+UrZII8U=; b=oOH4a1+PXZYZ IkVg5rvIDNul5OGtbOusHujvfexfG+GHA/vEliRRffV9xLd20TqAD23uW3v/d+vFyyLIaJsRaSEjS SH6b19KjsA/STfGad8DKnUMxfgKS9ycsb0tw22jtdlAdudht/+42JJLa6R+vOnwrqeFjDEyxK0Ota XXfNZ9dRQcVV0CKB5arGGJOQrqs+uNz0Q84oOiD5nNWcRD0TzXp8aykgiFrSe2JKz03zBpi+6v385 exFfqAhbkwyxjJiJmSLyDPL52tjeSmm2ILGMpUmR9/nT3s04MZs+FhGJc3yaqkClE8zKAu69mSpdH xyM3K7RGApFUOR6O/0NCSg==; Original-Received: from [87.69.77.57] (port=3776 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwr9g-0002bq-6V; Mon, 13 Dec 2021 14:38:36 -0500 In-Reply-To: <0491af1e-b57d-c5bd-c17d-b9bc1ef34929@daniel-mendler.de> (message from Daniel Mendler on Mon, 13 Dec 2021 20:16:54 +0100) 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:222344 Archived-At: > Cc: 52459@debbugs.gnu.org > From: Daniel Mendler > Date: Mon, 13 Dec 2021 20:16:54 +0100 > > > That will solve only a small fraction of situations where these > > characters are displayed, because the vast majority of them don't use > > prin1 to produce a string to display. Most of the stuff displayed by > > Emacs doesn't come from strings produced by prin1, it comes from > > displaying the text of some buffer. > > Yes, it solves a small fraction of situations. This issue does not > address a generic setting, it only addresses the behavior of `prin1`. As > I described at length there are packages which are affected by this and > which could improve from an improvement of `prin1`. > > To break it down once more: > > 1. We have the function `prin1-to-string` which can be used to produce a > string representation for an Emacs lisp value. > > 2. The behavior of the function can be adjusted via configuration > variables, in particular `print-escape-multibyte` and > `print-escape-control-characters`. `print-escape-multibyte` is very > aggressive, it escapes every multibyte character. > `print-escape-control-characters` only escapes ASCII control characters. > > 3. I am asking for a way to configure `prin1-to-string` such that it > escapes control and other glyphless characters but not all multibyte > characters, such that text still stays somewhat readable. I want less > aggressive escaping than `print-escape-multibyte`. If I set only > `print-escape-control-characters=t` is not sufficient since it escapes > only ASCII control characters. And, to reiterate once more, I'm against partial solutions that affect only some functions that produce strings, and don't affect at all any text displayed from a buffer. It would be a broken solution, because we will never be able to explain why 'prin1' produces escapes whereas 'format' and 'message' don't. It is unreasonable to require Lisp programs which will want to use something like that to use only 'prin1' and not the other functions routinely used for producing text for display.