unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Kost <alezost@gmail.com>
To: 21536@debbugs.gnu.org
Subject: bug#21536: Texi, Unicode and Emacs interface
Date: Wed, 23 Sep 2015 13:51:36 +0300	[thread overview]
Message-ID: <87twqlflxj.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1404 bytes --]

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 "–".

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?

…Hm, I've just tried ((@@ (guix ui) texi->plain-text) "@U{2012}") and
got:

  Throw to key `parser-error' with args `(#f "Unknown command" U)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-Handle-unicode-symbols-in-texi-descriptions.patch --]
[-- Type: text/x-patch, Size: 1164 bytes --]

From 5226abeac27e5b6f79cc6e2b933f146040e2c2bd Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Wed, 23 Sep 2015 13:42:44 +0300
Subject: [PATCH] emacs: Handle unicode symbols in texi descriptions.

Fixes <http://bugs.gnu.org/XXXXX> (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
+            ;; <http://bugs.gnu.org/XXXXX> (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


             reply	other threads:[~2015-09-23 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 10:51 Alex Kost [this message]
2015-09-23 22:02 ` bug#21536: Texi, Unicode and Emacs interface Ludovic Courtès
2015-09-24 12:02   ` Alex Kost
2015-09-24 20:16     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87twqlflxj.fsf@gmail.com \
    --to=alezost@gmail.com \
    --cc=21536@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).