Skip to content

Conversation

@susam
Copy link
Contributor

@susam susam commented Nov 19, 2019

Prior to this change, on Linux or Unix, even if Clojure is available in
one of the paths mentioned in the PATH environment variable, the normal
mode command ,c fails to start Swank server with Clojure. This issue
occurs because semicolon (;) is assumed to be the path delimiter in
the PATH value, so when PATH is, say, /usr/bin:/usr/local/bin and
clojure.jar is available in /usr/local/bin, the search for Clojure
fails because Slimv tries to search for Clojure in a single directory
named /usr/bin:/usr/local/bin. Instead, it should search for Clojure
in two directories named /usr/bin and /usr/local/bin.

This change ensures that on Linux or Unix, colon (:) is interpreted as
the path delimiter in the PATH value. On Windows, semicolon (;) is
used as the path delimiter.

Prior to this change, on Linux or Unix, even if Clojure is available in
one of the paths mentioned in the PATH environment variable, the normal
mode command `,c` fails to start Swank server with Clojure. This issue
occurs because semicolon (`;`) is assumed to be the path delimiter in
the PATH value, so when PATH is, say, `/usr/bin:/usr/local/bin` and
`clojure.jar` is available in `/usr/local/bin`, the search for Clojure
fails because Slimv tries to search for Clojure in a single directory
named `/usr/bin:/usr/local/bin`. Instead, it should search for Clojure
in two directories named `/usr/bin` and `/usr/local/bin`.

This change ensures that on Linux or Unix, colon (`:`) is interpreted as
the path delimiter in the PATH value. On Windows, semicolon (`;`) is
used as the path delimiter.
@susam
Copy link
Contributor Author

susam commented Nov 19, 2019

I have tested that this change works fine on Debian, macOS, and Windows.

Testing Steps on Debian, Ubuntu, or macOS

  1. Install Maven.

    # On Debian, Ubuntu, etc.
    apt-get update
    apt-get install maven
    
    # On macOS
    brew install openjdk maven
    export JAVA_HOME=/usr/local/opt/openjdk
    export PATH="$JAVA_HOME/bin:$PATH"
  2. Install Clojure.

    git clone https://github.com/clojure/clojure.git ~/clj
    git -C ~/clj checkout clojure-1.10.1
    mvn -f ~/clj/pom.xml -Plocal -Dmaven.test.skip=true package
    java -jar ~/clj/clojure.jar -e '(clojure-version)'
  3. Install Slimv.

    git clone https://github.com/kovisoft/slimv.git ~/.vim/bundle/slimv
    echo 'set runtimepath^=~/.vim/bundle/slimv' >> ~/.vimrc
    vim +'helptags ~/.vim/bundle/slimv/doc' +q
  4. Add Clojure directory to PATH environment variable.

    export PATH=~/clj:$PATH
  5. Run Vim within tmux, GNU Screen, or a desktop environment to create
    a new Clojure source file.

    vim foo.clj
  6. Press ,c to start Swank server with Clojure. Without this change, Swank server fails to start.

  7. Apply this change.

    cd ~/.vim/bundle/slimv
    git checkout -b clojure-path
    git pull https://github.com/susam/slimv clojure-path
  8. Repeat steps 4 to 6 again. Swank server should start successfully now and the REPL buffer should appear.

Testing Steps on Windows

  1. Install 64-bit Vim using 64-bit installer available at https://github.com/vim/vim-win32-installer/releases.

  2. Install 64-bit Python 3.7 using Windows x86-64 executable installer available at https://www.python.org/downloads/release/python-375/. Note: It is important that the Python version be 3.7 because the latest Vim available at the previous URL at this time is compiled with support for Python 3.7.

  3. Install 64-bit Git from https://git-scm.com/download/win.

  4. Install JDK from https://jdk.java.net/13/.

  5. Install Maven from https://maven.apache.org/download.cgi.

  6. Add the paths to Vim, Python, Git, JDK, and Maven binaries to PATH environment variable.

  7. Install Clojure.

    git clone https://github.com/clojure/clojure.git C:\clj
    git -C C:\clj checkout clojure-1.10.1
    mvn -f C:\clj\pom.xml -Plocal -Dmaven.test.skip=true package
    java -jar C:\clj\clojure.jar -e "(clojure-version)"
  8. Install Slimv.

    git clone https://github.com/kovisoft/slimv.git %HOMEPATH%\.vim\bundle\slimv
    echo set runtimepath^^=~/.vim/bundle/slimv >> %HOMEPATH%\.vimrc
    vim +"helptags ~\.vim\bundle\slimv\doc" +q
  9. Add Clojure directory to PATH environment variable.

    PATH=C:\clj;%PATH%
  10. Run Vim within tmux, GNU Screen, or a desktop environment to create a new Clojure source file.

    vim foo.clj
  11. Press ,c to start Swank server with Clojure. It should start successfully even without this change. This issue did not affect Windows.

  12. Now we need to ensure that we can start Swank server even after applying this change.

    cd %HOMEPATH%\.vim\bundle\slimv
    git checkout -b clojure-path
    git pull https://github.com/susam/slimv clojure-path
  13. Kill Swank server running in a separate console window. Then repeat steps 9 to 11 again. Swank server should start successfully again.

@kovisoft kovisoft merged commit f027f35 into kovisoft:master Nov 19, 2019
@susam susam deleted the clojure-path branch November 24, 2019 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants