Giter Site home page Giter Site logo

code-iai / ros_emacs_utils Goto Github PK

View Code? Open in Web Editor NEW
17.0 18.0 19.0 1.71 MB

Emacs tools for ROS

Shell 0.04% Emacs Lisp 46.09% Common Lisp 47.66% Makefile 0.38% Scheme 4.91% Ruby 0.28% TeX 0.11% CSS 0.04% Awk 0.02% CMake 0.08% Standard ML 0.34% YASnippet 0.05%

ros_emacs_utils's Introduction

ros_emacs_utils

This is a collection of packages to work on ROS-based software from Emacs.

Supported are the versions of Emacs >= 24.3. For older versions please use the older-than-emacs24.3 branch.

The repo contains a rosemacs package, which provides functions for starting a roscore, monitoring ROS nodes etc (with corresponding Emacs key bindings). And, in addition to that, it has a number of packages to simplify development of roslisp-based packages. Among them is a wrapper for Slime (Lisp interactive development environment) called slime_wrapper, a contrib for Slime to work with ROS slime_ros, and a Slime REPL called roslisp_repl, configured to start slime, slime_ros and setup roslisp.

This document only gives you instructions on installation. For other information consult the official wiki pages of the packages: rosemacs for non Lisp programmers and roslisp_repl otherwise.

Not a Common Lisp programmer

If you don't work with Common Lisp and just use Emacs for C++ or Python or Java or Lisp dialects other than Common Lisp or whatever else, you just need to add the following lines to your Emacs initialization file (init.el or similar):

