Quote:
Originally Posted by raskol
1. how do i change between programlanguages?
i mean so the editor knows how to indent. i program in Python, Java, Lisp
and Prolog.
2. can i compile any code? i mean can emacs compile and run JAVA-rpograms and LISP-programs?
or is emacs "just" an editor?
|
1. emacs knows file exensions & will choose a highlight syntax accordingly. If it doesn't figure it out, you have three options:
The easiest is "M-x <language>-mode", i.e. "M-x php-mode" or "M-x c++-mode".
A second method is to put a comment in the file that tells emacs what syntax to use, the line would look something like:
Code:
// -*- mode: c++ -*-
... I believe that has to be the first or one of the first lines in the file.
The last, more permanent way is to add an entry to your .emacs file. I don't know enough about that method to give you good instruction, but an example from my .emacs is this:
Code:
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'\\|\\.rfs\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))
Of course, all of this assumes that you have the elisp for each of the languages you're looking for.
2. I believe lisp and scheme can be run right in the emacs session (and mail too), but I don't remember how to do it as it's been a *very* long time since Ive written anything in those languages, That said, you can always open up a shell buffer, i.e. "M-x shell" which will give you a shell where you can do anything you could do in the shell.