4
votes

I've successfully upgraded to lein2, and have run lein repl successfully. I use VanDyke's SecureCrt to log into my Ubuntu 12.04 workstation. I have not changed any terminal settings, and did not have the following problem with lein 1.x.

When I went to use my usual bash command line keys like CTRL+A, CTRL+E, and CTRL+C, none of those keys worked.

What do I need to do to enable these CTRL keys?

Following the install instructions, I saved my original lein as lein1. I've tried that, and the control keys work, as noted above.

I've tried installing lein2 for a new user, instead of an upgrade, and the control key problem persists. I've also tried this on CentOS and Ubuntu systems. The same behavior exists.

Here is the output from stty -a

speed 38400 baud; rows 42; columns 159; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke cnorton@steamboy:~/projects/clojure/wtr-usage1$

Here is the output from new lein:

nREPL server started on port 52310
REPL-y 0.1.9
Clojure 1.4.0
    Exit: Control+D or (exit) or (quit)
Commands: (user/help)
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
          (user/sourcery function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
          (user/clojuredocs name-here)
          (user/clojuredocs "ns-here" "name-here")
wtr-usage1.core=> 

Are there any directories or files that should be cleaned up between lein 1 and 2? I have no plugins, so did not do any of that part of the upgrade.

I have continued to work on this problem, and performed the following diagnostic tests:

1) I ran the following command

java -cp target/jline-2.11-SNAPSHOT-tests.jar:target/jline-2.11-SNAPSHOT.jar -Djline.internal.Log.debug=true jline.example.Example none

in a cloned jline2 directory. The control keys did not work.

2) I ran the following command

export JLINE_LOGGING=trace && lein trampoline run

in a cloned -- git clone git://github.com/trptcolin/reply.git -- reply directory. The control keys worked. It was suggested to me that I create an issue on github, which I did.

5
I will gladly post more information about my workstation, and I'll go try this on a non Ubuntu system for further testing. I know there's something I'm missing to fix as part of the lein1 to lein2 upgrade. - octopusgrabbus
Thanks to whomever upvoted this. I don't know why it was ever downvoted. I posted everything but the kitchen sink, and kept editing the original post to reflect the testing I did from answers that were helpful but did not solve the problem. Finally, I sought help outside SO, working with someone involved with leiningen, who provided me the answers I was seeking. Those answers were tackling my installation using diagnostics. In the end it was decided to post an issue against leiningen. I edited the OP with the results of those diagnostic tests to make the question as complete as possible. - octopusgrabbus
There is a fix for this, which I will try soon. github.com/technomancy/leiningen/pull/1057 If this works, I'll edit the OP to reflect this. - octopusgrabbus

5 Answers

1
votes

That's not supposed to happen. Try executing set -o emacs in bash, but there shouldn't be anything in the lein script to disable it.

1
votes

Try reinstalling leiningen. lein2 repl on my configuration launches REPL-y, it looks like this:

% lein2 repl
Downloading Leiningen to /home/dpx-infinity/.lein/self-installs/leiningen-2.0.0-standalone.jar now...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12.6M  100 12.6M    0     0  93665      0  0:02:21  0:02:21 --:--:-- 91018
nREPL server started on port 47543
REPL-y 0.1.9
Clojure 1.4.0
    Exit: Control+D or (exit) or (quit)
Commands: (user/help)
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
          (user/sourcery function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
          (user/clojuredocs name-here)
          (user/clojuredocs "ns-here" "name-here")
user=>

REPL-y has all usual editing commands. If you're not getting this, then there should be something wrong with your installation.

1
votes

I would suggest you to test new fresh lein installation in new fresh environment:

  1. Create new user: sudo useradd -m testlein
  2. Switch to new user: sudo su - testlein
  3. Get latest lein2: wget https://raw.github.com/technomancy/leiningen/stable/bin/lein
  4. Set execute permission: chmod +x lein
  5. Install lein: ./lein
  6. Run repl: ./lein repl

After that try commands ctrl-a/e/... .

P.S. I don't know how did you install java in your system. Perhaps you should set up java in new user environment before step 5.

1
votes

This sounds similar to problems with JLine on Cygwin. Trying the same workaround your system is worth a shot.

Edit the lein script starting about line 284 to the following; added lines are indicated with a ->.

    export TRAMPOLINE_FILE

->  stty -icanon min 1 -echo

    "$LEIN_JAVA_CMD" \
        -client -XX:+TieredCompilation \
        "${BOOTCLASSPATH[@]}" \
        $LEIN_JVM_OPTS \
        -Dfile.encoding=UTF-8 \
->      -Djline.terminal=jline.UnixTerminal \      
        -Dmaven.wagon.http.ssl.easy=false \
        -Dleiningen.original.pwd="$ORIGINAL_PWD" \
        -Dleiningen.script="$SCRIPT" \
        -classpath "$CLASSPATH" \
        clojure.main -m leiningen.core.main "$@"

->  stty icanon echo

    EXIT_CODE=$?
0
votes

Per suggestion of A. Webb I am posting my github issue #79 for jline as an answer. This works with term, but not with my SecureCrt. SecureCrt had no problems with lein1.


Control Keys Don't Work and Missing ~/.jline.rc file

No milestone No one is assigned

(I have gone ahead and created a ~/.jline.rc containing jline.terminal=auto since writing this issue.) My issue is my control keys do not work, and what can I do to work around this issue.

Here is a description of what I've done.

I am running

java -cp target/jline-2.11-SNAPSHOT-tests.jar:target/jline-2.11-SNAPSHOT.jar -Djline.internal.Log.debug=true jline.example.Example none

in my ~/jline2 directory, where I installed jline2. My control keys (ctrl+a, ctrl+e, ctrl+u and Backspace) do not work.

I am logging into an Ubuntu 12.04 system with bash as the shell and using a VanDyke SecureCrt terminal emulator product. I have made no recent settings changes to my emulator.

First, I notice I have no ~/.jline.rc file [DEBUG] Loading properties from: file:/home/cnorton/.jline.rc [DEBUG] Unable to read configuration from: file:/home/cnorton/.jline.rc java.io.FileNotFoundException: /home/cnorton/.jline.rc (No such file or directory)

After the stack trace, here is the rest of the output.

[DEBUG] Creating terminal; type=auto [DEBUG] Config: speed 38400 baud; rows 34; columns 117; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

[DEBUG] Created Terminal: jline.UnixTerminal@1d520c4 [DEBUG] Registering shutdown-hook: Thread[JLine Shutdown Hook,5,main] [DEBUG] Adding shutdown-hook task: jline.TerminalSupport$1@1e9cb75 [DEBUG] Ansi supported: true [DEBUG] Echo enabled: false [DEBUG] NonBlockingInputStream start [DEBUG] Loaded user configuration: file:/home/cnorton/.inputrc prompt> [DEBUG] Running all shutdown-hook tasks [DEBUG] Running task: jline.TerminalSupport$1@1e9cb75 [DEBUG] Removing shutdown-hook: Thread[JLine Shutdown Hook,5,main]

Here is some more debugging output from running

export JLINE_LOGGING=trace && lein trampoline run in a cloned directory git clone git://github.com/trptcolin/reply.git Please note the control keys work.

cnorton@steamboy:~/reply$ export JLINE_LOGGING=trace && lein trampoline run REPL-y 0.2.0-SNAPSHOT Clojure 1.4.0 Exit: Control+D or (exit) or (quit) Commands: (user/help) Docs: (doc function-name-here) (find-doc "part-of-name-here") Source: (source function-name-here) (user/sourcery function-name-here) Javadoc: (javadoc java-object-or-class-here) Examples from clojuredocs.org: clojuredocs or cdoc (user/clojuredocs "ns-here" "name-here") [DEBUG] Loading properties from: file:/home/cnorton/.jline.rc [DEBUG] Loaded properties: [DEBUG] jline.terminal=unix [TRACE] java.lang.Throwable: CREATE MARKER at jline.TerminalFactory.create(TerminalFactory.java:50) at jline.TerminalFactory.get(TerminalFactory.java:159) at jline.console.ConsoleReader.(ConsoleReader.java:226) at jline.console.ConsoleReader.(ConsoleReader.java:218) at jline.console.ConsoleReader.(ConsoleReader.java:210) at reply.reader.simple_jline$setup_console_reader.invoke(simple_jline.clj:39) at reply.reader.simple_jline$get_input_line.invoke(simple_jline.clj:74) at reply.reader.simple_jline$safe_read_line$fn__941.invoke(simple_jline.clj:101) at clojure.lang.Atom.swap(Atom.java:37) at clojure.core$swap_BANG_.invoke(core.clj:2108) at reply.reader.simple_jline$safe_read_line.invoke(simple_jline.clj:99) at reply.eval_modes.nrepl$safe_read_line.invoke(nrepl.clj:55) at reply.eval_modes.nrepl$parsed_forms.invoke(nrepl.clj:88) at reply.eval_modes.nrepl$run_repl.invoke(nrepl.clj:139) at reply.eval_modes.nrepl$main.invoke(nrepl.clj:227) at reply.main$launch_nrepl$fn__3187.invoke(main.clj:63) at clojure.core$with_redefs_fn.invoke(core.clj:6585) at reply.main$launch_nrepl.invoke(main.clj:62) at reply.main$launch.invoke(main.clj:79) at reply.main$_main.doInvoke(main.clj:89) at clojure.lang.RestFn.invoke(RestFn.java:397) at clojure.lang.Var.invoke(Var.java:411) at clojure.lang.AFn.applyToHelper(AFn.java:159) at clojure.lang.Var.applyTo(Var.java:532) at reply.ReplyMain.main(ReplyMain.java:14) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207) at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:200) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207) at user$eval5.invoke(NO_SOURCE_FILE:1) at clojure.lang.Compiler.eval(Compiler.java:6511) at clojure.lang.Compiler.eval(Compiler.java:6501) at clojure.lang.Compiler.eval(Compiler.java:6477) at clojure.core$eval.invoke(core.clj:2797) at clojure.main$eval_opt.invoke(main.clj:297) at clojure.main$initialize.invoke(main.clj:316) at clojure.main$null_opt.invoke(main.clj:349) at clojure.main$main.doInvoke(main.clj:427) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:419) at clojure.lang.AFn.applyToHelper(AFn.java:163) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37)

[DEBUG] Creating terminal; type=unix [TRACE] Running: [sh,-c,stty -a < /dev/tty] [TRACE] Result: speed 38400 baud; rows 34; columns 117; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

[DEBUG] Config: speed 38400 baud; rows 34; columns 117; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

[DEBUG] Created Terminal: jline.UnixTerminal@74a7af [DEBUG] Registering shutdown-hook: Thread[JLine Shutdown Hook,5,main] [DEBUG] Adding shutdown-hook task: jline.TerminalSupport$1@183e6d4 [DEBUG] Ansi supported: true [TRACE] Running: [sh,-c,stty -icanon min 1 -icrnl -inlcr < /dev/tty] [TRACE] Result: [TRACE] Running: [sh,-c,stty -echo < /dev/tty] [TRACE] Result: [DEBUG] Echo enabled: false [DEBUG] NonBlockingInputStream start [DEBUG] Loaded user configuration: file:/home/cnorton/.inputrc [TRACE] Loading history from: /home/cnorton/.jline-reply.history user=> [TRACE] Running: [sh,-c,stty intr undef < /dev/tty] [TRACE] Result: [TRACE] Keystroke: 1 [TRACE] Binding: BEGINNING_OF_LINE [TRACE] Keystroke: 5 [TRACE] Binding: END_OF_LINE [TRACE] Keystroke: 21 [TRACE] Binding: UNIX_LINE_DISCARD [TRACE] Keystroke: 127 [TRACE] Binding: BACKWARD_DELETE_CHAR