Difference between revisions of "CoCoA:Emacs interface"

From CoCoAWiki
(slowly updating ("go to parse error line"))
(added installation instruction)
Line 15: Line 15:
 
* go to the parse error line (if you had a parse error after sending a file)  
 
* go to the parse error line (if you had a parse error after sending a file)  
 
* start or restart the CoCoAServer
 
* start or restart the CoCoAServer
 +
 +
<code>Use TAB for Completion</code> (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 ===
 
=== Some key bindings in cocoa-mode ===
Line 35: Line 37:
 
   
 
   
 
; <code>M-x cocoa</code> : opens a buffer (called <code>*cocoa*</code>) with a running CoCoA
 
; <code>M-x cocoa</code> : opens a buffer (called <code>*cocoa*</code>) with a running CoCoA
 +
 +
 +
== Installation instructions for Unix/Linux ==
 +
 +
Open your <code>.emacs</code> file with any editor 
 +
(it should be in your home, and it may not exist!):
 +
 +
* If you are familiar about changing    your '''.emacs''', then copy the settings you want from  <code>cocoa-4.5/emacs/cocoa.emacs</code>.
 +
 +
* If you are not then just add this line at the end  of your '''.emacs''':<br> <code>(load-file "&lt;path&gt;/emacs/cocoa.emacs")</code> <br> for example: <code>(load-file "/usr/local/cocoa-4.5/emacs/cocoa.emacs")</code>
 +
 +
If you did not install cocoa in <code>/usr/local/</code>
 +
then you need to correct the path in the files:
 +
* <code>&lt;path&gt;/cocoa-4.5/emacs/cocoa.emacs</code>
 +
* <code>&lt;path&gt;/cocoa-4.5/cocoa</code>
 +
 +
 +
== Installation instructions for MacOSX ==
 +
 +
NB: MacOSX hides all file whose name start with "."
 +
 +
'''For Emacs experts:''' copy the settings you want from CoCoA-4.5/emacs/cocoa.emacs into your ~/.emacs.
 +
 +
'''For everyone else:''' go to the folder '''emacs''' in <b>CoCoA-4.5</b> and double-click on one of
 +
* <code>set-new-emacs-prefs</code> creates a brand new '''.emacs'''  file (and moves the old one, if you had one, into previous.emacs)
 +
* <code>set-add-emacs-prefs</code> adds one line to your current <b>.emacs</b> file (creating it if necessary)
 +
 +
 +
ALL SET!! Now Emacs recognises files with a CoCoA  extension (<code>.coc, .cocoa, .cpkg</code>): REMEMBER to add one to  the name of your files!
 +
 +
== Installation instructions for MSWindows ==
 +
 +
There is a file called "_emacs" in your cocoa-4.5/emacs directory.
 +
Move it up one directory, i.e. into cocoa-4.5
 +
 +
After this you should make sure that your "HOME" variable is set to the cocoa-4.5 directory. (supposing that the average Windows user does not use the variable "HOME" for anything else)
 +
 +
Emacs just evaluates %HOME% when looking for its config file, i.e. _emacs. 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.
 +
  
 
[[Category:CoCoA4]]
 
[[Category:CoCoA4]]

Revision as of 17:06, 9 November 2005

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-/ or ESC / or TAB /)

CoCoA menu

CoCoA menu for cocoa-mode

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 or C-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 Unix/Linux

Open your .emacs file with any editor (it should be in your home, and it may not exist!):

  • If you are familiar about changing your .emacs, then copy the settings you want from cocoa-4.5/emacs/cocoa.emacs.
  • If you are not then just 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


Installation instructions for MacOSX

NB: MacOSX hides all file whose name start with "."

For Emacs experts: copy the settings you want from CoCoA-4.5/emacs/cocoa.emacs into your ~/.emacs.

For everyone else: 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)


ALL SET!! Now Emacs recognises files with a CoCoA extension (.coc, .cocoa, .cpkg): REMEMBER to add one to the name of your files!

Installation instructions for MSWindows

There is a file called "_emacs" in your cocoa-4.5/emacs directory. Move it up one directory, i.e. into cocoa-4.5

After this you should make sure that your "HOME" variable is set to the cocoa-4.5 directory. (supposing that the average Windows user does not use the variable "HOME" for anything else)

Emacs just evaluates %HOME% when looking for its config file, i.e. _emacs. 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.