-
 

euslime package from euslime repo

euslime

Package Summary

Tags No category tags.
Version 1.1.4
License BSD
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/euslime.git
VCS Type git
VCS Version master
Last Updated 2022-11-06
Dev Status DEVELOPED
CI status
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

EusLisp meets SLIME

Additional Links

Maintainers

  • Guilherme de Campos Affonso

Authors

  • Yuki Furuta

euslime

Interactive interpreter for EusLisp with support for completion, on-spot referencing, auto-documetation, definition search, and more. Euslime is built on top of slime and runs on emacs.

For a quick guide to emacs try the following links:

Quick Start

  1. Install
    apt install ros-melodic-euslime
    
  1. Configure your emacs init file
    ;; ~/.emacs.el
    (add-to-list 'load-path "/opt/ros/melodic/share/euslime")
    (require 'euslime-config)
    (setq inferior-euslisp-program "roseus")
    (slime-setup '(slime-fancy slime-banner slime-repl-ansi-color))
    
  1. Run

    Open emacs and type the command:

    M-x euslime
    

Using with eus10

Compile from source with the eus10 branch: https://github.com/jsk-ros-pkg/euslime/tree/eus10.

The following command allows to automatically shift between apt and source euslisp builds.

;; ~/.emacs.el
(if (string-prefix-p "/opt" (getenv "EUSDIR"))
    (progn
      (add-to-list 'load-path "/opt/ros/melodic/share/euslime")
      (setq euslime-compile-path (expand-file-name "~/.euslime_opt/")))
  (add-to-list 'load-path "/home/affonso/euslime_ws/install/share/euslime"))
(require 'euslime-config)
(setq inferior-euslisp-program "roseus")
(slime-setup '(slime-fancy slime-banner slime-repl-ansi-color))

Logging

The following setting will save logs of all your sessions on exit.

;; ~/.emacs.el
(defun euslime-save-logs ()
  (when (get-buffer "*slime-events*")
    (with-current-buffer (get-buffer "*slime-events*")
      (let* ((logdir (concat (file-name-as-directory euslime-compile-path) "log"))
             (filename (concat "euslog." (format-time-string "%s" (current-time)))))
        (unless (file-exists-p logdir)
          (make-directory logdir t))
        (write-file (expand-file-name filename logdir))))))
(add-hook 'kill-emacs-hook 'euslime-save-logs)

Cheat sheet

On slime buffer  
[TAB] completion
C-c C-d d describe/ help
C-c C-d a apropos
C-c C-d p apropos package
M-. look for definition
C-c [RET] macroexpansion
,quit quit session
,restart-inferior-lisp restart session
,rossetip set ros ip and hostname
,rossetmaster set ros master uri
On editing buffers  
C-c TAB completion
C-c C-c load expression
C-c C-l load-file
C-c C-d o go back to repl buffer
On other slime buffers  
q quit buffer
[RET] select option

Build from Source

  1. Setup
    # Clone code
    mkdir ~/catkin_ws/src -p
    cd euslime_ws/src
    git clone https://github.com/jsk-ros-pkg/euslime.git
    # Install dependencies
    rosdep install -yr --from-paths . --ignore-src
    
  1. Build
    cd ~/catkin_ws
    catkin build
    
  1. Configure your emacs init file with the source directory
    ;; ~/.emacs.el
    (add-to-list 'load-path "~/catkin_ws/src/euslime")
    (require 'euslime-config)
    (setq inferior-euslisp-program "roseus")
    (slime-setup '(slime-fancy slime-banner slime-repl-ansi-color))
    
  1. Run

    Source the package

    source ~/euslime_ws/install/setup.bash
    
Then open emacs and type the command:
    M-x euslime
    

Run tests

# Run all tests
tests/euslime_tests.py

# RUN TESTS FOR EUSLISP PROGRAM
tests/euslime_tests.py eus
tests/euslime_tests.py irteusgl
tests/euslime_tests.py roseus

# RUN A SINGLE TEST
tests/euslime_tests.py eus.test_eval_1

# RUN MATCHING TESTS
tests/euslime_tests.py eus.test_eval_*
tests/euslime_tests.py *.test_eval_1

How it Works

Euslime is composed by several layers of software, ultimately connecting the emacs interface to the EusLisp interpreter.

euslime-communications

EMACS acts as the front-end interface, accepting user input and displaying output correspondingly. It also provides a series of modes, commands and key bindings for improved user experience, which are introduced at the original slime framework and slightly customized at euslime.el and euslime-config.el.

SWANK is the original slime backend, which handles interactions with emacs by delimiting a protocol that translates emacs commands into s-expressions. Such expressions are sent to and from the inferior lisp client (originally Common Lisp, in this case EusLisp) during an exchange which is logged at the *slime-events* buffer on emacs. A simple example is given below, illustrating an evaluation request for (1+ 1) followed by an output request for 2.

(:emacs-rex
 (swank-repl:listener-eval "(1+ 1)\n")
 "COMMON-LISP-USER" :repl-thread 6)
(:write-string "2" :repl-result)

PYTHON WRAPPER is responsible for encoding and decoding swank commands into actual EusLisp input/output, as well as managing the communications between the swank and the EusLisp layers. In the above example, this means that the python middleware would forward the expression (1+ 1) for evaluation in the EusLisp client, and then wrap the result into a suitable :write-string form which is finally sent to the emacs in order to display it on the screen. Although such functionality was originally implemented on slime as a part of the native common lisp framework, here we opt to establish an additional python layer due to its ability to (i) handle multithreading; (ii) cope with EusLisp crashes without compromising the emacs session; and (iii) minimize changes done to the EusLisp lexical environment.

The python middleware is divided into six files with well determined functionality, as detailed in the following.

server.py configures a socket server that communicates with the swank layer, receiving and answering to requests.

protocol.py parses incoming s-expressions into python functions, and also defines utility used to generate common swank forms, such as evaluation results or errors.

handler.py holds the actual definitions of the python functions responsible for handling the swank requests. For instance, the swank_repl_listener_eval function which answers to :swank-repl:listener-eval requests.

bridge.py deals with the communications with the EusLisp layer. The EusLisp interpreter is started as a subprocess and interacts with the python layer through pipes and sockets. Pipes are used to pass user input and program output, while sockets are used to transmit evaluation results, errors, and to process other internal requests while avoiding updating the REPL history and variables.

logger.py configures the logging function, which is displayed in the *inferior-lisp* emacs buffer.

cli.py bundles all of the above and arranges command line arguments for an euslime executable invoked upon startup.

Finally, in the EUSLISP layer a new package named SLIME is defined and a few overwrites are performed in order to establish a framework for properly dealing with socket communications and handler requests. Such functionality is distributed among the following three files:

slime-util.l gathers utility function designed to promptly respond to handler requests which would be hard to define solely with python coding, such as autodoc and completion.

slime-connection.l configures the socket communication framework, defining two different socket channels: one started from another thread allowing parallel evaluation and the other added to the top-selector allowing access to thread special variables. A custom input stream which communicates to swank at every read attempt is also defined here, allowing for the slime framework to differentiate user input answering to read functions from new evaluation requests.

slime-toplevel.l mainly overwrites lisp repl functions and error handlers so that they can send suitable socket information at each step of the evaluation. It is also responsible for setting up the sockets and streams defined at slime-connection and starting the main evaluation loop.

A more detailed explanation can be found in technical-report.md.

CHANGELOG

Changelog for package euslime

1.1.4 (2022-10-27)

  • Fix build
  • Contributors: Guilherme Affonso

1.1.3 (2022-10-12)

  • Wrap multiple s-exp in a single prompt
  • Add ros shortcut commands
  • Better submodule and source build support
  • Bugfix
  • Contributors: Guilherme Affonso

1.1.2 (2022-05-02)

  • Enable do-until-key function
  • Improve read socket stability
  • Avoid emacs crashes when the process is not responsive
  • Add slime-switch-to-output-buffer shortcuts
  • Bugfix
  • Contributors: Guilherme Affonso

1.1.1 (2022-03-10)

  • Add recursive load tags
  • Support method description
  • Enable piped-fork function
  • Generate comp/ and geo/ tags
  • Add technical-report.md
  • Bugfix
  • Contributors: Guilherme Affonso

1.1.0 (2020-09-26)

  • Major updates in python and toplevel
  • Better support for packages
  • Better TAGS functionality
  • Major updates to test suite
  • Bugfix
  • Contributors: Guilherme Affonso

1.0.2 (2020-06-01)

  • Fix build by using catkin_virtualenv
  • Contributors: Guilherme Affonso

1.0.1 (2020-03-10)

  • First public release for melodic
  • Contributors: Yuki Furuta, Guilherme Affonso

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Package Dependencies

System Dependencies

No direct system dependencies.

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged euslime at Robotics Stack Exchange

euslime package from euslime repo

euslime

Package Summary

Tags No category tags.
Version 1.1.4
License BSD
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/euslime.git
VCS Type git
VCS Version master
Last Updated 2022-11-06
Dev Status DEVELOPED
CI status
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

EusLisp meets SLIME

Additional Links

Maintainers

  • Guilherme de Campos Affonso

Authors

  • Yuki Furuta

euslime

Interactive interpreter for EusLisp with support for completion, on-spot referencing, auto-documetation, definition search, and more. Euslime is built on top of slime and runs on emacs.

For a quick guide to emacs try the following links:

Quick Start

  1. Install
    apt install ros-melodic-euslime
    
  1. Configure your emacs init file
    ;; ~/.emacs.el
    (add-to-list 'load-path "/opt/ros/melodic/share/euslime")
    (require 'euslime-config)
    (setq inferior-euslisp-program "roseus")
    (slime-setup '(slime-fancy slime-banner slime-repl-ansi-color))
    
  1. Run

    Open emacs and type the command:

    M-x euslime
    

Using with eus10

Compile from source with the eus10 branch: https://github.com/jsk-ros-pkg/euslime/tree/eus10.

The following command allows to automatically shift between apt and source euslisp builds.

;; ~/.emacs.el
(if (string-prefix-p "/opt" (getenv "EUSDIR"))
    (progn
      (add-to-list 'load-path "/opt/ros/melodic/share/euslime")
      (setq euslime-compile-path (expand-file-name "~/.euslime_opt/")))
  (add-to-list 'load-path "/home/affonso/euslime_ws/install/share/euslime"))
(require 'euslime-config)
(setq inferior-euslisp-program "roseus")
(slime-setup '(slime-fancy slime-banner slime-repl-ansi-color))

Logging

The following setting will save logs of all your sessions on exit.

;; ~/.emacs.el
(defun euslime-save-logs ()
  (when (get-buffer "*slime-events*")
    (with-current-buffer (get-buffer "*slime-events*")
      (let* ((logdir (concat (file-name-as-directory euslime-compile-path) "log"))
             (filename (concat "euslog." (format-time-string "%s" (current-time)))))
        (unless (file-exists-p logdir)
          (make-directory logdir t))
        (write-file (expand-file-name filename logdir))))))
(add-hook 'kill-emacs-hook 'euslime-save-logs)

Cheat sheet

On slime buffer  
[TAB] completion
C-c C-d d describe/ help
C-c C-d a apropos
C-c C-d p apropos package
M-. look for definition
C-c [RET] macroexpansion
,quit quit session
,restart-inferior-lisp restart session
,rossetip set ros ip and hostname
,rossetmaster set ros master uri
On editing buffers  
C-c TAB completion
C-c C-c load expression
C-c C-l load-file
C-c C-d o go back to repl buffer
On other slime buffers  
q quit buffer
[RET] select option

Build from Source

  1. Setup
    # Clone code
    mkdir ~/catkin_ws/src -p
    cd euslime_ws/src
    git clone https://github.com/jsk-ros-pkg/euslime.git
    # Install dependencies
    rosdep install -yr --from-paths . --ignore-src
    
  1. Build
    cd ~/catkin_ws
    catkin build
    
  1. Configure your emacs init file with the source directory
    ;; ~/.emacs.el
    (add-to-list 'load-path "~/catkin_ws/src/euslime")
    (require 'euslime-config)
    (setq inferior-euslisp-program "roseus")
    (slime-setup '(slime-fancy slime-banner slime-repl-ansi-color))
    
  1. Run

    Source the package

    source ~/euslime_ws/install/setup.bash
    
Then open emacs and type the command:
    M-x euslime
    

Run tests

# Run all tests
tests/euslime_tests.py

# RUN TESTS FOR EUSLISP PROGRAM
tests/euslime_tests.py eus
tests/euslime_tests.py irteusgl
tests/euslime_tests.py roseus

# RUN A SINGLE TEST
tests/euslime_tests.py eus.test_eval_1

# RUN MATCHING TESTS
tests/euslime_tests.py eus.test_eval_*
tests/euslime_tests.py *.test_eval_1

How it Works

Euslime is composed by several layers of software, ultimately connecting the emacs interface to the EusLisp interpreter.

euslime-communications

EMACS acts as the front-end interface, accepting user input and displaying output correspondingly. It also provides a series of modes, commands and key bindings for improved user experience, which are introduced at the original slime framework and slightly customized at euslime.el and euslime-config.el.

SWANK is the original slime backend, which handles interactions with emacs by delimiting a protocol that translates emacs commands into s-expressions. Such expressions are sent to and from the inferior lisp client (originally Common Lisp, in this case EusLisp) during an exchange which is logged at the *slime-events* buffer on emacs. A simple example is given below, illustrating an evaluation request for (1+ 1) followed by an output request for 2.

(:emacs-rex
 (swank-repl:listener-eval "(1+ 1)\n")
 "COMMON-LISP-USER" :repl-thread 6)
(:write-string "2" :repl-result)

PYTHON WRAPPER is responsible for encoding and decoding swank commands into actual EusLisp input/output, as well as managing the communications between the swank and the EusLisp layers. In the above example, this means that the python middleware would forward the expression (1+ 1) for evaluation in the EusLisp client, and then wrap the result into a suitable :write-string form which is finally sent to the emacs in order to display it on the screen. Although such functionality was originally implemented on slime as a part of the native common lisp framework, here we opt to establish an additional python layer due to its ability to (i) handle multithreading; (ii) cope with EusLisp crashes without compromising the emacs session; and (iii) minimize changes done to the EusLisp lexical environment.

The python middleware is divided into six files with well determined functionality, as detailed in the following.

server.py configures a socket server that communicates with the swank layer, receiving and answering to requests.

protocol.py parses incoming s-expressions into python functions, and also defines utility used to generate common swank forms, such as evaluation results or errors.

handler.py holds the actual definitions of the python functions responsible for handling the swank requests. For instance, the swank_repl_listener_eval function which answers to :swank-repl:listener-eval requests.

bridge.py deals with the communications with the EusLisp layer. The EusLisp interpreter is started as a subprocess and interacts with the python layer through pipes and sockets. Pipes are used to pass user input and program output, while sockets are used to transmit evaluation results, errors, and to process other internal requests while avoiding updating the REPL history and variables.

logger.py configures the logging function, which is displayed in the *inferior-lisp* emacs buffer.

cli.py bundles all of the above and arranges command line arguments for an euslime executable invoked upon startup.

Finally, in the EUSLISP layer a new package named SLIME is defined and a few overwrites are performed in order to establish a framework for properly dealing with socket communications and handler requests. Such functionality is distributed among the following three files:

slime-util.l gathers utility function designed to promptly respond to handler requests which would be hard to define solely with python coding, such as autodoc and completion.

slime-connection.l configures the socket communication framework, defining two different socket channels: one started from another thread allowing parallel evaluation and the other added to the top-selector allowing access to thread special variables. A custom input stream which communicates to swank at every read attempt is also defined here, allowing for the slime framework to differentiate user input answering to read functions from new evaluation requests.

slime-toplevel.l mainly overwrites lisp repl functions and error handlers so that they can send suitable socket information at each step of the evaluation. It is also responsible for setting up the sockets and streams defined at slime-connection and starting the main evaluation loop.

A more detailed explanation can be found in technical-report.md.

CHANGELOG

Changelog for package euslime

1.1.4 (2022-10-27)

  • Fix build
  • Contributors: Guilherme Affonso

1.1.3 (2022-10-12)

  • Wrap multiple s-exp in a single prompt
  • Add ros shortcut commands
  • Better submodule and source build support
  • Bugfix
  • Contributors: Guilherme Affonso

1.1.2 (2022-05-02)

  • Enable do-until-key function
  • Improve read socket stability
  • Avoid emacs crashes when the process is not responsive
  • Add slime-switch-to-output-buffer shortcuts
  • Bugfix
  • Contributors: Guilherme Affonso

1.1.1 (2022-03-10)

  • Add recursive load tags
  • Support method description
  • Enable piped-fork function
  • Generate comp/ and geo/ tags
  • Add technical-report.md
  • Bugfix
  • Contributors: Guilherme Affonso

1.1.0 (2020-09-26)

  • Major updates in python and toplevel
  • Better support for packages
  • Better TAGS functionality
  • Major updates to test suite
  • Bugfix
  • Contributors: Guilherme Affonso

1.0.2 (2020-06-01)

  • Fix build by using catkin_virtualenv
  • Contributors: Guilherme Affonso

1.0.1 (2020-03-10)

  • First public release for melodic
  • Contributors: Yuki Furuta, Guilherme Affonso

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Package Dependencies

System Dependencies

No direct system dependencies.

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged euslime at Robotics Stack Exchange