(add-to-list 'load-path "/opt/ros/DISTRO/share/emacs/site-lisp")
(require 'rosemacs-config)

where DISTRO is the name of your ROS distribution, e.g. indigo.

Common Lisp programmer

Currently, we are using an alternative branch of slime, which has not been merged into master yet. The version we use is distributed with the ROS Debian packages. Unfortunately, that means that our ROS Debian package of slime (ros-indigo-slime-wrapper) and official Debian of slime (slime) can collide.

It is strongly recommended to only use the ROS Debian package of slime, i.e.: sudo apt-get purge slime if you installed one before.

For users

If you work with roslisp, all you need to do is to start roslisp_repl in the terminal.

If you want to start the REPL from inside of your Emacs process, add the following to your Emacs init script:

(require 'slime-config "PATH_TO_SLIME_ROS/slime-config.el")

where PATH_TO_SLIME_ROS is what rospack find slime_ros gives you, e.g. "/opt/ros/indigo/share/slime_ros", or "YOUR_CATKIN_WS/src/ros_emacs_utils/slime_ros" if you're installing from source. After that line you can add the usual Slime customization commands, like setting the inferior-lisp-program or turning off the slime-startup-animation etc.

Then you need to run

$ rosrun slime_ros slime_ros_init

which will create .sbclrc-ros in your home directory and add an entry into your .sbclrs to load .sbclrc-ros.

Once set up, you can start the REPL from your Emacs by pressing M-x slime, which means holding the Alt key and pressing x and then typing slime .

For developers

There is one detail to take into account when compiling ros_emacs_utils from source: in order for the code to work you not only need to run catkin_make on the packages, but also install them (catkin_make install).

Why do we need to catkin_make install? (Skip the next two paragraphs if you don't care.)

All the packages have their Emacs Lisp part contained in a single or multiple *.el files. During installation of the packages those files are being copied into YOUR_INSTALL_DIR/share/emacs/site-lisp. Therefore, you need to tell Emacs in the initialization script to add that directory to the Emacs load-path in a recursive way. That is done in rosemacs-config.el.

In addition to the Emacs Lisp part, all the packages except rosemacs have a Common Lisp part, and all the *.lisp files are being copied into YOUR_INSTALL_DIR/share/common-lisp/source, this replicates the Debian approach to installing Emacs Lisp and Common Lisp files. Therefore, you need to tell your Common Lisp compiler, actually linker, i.e. ASDF, to search for systems in that directory. That is done in .sbclrc, or, more correctly, in .sbclrc-ros. As you can see, right now only SBCL is supported. The original file can be found in your slime_ros ROS package under the name sbclrc-ros. When starting the roslisp_repl executable, slime_ros_init is called, which in its turn copies sbclrc-ros into the home directory, and adds a necessary entry into .sbclrc. Check the slime_ros_init executable from slime_ros package for more info.

System requirements

  • Emacs24.3+
  • For Common Lisp developers: SBCL as the preferred compiler

FAQ

  • Q: Why doesn't my roslisp_repl start properly / find rosemacs?
  • A: Probably because you didn't install the ros_emacs_utils packages, e.g. catkin_make install them. Just follow the directions in the error pop up winodw (or echo buffer) of your Emacs.
  • Q: It says component "swank" cannot be found.
  • A: There might be something wrong in your .sbclrc or .sbclrc-ros. Try calling rosrun slime_ros slime_ros_init if you haven't done that yet. (When starting REPL through roslisp_repl the script is called automatically.)
  • Q: It still doesn't work!
  • A: Please file a bug report on Github.

ros_emacs_utils's People

Contributors

aginika avatar airballking avatar bhaskara avatar furushchev avatar gaya- avatar moesenle avatar rsinnet avatar sunava avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ros_emacs_utils's Issues

Slime fails to launch/compile due to swank/slime version mis-match

I'm trying to get slime_ros setup (I previously used slime from quicklisp-silme-helper), but when starting slime I get the error below. The relevant bit from my .emacs is below, and I've run rosrun slime_ros slime_ros_init. I believe the line

Symbol "CODE-TRACE-TABLE-OFFSET-SLOT" not found in the SB-VM package.

indicates that there is a version mismatch between slime and swank. When I tried to run slime without running slime_ros_init I got an explicit warning/error from emacs that "versions differ" between slime (2014-99-99) and swank (2015-06-01). I have no slime.elc files lying around.

I am building slime_ros and slime_wrapper from source using

 sudo ./src/catkin/bin/catkin_make_isolated --install --install-space /opt/ros/indigo

Do you have any ideas what this could be?

(cond
 ((ignore-errors
    (funcall 'require "asdf")
    (funcall
     (read-from-string "asdf:version-satisfies")
     (funcall
      (read-from-string "asdf:asdf-version"))
     "2.019"))
  (push
   (pathname "/opt/ros/indigo/share/emacs/site-lisp/slime/")
   (symbol-value
    (read-from-string "asdf:*central-registry*")))
  (funcall
   (read-from-string "asdf:load-system")
   :swank)
  (funcall
   (read-from-string "swank:start-server")
   "/tmp/slime.25475"))
 (t
  (progn
    (load "/opt/ros/indigo/share/emacs/site-lisp/slime/swank-loader.lisp" :verbose t)
    (funcall
     (read-from-string "swank-loader:init"))
    (funcall
     (read-from-string "swank:start-server")
     "/tmp/slime.25475"))))
This is SBCL 1.2.14.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* 
; compiling file "/opt/ros/indigo/share/common-lisp/source/slime/swank-sbcl.lisp" (written 09 AUG 2015 01:13:57 PM):
; compiling (IN-PACKAGE :SWANK-BACKEND)
[.... many compiling lines]
; compiling (DEFIMPLEMENTATION PROFILE-PACKAGE ...)
; compiling (DEFMETHOD EMACS-INSPECT ...)
; compiling (DEFMETHOD EMACS-INSPECT ...); 
; caught ERROR:
;   READ error during COMPILE-FILE:
;   
;     Symbol "CODE-TRACE-TABLE-OFFSET-SLOT" not found in the SB-VM package.
;   
;       Line: 1507, Column: 70, File-Position: 60197
;   
;       Stream: #<SB-INT:FORM-TRACKING-STREAM
;                 for "file /opt/ros/indigo/share/common-lisp/source/slime/swank-sbcl.lisp"
;                 {1006107D63}>

; compilation aborted after 0:00:00.900

debugger invoked on a UIOP/LISP-BUILD:COMPILE-FILE-ERROR in thread
#<THREAD "main thread" RUNNING {1003B86CD3}>:
  COMPILE-FILE-ERROR while compiling #<CL-SOURCE-FILE "swank" "swank-sbcl">

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY                        ] Retry
                                     compiling #<CL-SOURCE-FILE "swank" "swank-sbcl">.
  1: [ACCEPT                       ] Continue, treating
                                     compiling #<CL-SOURCE-FILE "swank" "swank-sbcl">
                                     as having been successful.
  2:                                 Retry ASDF operation.
  3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the
                                     configuration.
  4: [ABORT                        ] Exit debugger, returning to top level.

(UIOP/LISP-BUILD:CHECK-LISP-COMPILE-RESULTS NIL T T "~/asdf-action::format-action/" ((#<ASDF/LISP-ACTION:COMPILE-OP > . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "swank" "swank-sbcl">)))
0] 

(require 'slime-config "/opt/ros/indigo/share/slime_ros/slime-config.el")
; QuickLisp
;(load (expand-file-name "~/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "sbcl")
;(require 'slime-autoloads)
;(slime-setup '(slime-fancy))

ASDF priority loading

The original debian package for slime has a priority over our slime_wrapper in some cases. It's not ensured with the current setup (.sbclrc) that ASDF always finds the slime_wrapper systems before the original ones.

Default output not redirected to `*slime-repl sbcl*`

When during SBCL startup in the repl, swank:*globally-redirect-io* is set to nil (which it is by default right now), all (or most?) output from (format ...) and (ros-info ...) and alike goes to *inferior-lisp* instead of *slime-repl sbcl*. I found this out totally by chance, when I realized that most of my usual output disappears into nirvana.

Setting the flag in ~/catkin_ws/install/share/common-lisp/source/slime/contrib/swank-repl.lisp to t and restarting the inferior lisp brings it back to normal.

This wasn't like that before, so I assume this is a bug. Or is this an intended change?

@gheorghelisca and me ran into this problem. @airballking, does this concern you as well?

Turn off non-compiled code highlighting of slime

On dark background it's really annoying. This should be an optional feature IMO. As slime developers don't think the same we should turn it off in slime-ros instead.

(slime-highlight-edits-mode 0)

snippet is overwrite

Hi ! I tried rosemacs,but I found the snippet mode only left c++mode,and snippets only left the things about ros,so I deleted the config of yasnippet in rosemacs-config.el like this:
;;; Default modes list. Mostly there to make sure Yasnippets work.
;;; Will overwrite the settings from your emacs init file, so be careful...
;; (setq auto-mode-alist
;; (append '(("\.C$" . c++-mode)
;; ("\.cc$" . c++-mode)
;; ("\.c$" . c-mode)
;; ("\.h$" . c++-mode)
;; ("makefile$" . makefile-mode)
;; ("Makefile$" . makefile-mode)
;; ("\.asd" . lisp-mode)
;; ("\.launch" . xml-mode)) auto-mode-alist))

;; ;;; Yasnippets: templates for standard structures. E.g. wgh TAB in a *.h file.
;; (require 'yasnippet)
;; (add-to-list 'yas-snippet-dirs "/home/yuebenben/catkin_ws/install/share/emacs/site-lisp/snippets")
;; (yas-global-mode 1)
but it is still worng
I found even I just added
"(add-to-list 'load-path "~/catkin_ws/install/share/emacs/site-lisp")",this problem occured!
and the message buffer show:

[yas] Reloaded everything (snippets will load just-in-time)....
[yas] Loading for `c++-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/yuebenben/catkin_ws/install/share/emacs/site-lisp/snippets/c++-mode) (quote c++-mode)))!
[yas] Loading compiled snippets from /home/yuebenben/catkin_ws/install/share/emacs/site-lisp/snippets/c++-mode
why it is occur? Can you help me ? Thank you!

Local repl-config.el for user-specific customization

For roslisp_repl users there is no way to change their Emacs setup without editing the installed code. Although roslisp_repl is not supposed to be customized (for that one should properly setup their Emacs init file) it would still be nice to have a repl-config-local.el in the user's home to allow for little customizations. If the file does not exist, roslisp_repl would create it from repl-config-local-default.el and use the new file, if repl-config-local.elgets broken and creates problems when loading roslisp_repl will fall back to repl-config-local-default.el and issue a big fat warning.

.emacs.d already exists

Complained when loading roslisp_repl for the first time on one of the machines. Wouldn't start the REPL because of that.

Default heap size too big for some machines

When --dynamic-space-size is bigger than the machine hardware or the OS can handle things break. Instead, slime_ros should either automatically decrease the heap size or the default value should always be low and the user should be able to very easily overwrite it in the Emacs configuration file.

spacemacs support

Hi,

Is rosemacs compatible with spacemacs? I have modified my init.el file as recommended, and I get access to the different commands when I use C-x C-r. However none of the commands seem to work. I'm getting errors such as : no module named rosmaster.master_api . Is there a fix for this?

Thanks

Install fails due to conflict with existing emacs26 setup

ROS Melodic, Ubuntu 18.04

rosemacs_install_log.txt

dpkg: error processing archive /tmp/apt-dpkg-install-QSPfWD/0-emacs25-common_25.32.gitc09215a-kk1+18.04_all.deb (--unpack):
trying to overwrite '/usr/share/emacs/site-lisp/subdirs.el', which is also in package emacs26-common 26.3
1.git96dd019-kk1+18.04

Is there a reason why rosemacs has to be bundled with emacs25? Would be grateful for any suggestions for a fix/workaround.

Cheers.

Find file auto completion changed

First thank you for carrying on the torch of rosemacs, I really like this tool!

However, when rosemacs is enabled it drastically changes the behavior of Ctrl-X-F e.g. Find file:. Its auto completion I find very annoying, for example, if there is just one folder or file in a directory it will not autocomplete it with the TAB key. Is there a way to use rosemacs but still maintain previous Find file functionality?

Thanks!

slime error

When I try slime or roslisp_repl I got the following error:

#<CL-SOURCE-FILE "swank-presentations" "contrib/swank-presentations">
   [Condition of type UIOP/LISP-BUILD:COMPILE-FILE-ERROR]

Restarts:
0: [RETRY] Retry compiling #<CL-SOURCE-FILE "swank-presentations" "contrib/swank-presentations">.
1: [ACCEPT] Continue, treating compiling #<CL-SOURCE-FILE "swank-presentations" "contrib/swank-presentations"> as having been successful.
2: [RETRY] Retry ASDF operation.
3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
4: [RETRY] Retry ASDF operation.
5: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
--more--

Backtrace:
0: (UIOP/LISP-BUILD:CHECK-LISP-COMPILE-RESULTS NIL T T "~/asdf-action::format-action/" ((#<ASDF/LISP-ACTION:COMPILE-OP > . #<ASDF/LISP-ACTION:CL-SOURCE-FILE "swank-presentations" "contrib/swank-presentat..
1: ((SB-PCL::EMF ASDF/ACTION:PERFORM) # # #<ASDF/LISP-ACTION:COMPILE-OP > #<ASDF/LISP-ACTION:CL-SOURCE-FILE "swank-presentations" "contrib/swank-presentations">)
2: ((LAMBDA NIL :IN ASDF/ACTION:CALL-WHILE-VISITING-ACTION))
3: ((:METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS :AROUND (T T)) #<ASDF/LISP-ACTION:COMPILE-OP > #<ASDF/LISP-ACTION:CL-SOURCE-FILE "swank-presentations" "contrib/swank-presentations">) [fast-method]
4: ((:METHOD ASDF/PLAN:PERFORM-PLAN (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN {10019098E3}>) [fast-method]
5: ((FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT))
6: ((:METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN {10019098E3}>) [fast-method]
7: ((:METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)) #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/SYSTEM:SYSTEM "swank-presentations"> :PLAN-CLASS NIL :PLAN-OPTIONS NIL) [fast-me..
8: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) # # #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/SYSTEM:SYSTEM "swank-presentations">)
9: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
10: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/SYSTEM:SYSTEM "swank-presentations">) [fast-method]
11: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) # # ASDF/LISP-ACTION:LOAD-OP "swank-presentations")
12: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
13: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:LOAD-OP "swank-presentations") [fast-method]
14: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<CLOSURE (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {1004D7115B}> :OVERRIDE T :KEY NIL :OVERRIDE-CACHE T :OVERRIDE-FORCING NIL)
15: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
16: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<CLOSURE (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {1004D5F8FB}> :OVERRIDE NIL :KEY NIL :OVERRIDE-CACHE NIL :OVERRIDE-FORCING NIL)
17: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:LOAD-OP "swank-presentations") [fast-method]
18: (ASDF/OPERATE:LOAD-SYSTEM "swank-presentations")

I am using: ros-melodic.
tried cloning this repo. and AURros-melodic-ros-emacs-utils. Both gave me the same error.

I have deleted slime package from emacs and quicklisp.

thanks in advance.

Kinetic release?

Many thanks for providing these packages!

Would you consider releasing them to Kinetic?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.