Difference between revisions of "CoCoA:Emacs interface"

From ApCoCoAWiki
(slowly updating ("go to parse error line"))
m (Emacs interface moved to CoCoA:Emacs interface: tidying up the wiki.)
 
(3 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
* coloured syntax (in font-lock-mode - default)   
 
* coloured syntax (in font-lock-mode - default)   
 
* capitalization of keywords (in abbrev-mode - default)   
 
* capitalization of keywords (in abbrev-mode - default)   
* automatic loading of <code>wordlist.txt</code> for dynamic abbrev expansion  (<code>M-/</code> or <code>ESC /</code> or <code>TAB /</code>)   
+
* automatic loading of <code>wordlist.txt</code> for dynamic abbrev expansion  (<code>M-/</code> or <code>TAB</code>)   
  
 
=== CoCoA menu ===  
 
=== CoCoA menu ===  
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 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(<code>.coc, .cocoa, .cpkg</code>): 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 <code>.emacs</code> file with any editor 
 +
(it should be in your home, and it may not exist!):
 +
 +
Add this line at the end  of your '''.emacs''':<br> <code>(load-file "&lt;path&gt;/emacs/cocoa.emacs")</code>
 +
 +
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>
 +
 +
=== MacOSX ===
 +
 +
NB: MacOSX hides all file whose name start with ".", in particular '''.emacs'''.
 +
 +
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)
 +
 +
=== 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.
 +
  
 
[[Category:CoCoA4]]
 
[[Category:CoCoA4]]

Latest revision as of 16:23, 14 October 2007

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 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 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.