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: Sun, 12 Dec 2021 22:33:50 +0100 Message-ID: <93d63756-f75d-c53e-de02-2e8270d07311@daniel-mendler.de> References: <83v8ztmu75.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="14493"; 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 Sun Dec 12 22:34:32 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 1mwWUJ-0003W5-EA for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 22:34:31 +0100 Original-Received: from localhost ([::1]:57454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwWUH-0007Fy-22 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 16:34:29 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwWTr-0007EC-19 for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 16:34:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41787) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwWTq-0001OH-PB for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 16:34:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mwWTq-0004Cb-N1 for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 16:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Dec 2021 21:34: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.163934484116130 (code B ref 52459); Sun, 12 Dec 2021 21:34:02 +0000 Original-Received: (at 52459) by debbugs.gnu.org; 12 Dec 2021 21:34:01 +0000 Original-Received: from localhost ([127.0.0.1]:53331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwWTo-0004C6-VZ for submit@debbugs.gnu.org; Sun, 12 Dec 2021 16:34:01 -0500 Original-Received: from server.qxqx.de ([178.63.65.180]:39875 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwWTm-0004Br-U6 for 52459@debbugs.gnu.org; Sun, 12 Dec 2021 16:33:59 -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:References:Cc:To:From: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=0KEpT7tUzCVlRXiYeoWbj1R+BV18jM7OruL5v+YmOdo=; b=FNyElso4FNxxWINerZHdB0L3hu gEPXRtYNCFH3W5T0AEn5Bd0nCbQ6JNPsEhbuh9SHBOXLcQLDKEXgn3q6pBb7DfSvjIFtFsz8G9GKO DBfLwxRIsNScF8JcZkdLcJeBLe8nTSnPaYImfT78jEVbDuCGmuNro4p0kmajWalti/WQ=; In-Reply-To: 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:222273 Archived-At: On 12/12/21 10:11 PM, Daniel Mendler wrote: > Example packages which are affected by this issue are for example the > Helpful package, which provides an enhanced Help buffer. Another package > affected by the issue is the Marginalia package which adds annotations > to `describe-variable` in the minibuffer. The annotations show the > variable value. I would like to print the variable values in a safe way > which does not mess up the display. Instead of "string" these packages > show "str"gnandallthatfollowsisgarbage. How is this supposed to be done? > > I propose the addition of an additional variable which configures > prin1-string such that all control characters which affect the display > in special ways are escaped. Is there an alternative approach to achieve > this goal? There is actually one function which comes close in functionality - `bidi-string-mark-left-to-right`. However this function is not really a pure string manipulation function since it adds display properties. So this function can only be used if the string is directly displayed as is. The function is not a good fit if the resulting string is manipulated further, truncated, etc.