X-Loop: help-debbugs@HIDDEN Subject: bug#52459: 28.0.90; prin1-to-string does not escape bidi control characters despite print-escape-control-characters=t Resent-From: Daniel Mendler <mail@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 12 Dec 2021 20:14:01 +0000 Resent-Message-ID: <handler.52459.B.16393400018507 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 52459 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 52459 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.16393400018507 (code B ref -1); Sun, 12 Dec 2021 20:14:01 +0000 Received: (at submit) by debbugs.gnu.org; 12 Dec 2021 20:13:21 +0000 Received: from localhost ([127.0.0.1]:53226 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mwVDl-0002D8-1h for submit <at> debbugs.gnu.org; Sun, 12 Dec 2021 15:13:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:38928) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mail@HIDDEN>) id 1mwVDk-0002D1-0C for submit <at> debbugs.gnu.org; Sun, 12 Dec 2021 15:13:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <mail@HIDDEN>) id 1mwVDj-0004tx-CR for bug-gnu-emacs@HIDDEN; Sun, 12 Dec 2021 15:13:19 -0500 Received: from [2a01:4f8:121:346::180] (port=59689 helo=mail.qxqx.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <mail@HIDDEN>) id 1mwVDg-0007wO-Nz for bug-gnu-emacs@HIDDEN; Sun, 12 Dec 2021 15:13:19 -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:MIME-Version:Date: Message-ID:Subject:From:To:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=2SPhhSXO1S0JOZk5SveOCAFDOuiTWXPm/wfjkdaPAjg=; b=ZafLf0mzuE6DgGaeYfNa66CmlC 7Ow2ohIQLF5ahY7MpWTNDnsmMRVpV8yc/mMep+cwDjjFJlGvIt9ujn8XWDaYsz4dYTiFy9QtKBFFY zOwHPw4sYAgwE0dqOE6jsXS8unIJTsUwjJrsI8uE1FdTFzoeIapDs6VIVVCE/IjnWsaE=; From: Daniel Mendler <mail@HIDDEN> Message-ID: <c2b57e39-75a0-b6aa-f0b4-45fd9ec07789@HIDDEN> Date: Sun, 12 Dec 2021 21:13:12 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:4f8:121:346::180 (failed) Received-SPF: pass client-ip=2a01:4f8:121:346::180; envelope-from=mail@HIDDEN; helo=mail.qxqx.de X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.4 (--) 1. Start emacs -Q 2. Enter the following in the scratch buffer: (let ((print-escape-control-characters t)) (prin1-to-string bidi-directional-controls-chars)) 3. Evaluate. The bidi control characters are not escaped despite print-escape-control-characters=t. The bidi characters should probably be treated as control characters since they have the Bidi_Control property according to the Unicode standard. If it is undesirable to treat bidi control characters like other control characters it may make sense to introduce another print configuration variable, print-escape-all-control-characters or print-escape-bidi-control-characters? In GNU Emacs 28.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2021-12-05 built on projects Repository revision: 34f56561372d83b71dcaff1cdf5d9264ba38fa0e Repository branch: emacs-28 Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 System Description: Debian GNU/Linux 10 (buster) Configured using: 'configure --prefix=/home/user/emacs/install --with-cairo' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map text-property-search time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils thingatpt help-fns radix-tree help-mode cl-loaddefs cl-lib two-column iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 57250 10751) (symbols 48 6852 1) (strings 32 21147 1607) (string-bytes 1 651816) (vectors 16 13342) (vector-slots 8 183349 13347) (floats 8 22 48) (intervals 56 260 1) (buffers 992 13))
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Daniel Mendler <mail@HIDDEN> Subject: bug#52459: Acknowledgement (28.0.90; prin1-to-string does not escape bidi control characters despite print-escape-control-characters=t) Message-ID: <handler.52459.B.16393400018507.ack <at> debbugs.gnu.org> References: <c2b57e39-75a0-b6aa-f0b4-45fd9ec07789@HIDDEN> X-Gnu-PR-Message: ack 52459 X-Gnu-PR-Package: emacs Reply-To: 52459 <at> debbugs.gnu.org Date: Sun, 12 Dec 2021 20:14:01 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 52459 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 52459: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D52459 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#52459: 28.0.90; prin1-to-string does not escape bidi control characters despite print-escape-control-characters=t Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 12 Dec 2021 20:43:02 +0000 Resent-Message-ID: <handler.52459.B52459.163934174211278 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 52459 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Daniel Mendler <mail@HIDDEN> Cc: 52459 <at> debbugs.gnu.org Received: via spool by 52459-submit <at> debbugs.gnu.org id=B52459.163934174211278 (code B ref 52459); Sun, 12 Dec 2021 20:43:02 +0000 Received: (at 52459) by debbugs.gnu.org; 12 Dec 2021 20:42:22 +0000 Received: from localhost ([127.0.0.1]:53278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mwVfp-0002vq-P5 for submit <at> debbugs.gnu.org; Sun, 12 Dec 2021 15:42:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48152) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1mwVfn-0002vc-II for 52459 <at> debbugs.gnu.org; Sun, 12 Dec 2021 15:42:19 -0500 Received: from [2001:470:142:3::e] (port=39626 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 <eliz@HIDDEN>) id 1mwVfh-0006I9-7C; Sun, 12 Dec 2021 15:42:13 -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=2uGuzVBShhJdin1cMzh25aFFqqXBSdb342zpqBM7qVE=; b=Xg0YOtyzPU05 Y6u+yfE8wXiyAnbE9D4i1iW8IgxcrDz0hrJY443IhbRVziulvqI3wiTeIZtXSzCN/PMjBy3cpFUTM u46eT7XxBe75MK1wo7+Xzsh558NS66xtbnUppgGC0Hrcwvw93mmL00Mivu89O0hGtWZFrb/l98mRV bMVbW8do4vjDm6rbmo5G4jQO7kIr0oasjsuulZ5r/I+/J2oBfDFLjtYZ6LzgacHO7SOMb403LzFZi 3mW2zyJYwUAO/FEeFmd81bW81lhmNZxmAxxdKaolxJvpjxMXxk1Et9Qzig6e/DWPOaHzwjtk2BHeQ Pke39C8VGnAScVo5dAqfog==; Received: from [87.69.77.57] (port=2781 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1mwVfh-0002MV-1U; Sun, 12 Dec 2021 15:42:13 -0500 Date: Sun, 12 Dec 2021 22:42:06 +0200 Message-Id: <83v8ztmu75.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <c2b57e39-75a0-b6aa-f0b4-45fd9ec07789@HIDDEN> (message from Daniel Mendler on Sun, 12 Dec 2021 21:13:12 +0100) References: <c2b57e39-75a0-b6aa-f0b4-45fd9ec07789@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Daniel Mendler <mail@HIDDEN> > Date: Sun, 12 Dec 2021 21:13:12 +0100 > > 1. Start emacs -Q > 2. Enter the following in the scratch buffer: > (let ((print-escape-control-characters t)) > (prin1-to-string bidi-directional-controls-chars)) > 3. Evaluate. The bidi control characters are not escaped despite > print-escape-control-characters=t. > > The bidi characters should probably be treated as control characters > since they have the Bidi_Control property according to the Unicode > standard. print-escape-control-characters is about ASCII control characters, not about Unicode fomatting controls. > If it is undesirable to treat bidi control characters like other control > characters it may make sense to introduce another print configuration > variable, print-escape-all-control-characters or > print-escape-bidi-control-characters? I don't think it's desirable. Those formatting controls have starkly different roles that ASCII control characters, and we already have features to make them stand out on display. Moreover, escape sequences are not well-defined for codepoints beyond a single byte. So I don't think we should do anything here, and we should close the bug.
X-Loop: help-debbugs@HIDDEN Subject: bug#52459: 28.0.90; prin1-to-string does not escape bidi control characters despite print-escape-control-characters=t Resent-From: Daniel Mendler <mail@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 12 Dec 2021 21:12:02 +0000 Resent-Message-ID: <handler.52459.B52459.163934350813974 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 52459 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii <eliz@HIDDEN> Cc: 52459 <at> debbugs.gnu.org Received: via spool by 52459-submit <at> debbugs.gnu.org id=B52459.163934350813974 (code B ref 52459); Sun, 12 Dec 2021 21:12:02 +0000 Received: (at 52459) by debbugs.gnu.org; 12 Dec 2021 21:11:48 +0000 Received: from localhost ([127.0.0.1]:53294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mwW8J-0003dK-P4 for submit <at> debbugs.gnu.org; Sun, 12 Dec 2021 16:11:48 -0500 Received: from server.qxqx.de ([178.63.65.180]:43175 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mail@HIDDEN>) id 1mwW8H-0003d7-Vp for 52459 <at> debbugs.gnu.org; Sun, 12 Dec 2021 16:11:46 -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=BOX5z7YzQx7oD4XLHd0DPSFAGWFLF0pQZ5hsLwA9Hpk=; b=mrjFsNQxKo19qA84IfjRhlYdDD ZkWQc2zy6VE8GqLzhv/kdjFRGGHLFLrTekFjblJ8/kChzOWg5nkHxfra3i6wDpAlmFXCTa6jeCYqZ FhpCSEvDipIXu48IoPQVJnDNqzT+2453FzD66ceFA02QWbV4RH8wXm5neXrt1frqLfLU=; References: <c2b57e39-75a0-b6aa-f0b4-45fd9ec07789@HIDDEN> <83v8ztmu75.fsf@HIDDEN> From: Daniel Mendler <mail@HIDDEN> Message-ID: <a83299cb-02cf-5ee3-ecf8-a97b65b9fac8@HIDDEN> Date: Sun, 12 Dec 2021 22:11:38 +0100 MIME-Version: 1.0 In-Reply-To: <83v8ztmu75.fsf@HIDDEN> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) >> 1. Start emacs -Q >> 2. Enter the following in the scratch buffer: >> (let ((print-escape-control-characters t)) >> (prin1-to-string bidi-directional-controls-chars)) >> 3. Evaluate. The bidi control characters are not escaped despite >> print-escape-control-characters=t. >> >> The bidi characters should probably be treated as control characters >> since they have the Bidi_Control property according to the Unicode >> standard. > > print-escape-control-characters is about ASCII control characters, not > about Unicode fomatting controls. I see, but this is not a satisfactory answer. >> If it is undesirable to treat bidi control characters like other control >> characters it may make sense to introduce another print configuration >> variable, print-escape-all-control-characters or >> print-escape-bidi-control-characters? > > I don't think it's desirable. Those formatting controls have starkly > different roles that ASCII control characters, and we already have > features to make them stand out on display. Moreover, escape > sequences are not well-defined for codepoints beyond a single byte. > > So I don't think we should do anything here, and we should close the > bug. I disagree. I would like to turn this report into a feature request then. I've observed that multiple packages which escape strings and print them for debugging or help purposes have difficulties with bidi characters. All I would like to have is a way to print strings safely, such that control characters (any kind of control characters, ascii or unicode) do not affect the output. 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?
X-Loop: help-debbugs@HIDDEN Subject: bug#52459: 28.0.90; prin1-to-string does not escape bidi control characters despite print-escape-control-characters=t Resent-From: Daniel Mendler <mail@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 12 Dec 2021 21:34:02 +0000 Resent-Message-ID: <handler.52459.B52459.163934484116130 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 52459 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii <eliz@HIDDEN> Cc: 52459 <at> debbugs.gnu.org Received: via spool by 52459-submit <at> debbugs.gnu.org id=B52459.163934484116130 (code B ref 52459); Sun, 12 Dec 2021 21:34:02 +0000 Received: (at 52459) by debbugs.gnu.org; 12 Dec 2021 21:34:01 +0000 Received: from localhost ([127.0.0.1]:53331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mwWTo-0004C6-VZ for submit <at> debbugs.gnu.org; Sun, 12 Dec 2021 16:34:01 -0500 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 <mail@HIDDEN>) id 1mwWTm-0004Br-U6 for 52459 <at> 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=; From: Daniel Mendler <mail@HIDDEN> References: <c2b57e39-75a0-b6aa-f0b4-45fd9ec07789@HIDDEN> <83v8ztmu75.fsf@HIDDEN> <a83299cb-02cf-5ee3-ecf8-a97b65b9fac8@HIDDEN> Message-ID: <93d63756-f75d-c53e-de02-2e8270d07311@HIDDEN> Date: Sun, 12 Dec 2021 22:33:50 +0100 MIME-Version: 1.0 In-Reply-To: <a83299cb-02cf-5ee3-ecf8-a97b65b9fac8@HIDDEN> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) 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.
X-Loop: help-debbugs@HIDDEN Subject: bug#52459: 28.0.90; prin1-to-string does not escape bidi control characters despite print-escape-control-characters=t Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Mon, 13 Dec 2021 12:23:01 +0000 Resent-Message-ID: <handler.52459.B52459.163939817324482 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 52459 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Daniel Mendler <mail@HIDDEN> Cc: 52459 <at> debbugs.gnu.org Received: via spool by 52459-submit <at> debbugs.gnu.org id=B52459.163939817324482 (code B ref 52459); Mon, 13 Dec 2021 12:23:01 +0000 Received: (at 52459) by debbugs.gnu.org; 13 Dec 2021 12:22:53 +0000 Received: from localhost ([127.0.0.1]:54299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mwkM1-0006Mo-3T for submit <at> debbugs.gnu.org; Mon, 13 Dec 2021 07:22:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1mwkLz-0006MX-1m for 52459 <at> debbugs.gnu.org; Mon, 13 Dec 2021 07:22:51 -0500 Received: from [2001:470:142:3::e] (port=56882 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 <eliz@HIDDEN>) id 1mwkLq-0001ne-TJ; Mon, 13 Dec 2021 07:22:43 -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=rVk9aNPYuOW5Sqel+ac/8TFVGQLXOb5XsVhBgRHlRto=; b=q0sMaJ4zfr34 Y/bIa7hCDoEWSSKyRiWenmIopNxNy4mHgDCPF0vP19JmjLnZHsZqEVTLstk1S1TxzfJ0EQ1xYybzS doQZhli90aEVAr213mKikRNnAT6MqTEYinAF/aX4pKynAPbJL4sUCXiiHeeI2htr/iqODzdaax+Ib JoSpl2D+iyEFsZ4tb5aL1WMPFRjqFUdOXIQuGdo6M04psIzIRHy7kmZh3Q8gEUQ1iko1uP8xyNrcO Wje5BCR3EYSsUiMC4UCUevzgLN4gfBpX+GvoGkfIqoTT8sS0EV9TFngAeicHtjLFzPXx3Ntlx5k2g lYzbkpeTlQSEBNDv0GPRLA==; Received: from [87.69.77.57] (port=4405 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1mwkLo-0006zD-NX; Mon, 13 Dec 2021 07:22:41 -0500 Date: Mon, 13 Dec 2021 14:22:35 +0200 Message-Id: <83r1agn184.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <93d63756-f75d-c53e-de02-2e8270d07311@HIDDEN> (message from Daniel Mendler on Sun, 12 Dec 2021 22:33:50 +0100) References: <c2b57e39-75a0-b6aa-f0b4-45fd9ec07789@HIDDEN> <83v8ztmu75.fsf@HIDDEN> <a83299cb-02cf-5ee3-ecf8-a97b65b9fac8@HIDDEN> <93d63756-f75d-c53e-de02-2e8270d07311@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Daniel Mendler <mail@HIDDEN> > Cc: 52459 <at> debbugs.gnu.org > Date: Sun, 12 Dec 2021 22:33:50 +0100 > > 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. Sorry, I don't understand. The examples you provided are of text being displayed. Which is expected, since these controls have no other effect _except_ when the text is displayed. So why isn't the existing function bidi-string-mark-left-to-right (which was introduced precisely for the situations like you describe, and is actually used in Emacs for those purposes) the solution for the class of problems that you described? And can we agree that displaying these characters as escapes would not solve the problems you had in mind, so it is off the table for the rest of this discussion?
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.