all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Simon South <ssouth@slowcomputing.org>
To: 259@emacsbugs.donarmstrong.com
Subject: bug#259: delphi-mode does not properly format interface definitions
Date: Thu, 22 May 2008 11:17:45 -0400	[thread overview]
Message-ID: <48358E99.4010001@slowcomputing.org> (raw)
In-Reply-To: <jwvabilt48l.fsf-monnier+emacsbugreports@gnu.org>

Stefan Monnier wrote:
> Can someone confirm whether this patch does the right thing?

It doesn't.  I've pasted a short program listing below to test with. 
The patch I submitted will make delphi-mode indent the definition of 
TestInterface correctly, except that *everything* between the first 
instance of "interface" and "implementation" is indented one tab space 
too far to the right.

The solution will be to have delphi-mode identify "interface", on its 
own, as a unit section, and "= interface" as the start of an interface 
definition.  My patch makes the function "delphi-composite-type-start" 
identify "= interface" as a composite type, so that's part of it done. 
However, this seems to get overridden in delphi-enclosing-indent-of: As 
I understand it, as the function parses the line it first identifies "= 
interface" as a composite type and sets the indentation properly, but 
then later parses "interface" again on its own and cancels the 
indentation.  (My patch makes the function ignore "interface" the second 
time so the indentation never gets cancelled, but then that triggers the 
problem illustrated by the code sample below.)

The fix may be as simple as making delphi-enclosing-indent-of interpret 
"interface" as a unit section only if an equals sign wasn't previously 
parsed, especially as there already seems to be some logic to do this 
(see how the "equals-encountered" variable is used).  But my LISPmanship 
is poor and I couldn't get this to work myself.

I'll take another stab at it this weekend, but if someone monitoring 
this list has experience with programming modes and is looking for an 
easy enhancement to make, this could be it...

---

{ Sample unit for testing emacs bug #259, "delphi-mode does not
   properly format interface definitions.  This shows the correct
   indentation. }
unit TestIndentation;

interface

function TestFunction: String;

type
   TestInterface = interface
     function TestInterfaceFunction: String;
   end;

implementation

function TestFunction: String;
begin
   Result := 'Test Function Output';
end;

end.

-- 
Simon South
ssouth@slowcomputing.org






  reply	other threads:[~2008-05-22 15:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8763pf6ajf.fsf@cyd.mit.edu>
2008-05-16 16:16 ` bug#259: delphi-mode does not properly format interface definitions Simon South
2008-05-16 16:33   ` bug#260: " Simon South
2008-05-18  4:20     ` bug#260: marked as done (delphi-mode does not properly format interface definitions) Emacs bug Tracking System
2008-05-16 17:57   ` bug#259: delphi-mode does not properly format interface definitions Simon South
2008-05-20 15:02     ` Stefan Monnier
2008-05-22 15:17       ` Simon South [this message]
2008-05-22 21:55         ` martin rudalics
2008-05-23  8:25         ` Simon South
2008-05-25 11:48           ` Stefan Monnier
2008-09-01 17:35   ` bug#259: marked as done (delphi-mode does not properly format interface definitions) Emacs bug Tracking System

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48358E99.4010001@slowcomputing.org \
    --to=ssouth@slowcomputing.org \
    --cc=259@emacsbugs.donarmstrong.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.