An introduction to the Ciao emacs environment
Author(s): Manuel Hermenegildo.
While it is easy to use Ciao with any editor of your choice, using it within the emacs editor/program development system is highly recommended: Ciao includes an emacs mode which provides a very complete application development environment which greatly simplifies many program development tasks. See Using Ciao inside GNU emacs for details on the capabilities of ciao/emacs combination.
If the (freely available) emacs editor/environment is not installed in your system, we highly recommend that you also install it at this point (there are instructions for where to find emacs and how to install it in the Ciao installation instructions). Once emacs is installed, after starting it (typing emacs) the following should work:
- Typing ^H i (or in the menus Help->Manuals->Browse Manuals with Info) should open a list of manuals in info format in which the Ciao manual(s) should appear.
- When opening a Ciao file, i.e., a file with .pl or .pls ending, using ^X^Ffilename (or using the menus) the code should appear highlighted according to syntax (e.g., comments in red), and Ciao/Prolog menus should appear in the menu bar on top of the emacs window.
- Loading the file using the Ciao/Prolog menu (or typing ^C l) should start in another emacs buffer the Ciao toplevel shell and load the file. You should now be able to switch the the toplevel shell and make queries from within emacs.
Note: when using emacs it is very convenient to swap the locations of the (normally not very useful) Caps Lock key and the (very useful in emacs) Ctrl key on the keyboard. How to do this is explained in the emacs frequently asked questions FAQs (see the emacs download instructions for their location).
If these things do not work, the system or emacs may not be installed properly. After having done this you can try for example the following things:
- You can go to the location of most of the errors that may be reported during compilation by typing ^C `.
- You can also, e.g., create executables from the Ciao/Prolog menu, as well as compile individual files, or generate active modules.
- Loading a file for source-level debugging using the Ciao/Prolog menu (or typing ^C d) and then issuing a query should start the source-level debugger and move a marker on the code in a window while execution is stepped through in the window running the Ciao top level.
- You can add the lines needed in Unix for turning any file defining main/1 into a script from the Ciao/Prolog menu or by typing ^C I S.
- You can also work with the preprocessor and auto-documenter directly from emacs: see their manuals or browse through the corresponding menus that appear when editing .pl files.
We encourage you once more to read Using Ciao inside GNU emacs to discover the many other functionalities of this environment.