all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#21536: Texi, Unicode and Emacs interface
@ 2015-09-23 10:51 Alex Kost
  2015-09-23 22:02 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Kost @ 2015-09-23 10:51 UTC (permalink / raw)
  To: 21536

[-- 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-24 20:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-23 10:51 bug#21536: Texi, Unicode and Emacs interface Alex Kost
2015-09-23 22:02 ` Ludovic Courtès
2015-09-24 12:02   ` Alex Kost
2015-09-24 20:16     ` Ludovic Courtès

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.