bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#259: marked as done (delphi-mode does not properly format interface


From: Emacs bug Tracking System
Subject: bug#259: marked as done (delphi-mode does not properly format interface definitions)
Date: Mon, 1 Sep 2008 10:35:07 -0700

Your message dated Mon, 01 Sep 2008 13:28:04 -0400
with message-id <8763pf6ajf.fsf@cyd.mit.edu>
and subject line Re: Delphi mode
has caused the Emacs bug report #259,
regarding delphi-mode does not properly format interface definitions
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
259: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=259
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems
--- Begin Message --- Subject: delphi-mode does not properly format interface definitions Date: Fri, 16 May 2008 12:16:00 -0400 User-agent: Thunderbird 2.0.0.14 (Windows/20080421)
delphi-mode doesn't properly indent interface definition, things like
this:

type
  IHelloWorld = interface(IInvokable)
    ['{D613A992-AB12-0978-80D1-02B40DF72551}']
    function HelloWorld: String; stdcall;
  end;

This is because it doesn't distinguish between the "interface" keyword
used as a unit separator (i.e., as opposed to "implementation") and
used like a class declaration, as above.

As a result, delphi-mode will incorrectly indent the above code this
way:

type
  IHelloWorld = interface(IInvokable)
['{D613A992-AB12-0978-80D1-02B40DF72551}']
function HelloWorld: String; stdcall;
end;

I've taken a stab at updating delphi.el to distinguish between these
cases and support "dispinterface" properly as well (patch below) but I
don't understand the existing code well enough yet to finish it.  (I
suspect more changes need to be made to the delphi-enclosing-indent-of
function.)  Perhaps someone more familiar with this sort of thing
could help me complete it?

In GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600)
 of 2007-06-02 on RELEASE
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/gnuwin32/include'

*** delphi.el.orig      Thu May 15 17:57:29 2008
--- delphi.el   Fri May 16 12:07:37 2008
***************
*** 262,271 ****
  (defconst delphi-decl-sections '(type const var label resourcestring)
    "Denotes the start of a declaration section.")

  (defconst delphi-class-types '(class object)
    "Class types.")

! (defconst delphi-composite-types `(,@delphi-class-types record)
    "Types that contain declarations within them.")

  (defconst delphi-unit-sections
--- 262,275 ----
  (defconst delphi-decl-sections '(type const var label resourcestring)
    "Denotes the start of a declaration section.")

+ (defconst delphi-interface-types '(dispinterface interface)
+   "Interface types.")
+
  (defconst delphi-class-types '(class object)
    "Class types.")

! (defconst delphi-composite-types
!   `(,@delphi-class-types ,@delphi-interface-types record)
    "Types that contain declarations within them.")

  (defconst delphi-unit-sections
***************
*** 859,866 ****
        (delphi-stmt-line-indent-of token delphi-indent-level))))

  (defun delphi-composite-type-start (token last-token)
! ;; Returns true (actually the last-token) if the pair equals (= class) or (=
!   ;; record), and nil otherwise.
    (if (and (eq 'equals (delphi-token-kind token))
(delphi-is (delphi-token-kind last-token) delphi-composite-types))
        last-token))
--- 863,870 ----
        (delphi-stmt-line-indent-of token delphi-indent-level))))

  (defun delphi-composite-type-start (token last-token)
! ;; Returns true (actually the last-token) if the pair equals (= class), (=
!   ;; interface), or (= record), and nil otherwise.
    (if (and (eq 'equals (delphi-token-kind token))
(delphi-is (delphi-token-kind last-token) delphi-composite-types))
        last-token))
***************
*** 1252,1258 ****
            (throw 'done (delphi-line-indent-of token 0)))

           ;; Unit statements mean we indent right to the left.
!          ((delphi-is token-kind delphi-unit-statements) (throw 'done 0))
           )
          (unless (delphi-is token-kind delphi-whitespace)
             (setq last-token token))
--- 1256,1264 ----
            (throw 'done (delphi-line-indent-of token 0)))

           ;; Unit statements mean we indent right to the left.
!          ((and (delphi-is token-kind delphi-unit-statements)
!                (not (delphi-composite-type-start token last-token)))
!           (throw 'done 0))
           )
          (unless (delphi-is token-kind delphi-whitespace)
             (setq last-token token))
***************
*** 1351,1357 ****
                                           delphi-indent-level)))

           ;; In unit sections we indent right to the left.
!          ((delphi-is token-kind delphi-unit-sections) (throw 'done 0))

           ;; A previous terminator means we can stop.
           ((delphi-is token-kind delphi-previous-terminators)
--- 1357,1365 ----
                                           delphi-indent-level)))

           ;; In unit sections we indent right to the left.
!          ((and (delphi-is token-kind delphi-unit-sections)
!                (not (delphi-is token-kind delphi-interface-types)))
!           (throw 'done 0))

           ;; A previous terminator means we can stop.
           ((delphi-is token-kind delphi-previous-terminators)
***************
*** 1457,1463 ****
                     ;; Indent to the matching start ( or [.
                     (delphi-indent-of (delphi-group-start token)))

!                   ((delphi-is token-kind delphi-unit-statements) 0)

                    ((delphi-is token-kind delphi-comments)
                     ;; In a comment.
--- 1465,1475 ----
                     ;; Indent to the matching start ( or [.
                     (delphi-indent-of (delphi-group-start token)))

!                   ((and (delphi-is token-kind delphi-unit-statements)
!                         (not
!                          (delphi-is token-kind delphi-interface-types)))
!                         1)
!                    0)

                    ((delphi-is token-kind delphi-comments)
                     ;; In a comment.





--- End Message ---
--- Begin Message --- Subject: Re: Delphi mode Date: Mon, 01 Sep 2008 13:28:04 -0400 User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2.91 (gnu/linux)
Simon South <ssouth@slowcomputing.org> writes:

> Chong Yidong wrote:
>> I didn't receive a reply from you previously, so maybe it got lost.
>> Your copyright assignment for Emacs changes has arrived; could you send
>> me the updated patch to delphi mode, so that I can check it into CVS?
>
> Very sorry Chong, this slipped off my radar the first time
> around. Here's the patch, against the source in CVS this morning.

Checked in.  Thanks.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]