From unknown Sun Jun 22 04:33:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21536: Texi, Unicode and Emacs interface Resent-From: Alex Kost Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 23 Sep 2015 10:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21536 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 21536@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.144300551228083 (code B ref -1); Wed, 23 Sep 2015 10:52:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Sep 2015 10:51:52 +0000 Received: from localhost ([127.0.0.1]:42370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZeheS-0007It-8h for submit@debbugs.gnu.org; Wed, 23 Sep 2015 06:51:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56995) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZeheQ-0007Il-0n for submit@debbugs.gnu.org; Wed, 23 Sep 2015 06:51:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeheM-0005VP-GS for submit@debbugs.gnu.org; Wed, 23 Sep 2015 06:51:47 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeheM-0005TX-Di for submit@debbugs.gnu.org; Wed, 23 Sep 2015 06:51:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeheI-000774-T7 for bug-guix@gnu.org; Wed, 23 Sep 2015 06:51:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeheE-0005RE-QF for bug-guix@gnu.org; Wed, 23 Sep 2015 06:51:42 -0400 Received: from mail-la0-x22d.google.com ([2a00:1450:4010:c03::22d]:33513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeheE-0005Qa-Is for bug-guix@gnu.org; Wed, 23 Sep 2015 06:51:38 -0400 Received: by lahh2 with SMTP id h2so21146924lah.0 for ; Wed, 23 Sep 2015 03:51:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type; bh=cahd0RVW+kyXetmbR+0YiaFpzprrxL42ujQy0w990rc=; b=D9kl0CFfGph3K+/eW5zUQRHwWo0cfFSGMjv9+xWwlWlffeEzGKbZcEUQxarEUIX+xz TfHrZWi/kYHZPq2h96jzKhiGI0A+FPYgGuJ13ElRGr5URT596n6lEoDGcls4WYyVx6YE ZonaRbIJIh4nWndtIU4BgUQCErqDrs/uiWy04PTCrOAXdFn2sAwVBYjUX8v951cBPP8W T5p2wAatgEDJIIrP46Zxub5NEt+W+vek2HfR8hCcn8yLuA3DSPgVBRIG/IaLhVVwadjD k4/kGv/BVsN18hAtCe56K20ViYijm4yqFpLUbOxWxRS+XOPykdUyovscZ/PokwwxKLjW W4MQ== X-Received: by 10.112.13.161 with SMTP id i1mr11069471lbc.96.1443005497504; Wed, 23 Sep 2015 03:51:37 -0700 (PDT) Received: from leviafan ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id o195sm536049lfe.17.2015.09.23.03.51.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 03:51:36 -0700 (PDT) From: Alex Kost Date: Wed, 23 Sep 2015 13:51:36 +0300 Message-ID: <87twqlflxj.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable There is an interesting "bug" that leads to a problem with Emacs interface for Guix packages. Try "M-x guix-search-by-name RET mpfrcx". You will get an 'encoding-error'. This happens because: 1. Description of the 'mpfrcx' package contains a unicode symbol "=E2=80=93= ". 2. For some reason unicode symbols are not handled properly in REPLs connected to a guile server. To illustrate this problem, here is the recipe: 1. Run guile server: guile --listen Evaluate there: ((@@ (guix ui) texi->plain-text) "foo \u2015 bar.") So far so good. 2. Now connect to it, either with: - netcat: "netcat localhost 37146" - or Geiser: "M-x connect-to-guile" and evaluate the same expression. This time you will get the error. (This should probably be counted as a Guile bug, I'm not sure) To make the connected REPL handle such unicode strings you have to manually evaluate (setlocale LC_ALL "") there (even (setlocale LC_ALL) works!). So I used this as a workaround for the emacs interface in the attached patch (I don't know if there is a better workaround). BTW, since we now use texi for the package descriptions, does it mean that our intention is to get rid of using unicode symbols directly? =E2=80=A6Hm, I've just tried ((@@ (guix ui) texi->plain-text) "@U{2012}") a= nd got: Throw to key `parser-error' with args `(#f "Unknown command" U) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-emacs-Handle-unicode-symbols-in-texi-descriptions.patch >From 5226abeac27e5b6f79cc6e2b933f146040e2c2bd Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Wed, 23 Sep 2015 13:42:44 +0300 Subject: [PATCH] emacs: Handle unicode symbols in texi descriptions. Fixes (FIXME). * emacs/guix-backend.el (guix-start-repl-maybe): Call 'setlocale' for the internal REPL. --- emacs/guix-backend.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/emacs/guix-backend.el b/emacs/guix-backend.el index 412d648..32d449a 100644 --- a/emacs/guix-backend.el +++ b/emacs/guix-backend.el @@ -190,7 +190,11 @@ display messages." guix-default-port (buffer-name repl)))) (set repl-var repl) (and end-msg (message end-msg)) - (unless internal + (if internal + ;; Without this, the REPL will error when package + ;; descriptions contain unicode symbols. See + ;; (FIXME) for details. + (guix-geiser-eval "(setlocale LC_ALL)" repl) (run-hooks 'guix-after-start-repl-hook)))))) (defun guix-start-repl (buffer &optional address) -- 2.5.0 --=-=-=-- From unknown Sun Jun 22 04:33:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21536: Texi, Unicode and Emacs interface Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 23 Sep 2015 22:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21536 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Alex Kost Cc: 21536@debbugs.gnu.org Received: via spool by 21536-submit@debbugs.gnu.org id=B21536.144304574711544 (code B ref 21536); Wed, 23 Sep 2015 22:03:02 +0000 Received: (at 21536) by debbugs.gnu.org; 23 Sep 2015 22:02:27 +0000 Received: from localhost ([127.0.0.1]:43096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zes7O-000307-TW for submit@debbugs.gnu.org; Wed, 23 Sep 2015 18:02:27 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33252) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zes7N-000300-Ni for 21536@debbugs.gnu.org; Wed, 23 Sep 2015 18:02:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zes7I-0007M8-Jh for 21536@debbugs.gnu.org; Wed, 23 Sep 2015 18:02:25 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40887) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zes7H-0007Lp-F4; Wed, 23 Sep 2015 18:02:20 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:38302 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1Zes7G-0005iL-Qi; Wed, 23 Sep 2015 18:02:19 -0400 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87twqlflxj.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 2 =?UTF-8?Q?Vend=C3=A9miaire?= an 224 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Thu, 24 Sep 2015 00:02:16 +0200 In-Reply-To: <87twqlflxj.fsf@gmail.com> (Alex Kost's message of "Wed, 23 Sep 2015 13:51:36 +0300") Message-ID: <87oagsg5g7.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Alex Kost skribis: > Evaluate there: > > ((@@ (guix ui) texi->plain-text) "foo \u2015 bar.") > > So far so good. > > 2. Now connect to it, either with: > > - netcat: "netcat localhost 37146" > > - or Geiser: "M-x connect-to-guile" > > and evaluate the same expression. This time you will get the error. The encoding error comes from the fact that =E2=80=98texi->plain-text=E2=80= =99 uses a string port, and string ports internally use the current locale encoding or =E2=80=98%default-port-encoding=E2=80=99. Consequently, when running in the =E2=80=9CC=E2=80=9D locale, string ports = cannot represent non-ASCII code points (something widely regarded as a bug in Guile, and at the very least an annoyance.) To work around that, you can type this in *Guix Internal REPL*: (fluid-set! %default-port-encoding "UTF-8") I fixed in commit 2cad18a8 of guix-artwork.git, but perhaps a similar hack is apparently needed elsewhere. Could you test this patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/ui.scm b/guix/ui.scm index 4a3630f..67dd062 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -803,7 +803,10 @@ converted to a space; sequences of more than one line break are preserved." (define (texi->plain-text str) "Return a plain-text representation of texinfo fragment STR." - (stexi->plain-text (texi-fragment->stexi str))) + ;; 'texi-fragment->stexi' uses a string port so make sure it's a + ;; Unicode-capable one (see .) + (with-fluids ((%default-port-encoding "UTF-8")) + (stexi->plain-text (texi-fragment->stexi str)))) (define (package-description-string package) "Return a plain-text representation of PACKAGE description field." --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > BTW, since we now use texi for the package descriptions, does it mean > that our intention is to get rid of using unicode symbols directly? Not particularly. Thanks, Ludo=E2=80=99. --=-=-=-- From unknown Sun Jun 22 04:33:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21536: Texi, Unicode and Emacs interface Resent-From: Alex Kost Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 24 Sep 2015 12:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21536 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Cc: 21536@debbugs.gnu.org Received: via spool by 21536-submit@debbugs.gnu.org id=B21536.144309618028924 (code B ref 21536); Thu, 24 Sep 2015 12:03:01 +0000 Received: (at 21536) by debbugs.gnu.org; 24 Sep 2015 12:03:00 +0000 Received: from localhost ([127.0.0.1]:41483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zf5Eq-0007WS-3P for submit@debbugs.gnu.org; Thu, 24 Sep 2015 08:03:00 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:33309) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zf5Eo-0007WJ-Mq for 21536@debbugs.gnu.org; Thu, 24 Sep 2015 08:02:59 -0400 Received: by lahh2 with SMTP id h2so59677388lah.0 for <21536@debbugs.gnu.org>; Thu, 24 Sep 2015 05:02:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=dAyOAIp0MyNbBBfF8gXJHU8DA4D0sDfwzb2clSX8Yhw=; b=iIdpfAg0WQrvtpD6ZYHbUf3uT1V2EvpDeAkFGM4e+spX9zssPYIOsdFnDUizXDKyo/ mCt95hK/7xHhwQ+CQ0J/zMzIuoLr/xtK9wMESgWJoZpL+zUv2N+15AFZPDIRcVpFiQyd omOkD+L/NlWjqGXlE0OYlm9Pcv6Fg6wKwKsLaCGzHwlDj0Hvza/b0CvV4zrJhjk439c7 I7VyOoJFtljWAVSn/8227yOcObw/H2U+guj1F6653yFUQ+cvncSWIP1ekW5o/lOd5AMI wSJ1TP9AAjcc6ACXtqF/2E84Br9mzdEVv+8CV5pVlQZrf7dFG7hXECULsJjUkthZYfQ7 4w7Q== X-Received: by 10.112.52.168 with SMTP id u8mr13257260lbo.48.1443096177355; Thu, 24 Sep 2015 05:02:57 -0700 (PDT) Received: from leviafan ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id td6sm1003210lbb.37.2015.09.24.05.02.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2015 05:02:56 -0700 (PDT) From: Alex Kost References: <87twqlflxj.fsf@gmail.com> <87oagsg5g7.fsf@gnu.org> Date: Thu, 24 Sep 2015 15:02:58 +0300 In-Reply-To: <87oagsg5g7.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 24 Sep 2015 00:02:16 +0200") Message-ID: <87twqk10ul.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Ludovic Court=C3=A8s (2015-09-24 01:02 +0300) wrote: > Alex Kost skribis: > >> Evaluate there: >> >> ((@@ (guix ui) texi->plain-text) "foo \u2015 bar.") >> >> So far so good. >> >> 2. Now connect to it, either with: >> >> - netcat: "netcat localhost 37146" >> >> - or Geiser: "M-x connect-to-guile" >> >> and evaluate the same expression. This time you will get the error. > > The encoding error comes from the fact that =E2=80=98texi->plain-text=E2= =80=99 uses a > string port, and string ports internally use the current locale encoding > or =E2=80=98%default-port-encoding=E2=80=99. > > Consequently, when running in the =E2=80=9CC=E2=80=9D locale, string port= s cannot > represent non-ASCII code points (something widely regarded as a bug in > Guile, and at the very least an annoyance.) > > To work around that, you can type this in *Guix Internal REPL*: > > (fluid-set! %default-port-encoding "UTF-8") > > I fixed in commit 2cad18a8 of guix-artwork.git, but perhaps a similar > hack is apparently needed elsewhere. Ah, I didn't follow 'guix-artwork' repo, now I see. > Could you test this patch: > > > diff --git a/guix/ui.scm b/guix/ui.scm > index 4a3630f..67dd062 100644 > --- a/guix/ui.scm > +++ b/guix/ui.scm > @@ -803,7 +803,10 @@ converted to a space; sequences of more than one lin= e break are preserved." >=20=20 > (define (texi->plain-text str) > "Return a plain-text representation of texinfo fragment STR." > - (stexi->plain-text (texi-fragment->stexi str))) > + ;; 'texi-fragment->stexi' uses a string port so make sure it's a > + ;; Unicode-capable one (see .) > + (with-fluids ((%default-port-encoding "UTF-8")) > + (stexi->plain-text (texi-fragment->stexi str)))) >=20=20 > (define (package-description-string package) > "Return a plain-text representation of PACKAGE description field." Yes, I confirm that with this change the problem with Emacs interface is solved, thank you! --=20 Alex From unknown Sun Jun 22 04:33:20 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Alex Kost Subject: bug#21536: closed (Re: bug#21536: Texi, Unicode and Emacs interface) Message-ID: References: <874mijwp1k.fsf@gnu.org> <87twqlflxj.fsf@gmail.com> X-Gnu-PR-Message: they-closed 21536 X-Gnu-PR-Package: guix Reply-To: 21536@debbugs.gnu.org Date: Thu, 24 Sep 2015 20:18:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1443125882-9450-1" This is a multi-part message in MIME format... ------------=_1443125882-9450-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #21536: Texi, Unicode and Emacs interface which was filed against the guix package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 21536@debbugs.gnu.org. --=20 21536: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D21536 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1443125882-9450-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 21536-done) by debbugs.gnu.org; 24 Sep 2015 20:17:01 +0000 Received: from localhost ([127.0.0.1]:42203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZfCwu-0002Qq-Rz for submit@debbugs.gnu.org; Thu, 24 Sep 2015 16:17:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51433) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZfCwt-0002Qh-8n for 21536-done@debbugs.gnu.org; Thu, 24 Sep 2015 16:16:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfCws-0000dB-F8 for 21536-done@debbugs.gnu.org; Thu, 24 Sep 2015 16:16:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([208.118.235.10]:58003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfCws-0000d1-7f; Thu, 24 Sep 2015 16:16:58 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:41742 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ZfCwr-0004EA-Ij; Thu, 24 Sep 2015 16:16:57 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Alex Kost Subject: Re: bug#21536: Texi, Unicode and Emacs interface References: <87twqlflxj.fsf@gmail.com> <87oagsg5g7.fsf@gnu.org> <87twqk10ul.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 3 =?utf-8?Q?Vend=C3=A9miaire?= an 224 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Thu, 24 Sep 2015 22:16:55 +0200 In-Reply-To: <87twqk10ul.fsf@gmail.com> (Alex Kost's message of "Thu, 24 Sep 2015 15:02:58 +0300") Message-ID: <874mijwp1k.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.10 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 21536-done Cc: 21536-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Alex Kost skribis: > Yes, I confirm that with this change the problem with Emacs interface is > solved, thank you! Pushed as 08d7e35, thanks! Ludo=E2=80=99. ------------=_1443125882-9450-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 23 Sep 2015 10:51:52 +0000 Received: from localhost ([127.0.0.1]:42370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZeheS-0007It-8h for submit@debbugs.gnu.org; Wed, 23 Sep 2015 06:51:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56995) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZeheQ-0007Il-0n for submit@debbugs.gnu.org; Wed, 23 Sep 2015 06:51:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeheM-0005VP-GS for submit@debbugs.gnu.org; Wed, 23 Sep 2015 06:51:47 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeheM-0005TX-Di for submit@debbugs.gnu.org; Wed, 23 Sep 2015 06:51:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeheI-000774-T7 for bug-guix@gnu.org; Wed, 23 Sep 2015 06:51:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeheE-0005RE-QF for bug-guix@gnu.org; Wed, 23 Sep 2015 06:51:42 -0400 Received: from mail-la0-x22d.google.com ([2a00:1450:4010:c03::22d]:33513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeheE-0005Qa-Is for bug-guix@gnu.org; Wed, 23 Sep 2015 06:51:38 -0400 Received: by lahh2 with SMTP id h2so21146924lah.0 for ; Wed, 23 Sep 2015 03:51:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type; bh=cahd0RVW+kyXetmbR+0YiaFpzprrxL42ujQy0w990rc=; b=D9kl0CFfGph3K+/eW5zUQRHwWo0cfFSGMjv9+xWwlWlffeEzGKbZcEUQxarEUIX+xz TfHrZWi/kYHZPq2h96jzKhiGI0A+FPYgGuJ13ElRGr5URT596n6lEoDGcls4WYyVx6YE ZonaRbIJIh4nWndtIU4BgUQCErqDrs/uiWy04PTCrOAXdFn2sAwVBYjUX8v951cBPP8W T5p2wAatgEDJIIrP46Zxub5NEt+W+vek2HfR8hCcn8yLuA3DSPgVBRIG/IaLhVVwadjD k4/kGv/BVsN18hAtCe56K20ViYijm4yqFpLUbOxWxRS+XOPykdUyovscZ/PokwwxKLjW W4MQ== X-Received: by 10.112.13.161 with SMTP id i1mr11069471lbc.96.1443005497504; Wed, 23 Sep 2015 03:51:37 -0700 (PDT) Received: from leviafan ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id o195sm536049lfe.17.2015.09.23.03.51.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 03:51:36 -0700 (PDT) From: Alex Kost To: bug-guix@gnu.org Subject: Texi, Unicode and Emacs interface Date: Wed, 23 Sep 2015 13:51:36 +0300 Message-ID: <87twqlflxj.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable There is an interesting "bug" that leads to a problem with Emacs interface for Guix packages. Try "M-x guix-search-by-name RET mpfrcx". You will get an 'encoding-error'. This happens because: 1. Description of the 'mpfrcx' package contains a unicode symbol "=E2=80=93= ". 2. For some reason unicode symbols are not handled properly in REPLs connected to a guile server. To illustrate this problem, here is the recipe: 1. Run guile server: guile --listen Evaluate there: ((@@ (guix ui) texi->plain-text) "foo \u2015 bar.") So far so good. 2. Now connect to it, either with: - netcat: "netcat localhost 37146" - or Geiser: "M-x connect-to-guile" and evaluate the same expression. This time you will get the error. (This should probably be counted as a Guile bug, I'm not sure) To make the connected REPL handle such unicode strings you have to manually evaluate (setlocale LC_ALL "") there (even (setlocale LC_ALL) works!). So I used this as a workaround for the emacs interface in the attached patch (I don't know if there is a better workaround). BTW, since we now use texi for the package descriptions, does it mean that our intention is to get rid of using unicode symbols directly? =E2=80=A6Hm, I've just tried ((@@ (guix ui) texi->plain-text) "@U{2012}") a= nd got: Throw to key `parser-error' with args `(#f "Unknown command" U) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-emacs-Handle-unicode-symbols-in-texi-descriptions.patch >From 5226abeac27e5b6f79cc6e2b933f146040e2c2bd Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Wed, 23 Sep 2015 13:42:44 +0300 Subject: [PATCH] emacs: Handle unicode symbols in texi descriptions. Fixes (FIXME). * emacs/guix-backend.el (guix-start-repl-maybe): Call 'setlocale' for the internal REPL. --- emacs/guix-backend.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/emacs/guix-backend.el b/emacs/guix-backend.el index 412d648..32d449a 100644 --- a/emacs/guix-backend.el +++ b/emacs/guix-backend.el @@ -190,7 +190,11 @@ display messages." guix-default-port (buffer-name repl)))) (set repl-var repl) (and end-msg (message end-msg)) - (unless internal + (if internal + ;; Without this, the REPL will error when package + ;; descriptions contain unicode symbols. See + ;; (FIXME) for details. + (guix-geiser-eval "(setlocale LC_ALL)" repl) (run-hooks 'guix-after-start-repl-hook)))))) (defun guix-start-repl (buffer &optional address) -- 2.5.0 --=-=-=-- ------------=_1443125882-9450-1--