Closed ghost closed 4 years ago
Is the REPL working for you otherwise?
Is the REPL working for you otherwise?
Yes.
I haven't spent a lot of hours in it yet.
Can you please evaluate
print("OK" * normpath(joinpath(VERSION ≤ v"0.7-" ? JULIA_HOME : Sys.BINDIR, Base.DATAROOTDIR, "julia", "base")))
and post the results for both here?
The *Warnings* buffer doesn't open in uxterm Emacs, only in GUI Emacs, replacing in julia-repl-1.2.0/julia-repl.el the ≤
for <=
the *Warnings* buffer doesn't open, and solves the issue.
GUI Emacs
M-x julia RET
pasting ≤
renders but the command fails
ERROR: syntax: missing comma or ) in argument list
Stacktrace:
[1] top-level scope at none:0
M-x julia-repl RET
pasting ≤
fails to render and the command fails with the same error
uxterm Emacs
M-x julia RET
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _' | |
| | |_| | | | |_| | | Version 1.4.2 (2020-05-23)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
┌ Warning: Terminal not fully functional
└ @ Base client.jl:374
julia> cd(expanduser("/home/eric/work/"))
julia> print("OK" * normpath(joinpath(VERSION ≤ v"0.7-" ? JULIA_HOME : Sys.BINDIR, Base.DATAROOTDIR, "julia", "base")))
OK/usr/share/julia/base
!julia> exit()
Process julia finished at Sat Jun 20 17:36:38 2020
M-x julia-repl RET
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.2 (2020-05-23)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> print("OK" * normpath(joinpath(VERSION ≤ v"0.7-" ? JULIA_HOME : Sys.BINDIR, Base.DATAROOTDIR, "julia", "base")))
OK/usr/share/julia/base
julia> exit()
Process julia finished
uxterm Julia
bash-4.3$ julia --banner=no
julia> print("OK" * normpath(joinpath(VERSION ≤ v"0.7-" ? JULIA_HOME : Sys.BINDIR, Base.DATAROOTDIR, "julia", "base")))
OK/usr/share/julia/base
julia> exit()
bash-4.3$
@willysr
Does this look like a GUI Emacs bug or MELPA packages' bugs?
Can you reproduce on Slackware-current?
This is weird, it looks like an issue related to Unicode. Do UTF8 symbols work otherwise in the REPL?
Do UTF8 symbols work otherwise in the REPL?
GUI Emacs (julia-repl)
julia> ('\u263A')
'âº': Unicode U+263A (category So: Symbol, other)
julia>
uxterm Emacs (julia-repl)
julia> ('\u263A')
'☺': Unicode U+263A (category So: Symbol, other)
julia>
This surprised me a bit. [ess-18.10.2]
GUI Emacs (R)
> setwd('/home/eric/work/')
> 4 ≤ 5
Error: unexpected numeric constant in "4 5"
> 4 <= 5
[1] TRUE
> q()
uxterm Emacs (R)
> setwd('/home/eric/work/')
> 4 ≤ 5
Error: unexpected input in "4 ≤"
> q()
uxterm R
bash-4.3$ R -q
> 4 ≤ 5
Error: unexpected input in "4 ≤"
> q()
Save workspace image? [y/n/c]: n
bash-4.3$
I am not sure this is a bug with julia-repl. Please investigate; and let me know if there is a workaround in julia-repl I can help with.
I could of course replace ≤
with <=
in the command that gets the basedir, but it is my impression that you would still have a problem with unicode chars in regular use, so this would not help you much.
problem with unicode chars in regular use
In GUI Emacs (julia) \le [TAB] returns this ≤
and \leq [TAB] doesn't return output, where the thus converted from \le [TAB] used in 4 ≤ 5
returns ERROR: syntax: extra token "5" after end of expression
.
In uxterm Emacs (julia) \le [TAB] returns this ≤
and \leq [TAB] doesn't return output, where the thus converted from \le [TAB] used in 4 ≤ 5
returns true
.
In GUI Emacs (julia-repl) \le [TAB] and \leq [TAB] returns this â¤
, and \pi [TAB] returns this Ï
.
In uxterm Emacs (julia-repl) \le [TAB] and \leq [TAB] both return this ≤
, and \pi [TAB] returns this π
, where the thus converted from \le [TAB] or \leq [TAB] used in 4 ≤ 5
returns true
..
Is M-x julia RET
ESS? I am a bit confused which output corresponds to what now.
Which OS is this? Also, bash 4.3 is rather old, which may not be directly related but something else on your system may be.
Incidentally, are you starting julia-repl after starting an ESS process? If yes, please
M-x julia-repl
and see what happens.
Is M-x julia RET ESS?
Yes, julia-mode was a dependency for ess.
ess 18.10.2 installed julia-repl 1.2.0 installed s 1.12.0 installed julia-mode 0.4 dependency
Which OS is this?
Index of /slackware/slackware-14.2/patches/source
something else
Its' not the Emacs configure arguments.
are you starting julia-repl after starting an ESS process?
No.
GUI Emacs (julia-repl)
Going into the *Scratch* buffer and typing C-h v default-process-coding-system
opens the *Help* buffer with this output.
default-process-coding-system is a variable defined in ‘C source code’.
Its value is (iso-latin-1-unix . iso-latin-1-unix)
Documentation:
Cons of coding systems used for process I/O by default.
The car part is used for decoding a process output,
the cdr part is used for encoding a text to be sent to a process.
In the *julia* buffer typing C-x RET p
and setting the coding-system to utf-8-unix fixed the issue.
That is done of course after the *Warnings* buffer appeared.
uxterm Emacs (julia-repl)
Going into the *Scratch* buffer and typing C-h v default-process-coding-system
opens the *Help* buffer with this output.
default-process-coding-system is a variable defined in ‘C source code’.
Its value is (utf-8-unix . utf-8-unix)
Documentation:
Cons of coding systems used for process I/O by default.
The car part is used for decoding a process output,
the cdr part is used for encoding a text to be sent to a process.
could of course replace ≤ with <= in the command that gets the basedir
I wonder if the bug shows elsewhere.
For Emacs GUI (julia-repl) adding this code to ~/.emacs.d/init.el works for the rendering.
(add-hook 'term-exec-hook
(function
(lambda ()
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))))
could of course replace ≤ with <= in the command that gets the basedir
Yes, let's do that for the Warning.
cf: https://github.com/tpapp/julia-repl/issues/90#issuecomment-647084474
The above added hook to ~/.emacs.d/init.el has no effect on the disparity in the GUI vs. terminal ESS (R) Error output caused by the default-process-coding-system
values, which even if in the GUI the values via C-x RET p
are modified to utf-8-unix
, the ESS R replaces numeric constant
with symbol
and not input
, and doesn't render ≤
properly in its Error message, .
> setwd('/home/eric/work/')
> 4 ≤ 5
Error: unexpected symbol in "4 �"
>
Here's the Slackware-14-2 (from patches) emacs-26.3 package creation script.
If the GUI Emacs julia-repl unicode rendering issue doesn't show up in other GNU/Linux distributions, or other OSes, then this might be added to the README.md specifically for Slackware Linux.
If Emacs is running in a GUI and you are experiencing problems with Unicode characters in the Julia REPL, place this in your Emacs initialization files (eg .emacs
):
(if (display-graphic-p)
(add-hook 'term-exec-hook
(function
(lambda ()
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix)))))
So (set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix)
fixes the issue for you?
What's the default value if you don't set it (eg eval
(process-coding-system (get-buffer-process (current-buffer)))
in a term buffer)?
So (set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix) fixes the issue for you?
Yes, in the hook added in ~/.emacs.d/init.el.
default value if you don't set it
With the hook removed from ~/.emacs.d/init.el.
GUI Emacs (julia)
(iso-latin-1-unix . iso-latin-1-unix)
uxterm Emacs (julia)
(utf-8-unix . utf-8-unix)
FWIW, here is my initialisation file after installing the MELPA packages.
bash-4.3$ cat ~/.emacs.d/init.el
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages (quote (julia-repl s ess))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
bash-4.3$
What about rewriting the conditional if
to only be implemented for julia-repl?
Should the README.md be up-to-date in promoting the use of ~/.emacs.d/init.el?
I am very happy to update the README if this is a general problem but your setup seems to be an outlier (and more importantly I would prefer to understand why first), so I am not sure it would benefit users. These days you really have to go out of your way to get something other than UTF8.
An environment variable perhaps? Do you have any of LC_xxx
or LANG
set? Also, it is strange that GUI and terminal Emacs give different settings, is it really the same Emacs, just started with -nw
?
would prefer to understand why
link removed Nov 10, 2020
But should the conditional if
only be implemented for julia-repl?
An environment variable perhaps?
I followed the recommended instructions when installing Slackware-12.2 which defaulted to en_US.
I noticed in console mode that after running export LANG=da_DK.UTF-8 that some of the Danish characters did not render properly, so with subsequent Slackware releases' installations I have never set $LANG to a unicode variant.
@willysr I don't know what Slackware-current recommends?
Incidentally, this perplexes me a bit.
uxterm Emacs (julia-repl)
shell> printenv | grep LANG
da_DK.UTF-8
shell> echo $LANG
ERROR: UndefVarError: LANG not defined
Stacktrace:
[1] top-level scope at none:0
julia>
Do you have any of LC_xxx or LANG set?
xterm
bash-4.3$ echo $LC_COLLATE && echo $LANG
C
en_US
bash-4.3$
uxterm
bash-4.3$ echo $LC_COLLATE && echo $LANG
C
da_DK.UTF-8
bash-4.3$
is it really the same Emacs, just started with -nw?
Link to emacs package creation script in https://github.com/tpapp/julia-repl/issues/90#issuecomment-647414481.
Can't enlighten you much on that one, but in uxterm & xterm (for this issue) I've been typing emacs -nw
.
bash-4.3$ ls -l /usr/bin/emacs*
lrwxrwxrwx 1 root root 14 Sep 19 2019 /usr/bin/emacs -> emacs-with-x11
-rwxr-xr-t 1 root root 9397640 Aug 29 2019 /usr/bin/emacs-26.3-no-x11
-rwxr-xr-x 1 root root 10163592 Aug 29 2019 /usr/bin/emacs-26.3-with-x11
lrwxrwxrwx 1 root root 17 Sep 19 2019 /usr/bin/emacs-no-x11 -> emacs-26.3-no-x11
lrwxrwxrwx 1 root root 19 Sep 19 2019 /usr/bin/emacs-with-x11 -> emacs-26.3-with-x11
-rwxr-xr-x 1 root root 22416 Aug 29 2019 /usr/bin/emacsclient
bash-4.3$
Sorry, i never used emacs
@willysr I meant about the install $LANG setting.
@tpapp further reading (Slackware $LANG setting) link removed Nov 10, 2020
search for 'lang.csh'
in slackware-current: export LANG=en_US.UTF-8
in slackware 14.2: export LANG=en_US
Starting the GUI Emacs from uxterm without the conditional if
in ~/.emacs.d/init.el the issue doesn't appear.
If $LANG is a non-unicode variant. For GUI Emacs export (eg LANG=en_US.UTF-8
) and start it from the command-line, for terminal use this my be insufficient, UXTerm however is known to work for the latter.
No coding patches needed, the README.md might be edited adding something like the above.
@willysr Thanks, I can't envisage any future GUI issues when the install $LANG is a unicode variant
in slackware-current: export LANG=en_US.UTF-8
in slackware 14.2: export LANG=en_US
xterm (with exported unicode LANG) GUI Emacs (julia-repl)
bash-4.3$ echo $LANG
en_US
bash-4.3$ export LANG=en_US.UTF-8
bash-4.3$
starting emacs from the command-line, switching modes C-x C-j RET
and typing M-:
Eval: (process-coding-system (get-buffer-process (current-buffer)))
returns (binary . utf-8-unix)
switching modes again C-c C-k RET
and pasting 4 ≤ 5
in the REPL renders as 4 ≤ 5
julia> 4 ≤ 5
true
julia>
xterm (with exported unicode LANG) Emacs (julia-repl)
bash-4.3$ echo $LANG
en_US
bash-4.3$ export LANG=en_US.UTF-8
bash-4.3$
starting emacs from the command-line and pasting 4 ≤ 5
in the Julia REPL renders as 4 # 5
switching modes C-x C-j RET
and typing M-:
Eval: (process-coding-system (get-buffer-process (current-buffer)))
returns (binary . utf-8-unix)
switch modes again C-c C-k RET
to type exit()
in the REPL
cf: https://github.com/tpapp/julia-repl/issues/90#issuecomment-647084474 & https://github.com/tpapp/julia-repl/issues/90#issuecomment-647350290
xterm (with exported unicode LANG) GUI Emacs ESS (R)
bash-4.3$ echo $LANG
en_US
bash-4.3$ export LANG=en_US.UTF-8
bash-4.3$
starting emacs from the command-line
the Error message is identical to when run inside uxterm
> setwd('/home/eric/work/')
> 4 ≤ 5
> Error: unexpected input in "4 ≤"
> q()
Lisp Eval
M-:
Read a single Emacs Lisp expression in the minibuffer, evaluate it, and print the value in the echo area (eval-expression
).
adding this to ~/.emacs.d/init.el works
(if (display-graphic-p)
(setenv "LANG" "da_DK.UTF-8" (set-locale-environment "da_DK.UTF-8")))
closing
Thanks for investigating this. I am not sure it is worth documenting this quirk of 4-year old version of Slackware for a general audience, but if people run into this I can just refer them to this issue.
M-x julia-repl
generates in a *Warnings* buffer the below.Warning (emacs): could not capture basedir for Julia executable julia