Debugging smalltalk-mode.el

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Debugging smalltalk-mode.el

Mathieu Suen-2
Hi All,

In emacs the smalltalk-mode have a bug with the new syntax when writing a
keyword method signature.

foo: a [
        ...
]

When writing the colon you end up in a parse error:

Debugger entered--Lisp error: (scan-error "Unbalanced parentheses" 2479 2446)
  apply(debug error (scan-error "Unbalanced parentheses" 2479 2446))
  edebug(error (scan-error "Unbalanced parentheses" 2479 2446))
  signal(scan-error ("Unbalanced parentheses" 2479 2446))
  edebug-signal(scan-error ("Unbalanced parentheses" 2479 2446))
  scan-sexps(2480 -1)
  forward-sexp(-1)
  backward-sexp(1)
  smalltalk-backward-sexp(1)
  smalltalk-find-statement-begin()
  smalltalk-indent-for-colon()
  (edebug-after (edebug-before 37) 38 (smalltalk-indent-for-colon))
  (and (edebug-after 0 36 needs-indent) (edebug-after (edebug-before 37) 38
(smalltalk-indent-for-colon)))
  (edebug-after (edebug-before 35) 39 (and (edebug-after 0 36 needs-indent)
(edebug-after ... 38 ...)))
  (progn (edebug-after (edebug-before 16) 34 (save-excursion ... ...))
(edebug-after (edebug-before 35) 39 (and ... ...)))
  (edebug-after (edebug-before 15) 40 (progn (edebug-after ... 34 ...)
(edebug-after ... 39 ...)))
  (if (edebug-after (edebug-before 10) 14 (null ...)) (edebug-after
(edebug-before 15) 40 (progn ... ...)))
  (edebug-after (edebug-before 9) 41 (if (edebug-after ... 14 ...) (edebug-after
... 40 ...)))
  (let (needs-indent state (parse-sexp-ignore-comments t)) (edebug-after
(edebug-before 1) 8 (setq state ...)) (edebug-after (edebug-before 9) 41 (if ...
...)) (edebug-after (edebug-before 42) 43 (self-insert-command 1)))
  (edebug-after (edebug-before 0) 44 (let (needs-indent state ...) (edebug-after
... 8 ...) (edebug-after ... 41 ...) (edebug-after ... 43 ...)))
  (lambda nil (edebug-after (edebug-before 0) 44 (let ... ... ... ...)))()
  edebug-enter(smalltalk-colon nil (lambda nil (edebug-after (edebug-before 0)
44 (let ... ... ... ...))))
  edebug-enter(smalltalk-colon nil (lambda nil (edebug-after (edebug-before 0)
44 (let ... ... ... ...))))
  smalltalk-colon()


I think the issue is in #'smalltalk-indent-for-colon who should check if you are
being writing a method pattern or just sending a message.

I am trying to fix it but since I am not an emacs expert tell me if you have an
idea of how to fix it.

Thanks

Mathieu





_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re : [Help-smalltalk] Debugging smalltalk-mode.el

Mathieu Suen-2


> De : Mathieu Suen <[hidden email]>
>
> Hi All,
>
> In emacs the smalltalk-mode have a bug with the new syntax when  writing a
> keyword method signature.
>
> foo: a [
>          ...
> ]
>
> When writing the colon you end up in a parse  error:
>
> Debugger entered--Lisp error: (scan-error "Unbalanced parentheses"  2479 2446)
>   apply(debug error (scan-error "Unbalanced parentheses" 2479  2446))
>   edebug(error (scan-error "Unbalanced parentheses" 2479  2446))
>   signal(scan-error ("Unbalanced parentheses" 2479  2446))
>   edebug-signal(scan-error ("Unbalanced parentheses" 2479  2446))
>   scan-sexps(2480 -1)
>   forward-sexp(-1)
>    backward-sexp(1)
>   smalltalk-backward-sexp(1)
>    smalltalk-find-statement-begin()
>    smalltalk-indent-for-colon()
>   (edebug-after (edebug-before 37) 38  (smalltalk-indent-for-colon))
>   (and (edebug-after 0 36 needs-indent)  (edebug-after (edebug-before 37) 38
> (smalltalk-indent-for-colon)))
>    (edebug-after (edebug-before 35) 39 (and (edebug-after 0 36 needs-indent)
> (edebug-after ... 38 ...)))
>   (progn (edebug-after (edebug-before  16) 34 (save-excursion ... ...))
> (edebug-after (edebug-before 35) 39 (and  ... ...)))
>   (edebug-after (edebug-before 15) 40 (progn (edebug-after  ... 34 ...)
> (edebug-after ... 39 ...)))
>   (if (edebug-after  (edebug-before 10) 14 (null ...)) (edebug-after
> (edebug-before 15) 40 (progn  ... ...)))
>   (edebug-after (edebug-before 9) 41 (if (edebug-after ... 14  ...)
>(edebug-after
>
> ... 40 ...)))
>   (let (needs-indent state  (parse-sexp-ignore-comments t)) (edebug-after
> (edebug-before 1) 8 (setq  state ...)) (edebug-after (edebug-before 9) 41 (if
>...
>
> ...)) (edebug-after  (edebug-before 42) 43 (self-insert-command 1)))
>   (edebug-after  (edebug-before 0) 44 (let (needs-indent state ...)
>(edebug-after
>
> ... 8 ...)  (edebug-after ... 41 ...) (edebug-after ... 43 ...)))
>   (lambda nil  (edebug-after (edebug-before 0) 44 (let ... ... ... ...)))()
>    edebug-enter(smalltalk-colon nil (lambda nil (edebug-after (edebug-before 0)
>
> 44 (let ... ... ... ...))))
>   edebug-enter(smalltalk-colon nil  (lambda nil (edebug-after (edebug-before 0)
>
> 44 (let ... ... ...  ...))))
>   smalltalk-colon()
>
>
> I think the issue is in  #'smalltalk-indent-for-colon who should check if you
>are
>
> being writing a  method pattern or just sending a message.


