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 [2015/04/27 18:35] – [IDE: Emacs] gkazhoyadoc:ide [2015/09/04 14:47] (current) gkazhoya
Line 36: 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 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 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 48: 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 54: 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 60: 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 71: 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 89: 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 112: 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: