Emacs delphi-mode Updated

I’ve checked in two fixes to GNU Emacs‘ delphi-mode (a major mode for editing Borland Delphi source code) that improve the way case statements are indented.

  1. Case statements are now indented correctly when the first line ends with a single-line comment, as in the example below.

    case Gender of  // A comment here used to break indentation
       'M':
          Writeln('Male');
       'F':
          Writeln('Female');
    end;
  2. Indentation now works correctly for records containing a variant part, which is defined using a case statement within the record declaration. Thanks to Guillermo R. Palavecino who reported the problem.

    type
       TEmployee = record
          LastName, FirstName: String;
          case FullTime: Boolean of
    	 True: (Salary: Currency);
    	 False: (Wage: Currency);
       end;

The changes are in Bazaar now and should be included in the next release of Emacs.

  1. Dan Smith says:

    This does fix a few issues I have with delphi mode. The record fix could use a further tweak so that ‘packed record’ also works the same way. If you’d like I’ll post an official bug /w a sample, just changing your example to packed record demonstrates the issue.. I’m using emacs 23.3 (windows build unfortunately).

    thanks for the fixes.

  1. There are no trackbacks for this post yet.