In fact to reproduce the bug you need to have a method before.
For example :

----Test.st-----
Object subclass: A [
    foo: f [
    ]

      bar: e [
   ]
]
-----Test.st-----

Only the colon of the bar method will throw the error.
This is because the #'smalltalk-narrow-to-method will narrow to:

-----------------
]
     
    bar
-----------------

So we need to check before if we are in a message pattern for the new syntax.


>
> I am trying to fix it but since  I am not an emacs expert tell me if you have
>an
>
> idea of how to fix  it.
>
> Thanks
>
> Mathieu
>
>
>
>
>
> _______________________________________________
> help-smalltalk  mailing list
> [hidden email]
> http://lists.gnu.org/mailman/listinfo/help-smalltalk
>




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Re : [Help-smalltalk] Debugging smalltalk-mode.el

Paolo Bonzini-2
On 07/23/2010 02:24 PM, Mathieu Suen wrote:
> This is because the #'smalltalk-narrow-to-method will narrow to:
>
> -----------------
> ]
>
>      bar
> -----------------
>
> So we need to check before if we are in a message pattern for the new syntax.

Or maybe the narrowing is wrong.  I'll look at it in the next few days
if you don't beat me...

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re : Re : [Help-smalltalk] Debugging smalltalk-mode.el

Mathieu Suen-2
----- Message d'origine ----

> De : Paolo Bonzini <[hidden email]>
> Envoyé le : Ven 23 juillet 2010, 14h 43min 16s
> Objet : Re: Re : [Help-smalltalk] Debugging smalltalk-mode.el
>
> On 07/23/2010 02:24 PM, Mathieu Suen wrote:
> > This is because the  #'smalltalk-narrow-to-method will narrow to:
> >
> >  -----------------
> > ]
> >
> >      bar
> >  -----------------
> >
> > So we need to check before if we are in a  message pattern for the new
>syntax.
>
> Or maybe the narrowing is  wrong.  I'll look at it in the next few days
> if you don't beat  me...
>
> Paolo
>

:)

The narrowing function is using  smalltalk-scope-begin-of-defun.
What is the purpose of  smalltalk-scope-begin-of-defun?

Is it to move point at the beginning of the message patern ?

Thanks

--Mathieu





_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Re : Re : [Help-smalltalk] Debugging smalltalk-mode.el

Paolo Bonzini-2
>>> This is because the  #'smalltalk-narrow-to-method will narrow to:
>>>
>>>   -----------------
>>> ]
>>>
>>>       bar
>>>   -----------------
>>>
>>> So we need to check before if we are in a  message pattern for the new
>> syntax.
>>
>> Or maybe the narrowing is  wrong.  I'll look at it in the next few days
>> if you don't beat  me...
>>
>> Paolo
>
> The narrowing function is using  smalltalk-scope-begin-of-defun.
> What is the purpose of  smalltalk-scope-begin-of-defun?
>
> Is it to move point at the beginning of the message patern ?

Yes.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re : Re : Re : [Help-smalltalk] Debugging smalltalk-mode.el

Mathieu Suen-2
Hi Paolo

I manage to fix the bug.
See the attached file.

You can also take it from my github repository:
git://github.com/mathk/smalltalk.git

Let me know if that is ok.

Thanks



> De : Paolo Bonzini <[hidden email]>
>
> >>> This is because the  #'smalltalk-narrow-to-method will narrow  to:
> >>>
> >>>   -----------------
> >>>  ]
> >>>
> >>>       bar
> >>>    -----------------
> >>>
> >>> So we need to check before if  we are in a  message pattern for the new
> >>  syntax.
> >>
> >> Or maybe the narrowing is  wrong.   I'll look at it in the next few days
> >> if you don't beat   me...
> >>
> >> Paolo
> >
> > The narrowing function is  using  smalltalk-scope-begin-of-defun.
> > What is the purpose of   smalltalk-scope-begin-of-defun?
> >
> > Is it to move point at the  beginning of the message patern ?
>
> Yes.
>
> Paolo
>


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

fix-smalltalk-mode.patch (948 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re : Re : Re : [Help-smalltalk] Debugging smalltalk-mode.el

Paolo Bonzini-2
On 07/29/2010 10:42 AM, Mathieu Suen wrote:
> Hi Paolo
>
> I manage to fix the bug.
> See the attached file.
>
> You can also take it from my github repository:
> git://github.com/mathk/smalltalk.git
>
> Let me know if that is ok.

Applied, thanks.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk