CoCoA:Emacs interface
cocoa-mode
The distribution of cocoa-4.5 includes an emacs/
directory which contains cocoa.el
and cocoa.emacs
(the settings to be added to your .emacs
).
- a friendly CoCoA menu
- automatic indentation
- coloured syntax (in font-lock-mode - default)
- capitalization of keywords (in abbrev-mode - default)
- automatic loading of
wordlist.txt
for dynamic abbrev expansion (M-/
orTAB
)
From the menu you can
- send lines, regions and files to cocoa
- go to the parse error line (if you had a parse error after sending a file)
- start or restart the CoCoAServer
Use TAB for Completion
(available soon) will allows to toggle this option. It used to be always off up to cocoa-4.4, and always on in cocoa-4.5.
Some key bindings in cocoa-mode
C-c C-e
(like in latex-mode) writes the appropriate "End" (EndIf,...)C-c C-c
(like in c-mode) comment-region
If the following features do not work you should customize the variable cocoa-executable
in cocoa.emacs:
Calling CoCoA
From a buffer in cocoa-mode you can select things and "send" them to a cocoa buffer (called *cocoa*
) to be evaluated:
C-c C-l
- execute this line (from any point in the line)
C-c C-r
- execute the selected region
C-c C-f
- execute all this file (from any point in thefile)
C-c C-p
- go to the parse error line (if C-c C-f gave a parse error)
C-c C-m
orC-c ?
- call the CoCoA manual for this word (from any point in the word)
They will automatically start CoCoA (if it isn't already running in a *cocoa*
buffer).
M-x cocoa
- opens a buffer (called
*cocoa*
) with a running CoCoA
Installation instructions for experts
Copy the customizations and the settings you like from cocoa-4.5/emacs/cocoa.emacs into your ~/.emacs.
Installation instructions for non-experts
Following these instructions Emacs will recognise files with a CoCoA extension(.coc, .cocoa, .cpkg
): REMEMBER to add one to the name of your files!
If you used Emacs itself to change some settings you should restart Emacs. (of course you can load them without restarting Emacs, but this is the section for non-experts! ;-) )
Unix/Linux
Open your .emacs
file with any editor
(it should be in your home, and it may not exist!):
Add this line at the end of your .emacs:
(load-file "<path>/emacs/cocoa.emacs")
for example:
(load-file "/usr/local/cocoa-4.5/emacs/cocoa.emacs")
If you did not install cocoa in /usr/local/
then you need to correct the path in the files:
<path>/cocoa-4.5/emacs/cocoa.emacs
<path>/cocoa-4.5/cocoa
MacOSX
NB: MacOSX hides all file whose name start with ".", in particular .emacs.
Go to the folder emacs in CoCoA-4.5 and double-click on one of
set-new-emacs-prefs
creates a brand new .emacs file (and moves the old one, if you had one, into previous.emacs)set-add-emacs-prefs
adds one line to your current .emacs file (creating it if necessary)
MSWindows
There is a file called "_emacs" in your cocoa-4.5/emacs/ directory which contains all the cocoa-emacs settings.
You need to set your "HOME" variable to the cocoa-4.5/emacs/ directory. (supposing that the average Windows user does not use the variable "HOME" for anything else) That is where Emacs looks for its config file, i.e. _emacs. Your computer evaluates %HOME% when you log in.
To set it right click on "My Computer", click on "properties" and then on the "Advanced" tab. Then click on the button "Environment Variables". Another dialog pops up and you add HOME by pressing on "new" and filling in the appropriate values. The upper "new" sets HOME for all users and requires admin-rights, the lower "new" sets it just for the current user.