From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler 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 20:16:54 +0100 Message-ID: <0491af1e-b57d-c5bd-c17d-b9bc1ef34929@daniel-mendler.de> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4017"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 52459@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 13 20:18:51 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 1mwqqZ-0000rA-Im for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 13 Dec 2021 20:18:51 +0100 Original-Received: from localhost ([::1]:51850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwqqX-0006dy-6C for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 13 Dec 2021 14:18:49 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:34498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwqpm-0006ch-2k for bug-gnu-emacs@gnu.org; Mon, 13 Dec 2021 14:18:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45300) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwqpl-0005X8-Qb for bug-gnu-emacs@gnu.org; Mon, 13 Dec 2021 14:18:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mwqpl-0002Sh-Jy for bug-gnu-emacs@gnu.org; Mon, 13 Dec 2021 14:18:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Dec 2021 19:18:01 +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.16394230259400 (code B ref 52459); Mon, 13 Dec 2021 19:18:01 +0000 Original-Received: (at 52459) by debbugs.gnu.org; 13 Dec 2021 19:17:05 +0000 Original-Received: from localhost ([127.0.0.1]:56846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwqor-0002RX-AO for submit@debbugs.gnu.org; Mon, 13 Dec 2021 14:17:05 -0500 Original-Received: from server.qxqx.de ([178.63.65.180]:50167 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwqop-0002Qz-A1 for 52459@debbugs.gnu.org; Mon, 13 Dec 2021 14:17:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wqOrr0Y0MsiyO7W9aF2rQeeQIqhptZJAakL1qHG3zwI=; b=HD1L4AwIeF2rpTyUiXXIkpezX3 Yz/95sJJREwlVF/5YdXCP4A1NjxBxeEYWP1flXsvgl0b59qYOMPv4dv+IB+syMOx9ZJJUbMGwq2nI qnVRM568PS1bdWWMx7/m61Au1vOcWlSzR2EBIdcZZNFb2N1huE6EIkpzL3tIXIoRWUdk=; In-Reply-To: <83r1agl3um.fsf@gnu.org> Content-Language: en-US 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:222340 Archived-At: On 12/13/21 8:08 PM, Eli Zaretskii wrote: >> Cc: 52459@debbugs.gnu.org >> From: Daniel Mendler >> Date: Mon, 13 Dec 2021 19:57:54 +0100 >> >>> Once again: prin1 will not help with displaying these characters. >>> Emacs doesn't use prin1 to display text. >> >> Of course not. I am using prin1 to create a string from a value which I >> can then copy to a source file or display somewhere in the UI. > > 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.