Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:ide [2014/05/12 13:09] gkazhoyadoc:ide [2015/09/04 14:47] (current) gkazhoya
Line 1: Line 1:
-==This page is under development...== 
  
 ====== Setup and IDE ====== ====== Setup and IDE ======
Line 17: Line 16:
 ==== Buildsystem: ASDF ==== ==== Buildsystem: ASDF ====
  
-One thing is to compile a specific source file into machine code, and another thing is to combine the different building blocks, together with external libraries into a coherent piece of software. For C++ the usual way to build the software is using the ''make'' scripts and the utilities based on the latter, as, e.g. CMake. In the CL world the accepted build system is [[http://common-lisp.net/project/asdf/|ASDF]] (Another System Definition Facility). ASDF supports all the modern CL implementations, including SBCL.+One thing is to compile a specific source file into machine code, and another thing is to combine the different building blocks, together with external librariesinto a coherent piece of software. For C++ the usual way to build the software is using the ''make'' scripts and the utilities based on the latter, as, e.g. CMake. In the CL world the accepted build system is [[http://common-lisp.net/project/asdf/|ASDF]] (Another System Definition Facility). ASDF supports all the modern CL implementations, including SBCL.
  
 ==== Middleware: ROS ==== ==== Middleware: ROS ====
Line 29: Line 28:
 SBCL + ASDF are already enough for developing and building CL software. But a more human-friendly development environment than the basic SBCL read-eval-print-loop would, of course, be more comfortable. SBCL + ASDF are already enough for developing and building CL software. But a more human-friendly development environment than the basic SBCL read-eval-print-loop would, of course, be more comfortable.
  
-Emacs is the main IDE the CRAM development team is using. Although it is not graphical, when combined with extensions for the corresponding programming languages it has all the most important features one needs in an IDE: code autocompletion, jumping to function definitions, integration with version control software, automatized code compilation on package, file, single function level, support of an interactive environment where one can try out the newly written function immediately in the Lisp console, displaying documentation of symbols/functions inside the Emacs and looking up for definitions in the [[http://www.lispworks.com/documentation/common-lisp.html|Hyperspec]] using the favorite browser etc. In addition, for advanced users it has many possibilities for customization and development of custom features. Moreover, due to Emacs not having a GUI, one can connect to the running Emacs through SSH and run / develop the Lisp code from a remote machine that has an SSH-capable terminal.+Emacs is the main IDE the CRAM development team is using. Although it is not graphical, when combined with extensions for the corresponding programming languages it has all the most important features one needs in an IDE: code autocompletion, jumping to function definitions, integration with version control software, automatized code compilation on package, file, single function level, support of an interactive environment where one can try out the newly written function immediately in the Lisp console, displaying documentation of symbols/functions inside the Emacs and looking up documentation in the [[http://www.lispworks.com/documentation/common-lisp.html|Hyperspec]] using your favorite browser etc. In addition, for advanced users it has many possibilities for customization and development of custom features. Moreover, due to Emacs not having a GUI, one can connect to the running Emacs through SSH and run / develop the Lisp code from a remote machine that has an SSH-capable terminal.
  
 On the other hand, the disadvantage of not having a GUI is that the whole functionality is invoked through hotkeys, so one needs to learn a lot of different key combinations, which takes time at the beginning but increases the speed of development once the hotkeys are inside one's fingers on the level of instincts. On the other hand, the disadvantage of not having a GUI is that the whole functionality is invoked through hotkeys, so one needs to learn a lot of different key combinations, which takes time at the beginning but increases the speed of development once the hotkeys are inside one's fingers on the level of instincts.
Line 37: Line 36:
 Emacs is used by many people around the world, mostly as a text editor, it is also popular for Tex/Latex development, some people use it even for C++ and Python, and the CRAM team uses it for Common Lisp, obviously. Emacs is used by many people around the world, mostly as a text editor, it is also popular for Tex/Latex development, some people use it even for C++ and Python, and the CRAM team uses it for Common Lisp, obviously.
  
-Please note that, as most other IDEs, Emacs requires an external compiler build system (linker) to program with the user's language of choice (except, of course, Emacs Lisp, an implementation of which is included in Emacs because without it it wouldn't be able to run itself). An exception from this would be Visual Studio which per default includes a C++ compiler from Microsoft. Otherwise one always needs extra GCC, JDK, Python, Common Lisp implementations installed on the Operating System.+Please note that, as most other IDEs, Emacs requires an external compiler and build system (linker) to program with the user's language of choice (except, of course, Emacs Lisp, an implementation of which is included in Emacs because without it it wouldn't be able to run itself). An exception from this "rule" would be Visual Studio which per default includes a C++ compiler from Microsoft. Otherwise one always needs extra GCC, JDK, Python, Common Lisp implementations installed on the Operating System to go with the IDE.
  
 ==== Summary ==== ==== Summary ====
  
-CRAM is written in Common Lisp (CL). There are many different implementations (i.e. compilers) for CL. The compiler used in CRAM and Roslisp is SBCL. The build system that compiles different components (the CL files / packages / systems) located in different places in the file system, into one piece of software, is ASDF. It defines in what sequence the different components are to be compiled, where to find them, and is responsible for incremental code compilation.+CRAM is written in Common Lisp (CL). There are many different implementations (i.e. compilers) for CL. The compiler used in CRAM and Roslisp is SBCL. The build system that compiles different components (the CL files / packages / systems) located in different places in the file system, into one piece of software, is ASDF. It defines in which order the different components are to be compiled, where to find them, and is responsible for incremental code compilation.
  
-The IDE used for CL programming in the CRAM community is Emacs. To connect the Emacs Lisp (which is a different Lisp dialect) of Emacs to the Common Lisp there is an Emacs extension called Slime. It's half written in Emacs Lisp, and half is in Common Lisp, the two halves talk to each other through TCP.+The IDE used for CL programming in the CRAM community is Emacs. To connect the Emacs Lisp of Emacs (which is a different Lisp dialect) to the Common Lisp there is an Emacs extension called Slime. It's half written in Emacs Lisp, and half is in Common Lisp, the two halves talk to each other through TCP.
  
 Emacs has a convenience extension for working with ROS called rosemacs. It can be used, e.g. for finding the source of a ROS package without knowing it's actual path but using the ''rospack find'' utility. Emacs has a convenience extension for working with ROS called rosemacs. It can be used, e.g. for finding the source of a ROS package without knowing it's actual path but using the ''rospack find'' utility.
Line 49: Line 48:
 To utilize the features of rosemacs when programming and building Common Lisp software there is also a slime-ros extension for Emacs which tells the CL build system where to find Lisp code of ROS packages. To utilize the features of rosemacs when programming and building Common Lisp software there is also a slime-ros extension for Emacs which tells the CL build system where to find Lisp code of ROS packages.
  
-For more info on how the different components are connected together check out the [[doc/ide-connections|Connecting Things Together]] doc. TODO: finish the doc with the explanations of slime contribs and stuff.+For more info on how the different components are connected together check out the [[doc/ide-connections|Connecting Things Together]] doc.
  
 ===== Setup ===== ===== Setup =====
Line 55: Line 54:
 To setup the development environment one needs to (1) install the necessary components and (2) configure them. To setup the development environment one needs to (1) install the necessary components and (2) configure them.
  
-If you followed the [[../installation|Installation]] instructions successfully (basic section is enough) you should already have all the IDE components automatically installed. The default configuration is also already set up for you, so running ''roslisp_repl'' in the shell will bring up a working IDE and you can start programming.+If you followed the [[../installation|Installation]] instructions successfully (basic section is already enough) you should already have all the IDE components automatically installed. The default configuration is also already set up for you, so running ''roslisp_repl'' in the shell will bring up a working IDE and you can start programming.
  
 If you are interested to know what the default configuration does and what happens under the hood, check out the [[doc/emacs-config|Emacs Configuration]] doc.  If you are interested to know what the default configuration does and what happens under the hood, check out the [[doc/emacs-config|Emacs Configuration]] doc. 
Line 61: Line 60:
 ===== Useful Tips ===== ===== Useful Tips =====
  
-==== Key bindings ====+==== Definitions ====
  
-An Emacs buffer is the equivalent of window / tab in other editors. It can have a file associated with it that you can (or cannot depending on the privileges) edit or a background process (e.g. when you open the shell: ''M-x shell''). The minibuffer is usually a one-line part of the screen at the bottom of the Emacs window. The cursor in Emacs is called the point. Dired is the directory explorer mode of Emacs.+An Emacs //buffer// is the equivalent of window / tab in other editors. It can have a file associated with it that you can (or cannot depending on the privileges) editor it can be running a process (e.g. when you open the shell: ''M-x shell''). The //minibuffer// is usually a one-line part of the screen at the bottom of the Emacs window. The cursor in Emacs is called the //point////Dired// is the directory explorer mode of Emacs.
  
 Textual representation of Emacs key bindings has a number of conventions: Textual representation of Emacs key bindings has a number of conventions:
Line 72: Line 71:
   * ''C-h b'' means first press ''Ctrl'' and ''h'' together and then ''b'' separately (in contrast to ''C-h C-b'')   * ''C-h b'' means first press ''Ctrl'' and ''h'' together and then ''b'' separately (in contrast to ''C-h C-b'')
   * Commands like ''M-x shell'' mean: press ''Alt'' and ''x'' together and then type ''shell'' into the minibuffer on the bottom of the screen.   * Commands like ''M-x shell'' mean: press ''Alt'' and ''x'' together and then type ''shell'' into the minibuffer on the bottom of the screen.
 +==== Key bindings ====
  
 Taken from the Slime manual: Taken from the Slime manual:
Line 90: Line 90:
   * C-M-f (C-M-b): go forward (backward) one expression (in Lisp an S-expression)   * C-M-f (C-M-b): go forward (backward) one expression (in Lisp an S-expression)
   * C-M-\: indent region   * C-M-\: indent region
-  * M-; : comment out region (chooses correct commenting characters depending on file extension)+  * M-; : comment out region (chooses correct commenting characters depending on the extension of the file you're editing)
   * M-< (M- >): go to buffer beginning (or end)   * M-< (M- >): go to buffer beginning (or end)
   * M-%: find-replace   * M-%: find-replace
Line 113: Line 113:
   * M-x slime-browse-system: open the system directory in Dired   * M-x slime-browse-system: open the system directory in Dired
   * C-c C-t: trace function at point   * C-c C-t: trace function at point
 +  * C-M-<Backspace>: clear current input (in case you changed your mind on executing it), make sure you don't have system bindings for this key combination.
  
 In REPL: In REPL:
Line 177: Line 178:
 Emacs cheat sheet: http://www.gnu.org/software/emacs/refcards/ \\ Emacs cheat sheet: http://www.gnu.org/software/emacs/refcards/ \\
 Paredit cheat sheet: http://www.emacswiki.org/emacs/PareditCheatsheet \\ Paredit cheat sheet: http://www.emacswiki.org/emacs/PareditCheatsheet \\
 +
 +
 + --- //For corrections / suggestions / complains please write an email to the person who last edited this doc (you can find the username in the webpage footer).