Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good Object Pascal mode for Emacs?

I've been doing some Object Pascal lately, and I've been unable to find a good mode for it. I've tried delphi-mode and pascal-mode, both of which try to help too much; when they fail to understand Object Pascal syntax, it's very difficult to force them to format the code correctly. I've been using Geany, but I miss my Emacs. Is there another Pascal mode I should try?

Edit

This is Object Pascal as implemented in Free Pascal.

like image 704
JasonFruit Avatar asked Dec 16 '10 22:12

JasonFruit


1 Answers

This is an Emacs question. From the code editor point of view, there is quite no difference between FPC in Delphi mode and Delphi.

A good one I found out (Google was our friend) is "A Pascal mode for emacs":

  1. It knows how to indent all types of Pascal statements.
  2. There are movement, killing, marking and transposing functions that know about procedure, sentence and expression.
  3. All Pascal constructs like 'begin end', 'if then else' etc. can be inserted with the help of templates. This is done by two commands 'M-p' that inserts templates and 'M-n' that move between fields in the templates.
  4. When ';' is inserted the cursor will momentarily move back to the beginning of the sentence that was ended by the ';'. If pascal-auto-newline is non-nil (default nil), ';' at the end of a line will do a 'RET' to insert and indent a new line.
like image 155
Arnaud Bouchez Avatar answered Nov 01 '22 15:11

Arnaud Bouchez