From: Thibault M. <thi...@ie...> - 2016-06-01 14:10:28
Attachments:
end-indent-bug.patch
|
Hi all, I have an issue with the indentation of 'end' lines with matlab.el. It seems that the calculated indentation level does not get multiplied by the indent size resulting in blocks like: if true if true for i = 1:10 disp(1); end end end Am I the only one to experience this? The attached patch fixes it for me but I am not sure whether this is a bug or an issue with my setup. Any input would be welcome, thanks |
From: Uwe B. <ou...@ma...> - 2016-06-01 14:44:46
|
>>> "Thibault" == Thibault Marin <thi...@ie...> writes: > Hi all, Hi BTW I applied your first patch and pushed it. So this second one is already for the version with your former patch applied? Till the end of the week I have no time to look into this hopefully at the weekended. I have a faint memory of a problem with if, but right now I can't remember. regards Uwe |
From: Thibault M. <thi...@ie...> - 2016-06-01 15:18:21
|
Uwe Brauer writes: >>>> "Thibault" == Thibault Marin <thi...@ie...> writes: > > > Hi all, > > Hi > > BTW I applied your first patch and pushed it. So this second one is > already for the version with your former patch applied? > Till the end of the week I have no time to look into this hopefully at > the weekended. > > I have a faint memory of a problem with if, but right now I can't > remember. > > regards > > Uwe I did a git pull after my first patch was merged, so it should be up-to-date. Thanks for looking into it. |
From: Eric L. <Eri...@ma...> - 2016-06-02 14:59:55
|
I believe that code is using absolute positioning (ie - matched positions in the buffer) so the calculated indent ci should have the actual amount to indent baked in. I note you have TABs in your pasted output. Since matlab.el is doing character calculations, that will mess it up. Since matlab-mode sets indent-tabs-mode to nil, this shouldn't happen unless you've overridden that feature. Eric -----Original Message----- From: Thibault Marin [mailto:thi...@ie...] Sent: Wednesday, June 01, 2016 10:10 AM To: mat...@li... Subject: [Matlab-emacs-discuss] [patch] Issue with indentation of 'end' Hi all, I have an issue with the indentation of 'end' lines with matlab.el. It seems that the calculated indentation level does not get multiplied by the indent size resulting in blocks like: if true if true for i = 1:10 disp(1); end end end Am I the only one to experience this? The attached patch fixes it for me but I am not sure whether this is a bug or an issue with my setup. Any input would be welcome, thanks |
From: Thibault M. <thi...@gm...> - 2016-06-02 16:05:30
Attachments:
end-indent-tabs.patch
|
Eric Ludlam writes: > I believe that code is using absolute positioning (ie - matched positions in the buffer) so the calculated indent ci should have the actual amount to indent baked in. > > I note you have TABs in your pasted output. Since matlab.el is doing character calculations, that will mess it up. Since matlab-mode sets indent-tabs-mode to nil, this shouldn't happen unless you've overridden that feature. > > Eric > > -----Original Message----- > From: Thibault Marin [mailto:thi...@ie...] > Sent: Wednesday, June 01, 2016 10:10 AM > To: mat...@li... > Subject: [Matlab-emacs-discuss] [patch] Issue with indentation of 'end' > > > Hi all, > > I have an issue with the indentation of 'end' lines with matlab.el. It seems that the calculated indentation level does not get multiplied by the indent size resulting in blocks like: > > if true > if true > for i = 1:10 > disp(1); > end > end > end > > Am I the only one to experience this? The attached patch fixes it for me but I am not sure whether this is a bug or an issue with my setup. > > Any input would be welcome, thanks Thanks, the problem is that I am using tabs. Everything works fine when indent-tabs-mode is nil. However, I would like to use tabs if possible and indentation of the 'end' seems to be the only hurdle in supporting this. So, would a patch on the vein of the attached one be acceptable? |
From: Eric L. <Eri...@ma...> - 2016-06-02 17:52:27
|
Hi, I would guess that 'end' indentation is not really the last hurdle. For TABs to work, all places where character math occur will need to be replaced with calls to 'current-column'. Ie - instead of (- match (match-beginning 0)) You would need (- match-col (save-excursion (goto-char (match-beginning 0)) (current-column)) Current-column is used in a bunch of places already, so hopefully the number of problem areas is small. Eric -----Original Message----- From: Thibault Marin [mailto:thi...@gm...] Sent: Thursday, June 02, 2016 12:05 PM To: Eric Ludlam <Eri...@ma...> Cc: thi...@gm...; mat...@li... Subject: Re: [Matlab-emacs-discuss] [patch] Issue with indentation of 'end' Eric Ludlam writes: > I believe that code is using absolute positioning (ie - matched positions in the buffer) so the calculated indent ci should have the actual amount to indent baked in. > > I note you have TABs in your pasted output. Since matlab.el is doing character calculations, that will mess it up. Since matlab-mode sets indent-tabs-mode to nil, this shouldn't happen unless you've overridden that feature. > > Eric > > -----Original Message----- > From: Thibault Marin [mailto:thi...@ie...] > Sent: Wednesday, June 01, 2016 10:10 AM > To: mat...@li... > Subject: [Matlab-emacs-discuss] [patch] Issue with indentation of 'end' > > > Hi all, > > I have an issue with the indentation of 'end' lines with matlab.el. It seems that the calculated indentation level does not get multiplied by the indent size resulting in blocks like: > > if true > if true > for i = 1:10 > disp(1); > end > end > end > > Am I the only one to experience this? The attached patch fixes it for me but I am not sure whether this is a bug or an issue with my setup. > > Any input would be welcome, thanks Thanks, the problem is that I am using tabs. Everything works fine when indent-tabs-mode is nil. However, I would like to use tabs if possible and indentation of the 'end' seems to be the only hurdle in supporting this. So, would a patch on the vein of the attached one be acceptable? |
From: Thibault M. <thi...@gm...> - 2016-06-03 02:56:03
Attachments:
end-indent-tabs-curcol.patch
|
Eric Ludlam writes: > Hi, > > I would guess that 'end' indentation is not really the last hurdle. For TABs to work, all places where character math occur will need to be replaced with calls to 'current-column'. > > Ie - instead of > > (- match (match-beginning 0)) > > You would need > > (- match-col (save-excursion (goto-char (match-beginning 0)) (current-column)) > > Current-column is used in a bunch of places already, so hopefully the number of problem areas is small. > > Eric > Thanks for the guidance. I modified the patch to use (current-column) as advised. Could you please let me know if this is what you had in mind? I understand that there may be other places where a similar change should be done, but tabs seem to be working fine for me at this point: I haven't found any indentation problems after fixing the 'end' line. If other issues arise, I can try to have a look. |
From: Eric L. <Eri...@ma...> - 2016-06-03 12:25:11
|
Your patch looks good to me by inspection. I'm glad it is working out for you. Eric -----Original Message----- From: Thibault Marin [mailto:thi...@gm...] Sent: Thursday, June 02, 2016 10:56 PM To: Eric Ludlam <Eri...@ma...> Cc: thi...@gm...valid; mat...@li... Subject: Re: [Matlab-emacs-discuss] [patch] Issue with indentation of 'end' Eric Ludlam writes: > Hi, > > I would guess that 'end' indentation is not really the last hurdle. For TABs to work, all places where character math occur will need to be replaced with calls to 'current-column'. > > Ie - instead of > > (- match (match-beginning 0)) > > You would need > > (- match-col (save-excursion (goto-char (match-beginning 0)) > (current-column)) > > Current-column is used in a bunch of places already, so hopefully the number of problem areas is small. > > Eric > Thanks for the guidance. I modified the patch to use (current-column) as advised. Could you please let me know if this is what you had in mind? I understand that there may be other places where a similar change should be done, but tabs seem to be working fine for me at this point: I haven't found any indentation problems after fixing the 'end' line. If other issues arise, I can try to have a look. |
From: Uwe B. <ou...@ma...> - 2016-06-04 08:34:15
|
>>> "Eric" == Eric Ludlam <Eri...@ma...> writes: > Your patch looks good to me by inspection. I'm glad it is working out for you. > Eric Hi Thanks Eric for looking into that. Now that this questions seems to be settled shall I apply and commit the last patch? Uwe |
From: Thibault M. <thi...@gm...> - 2016-06-09 17:06:54
|
As far as I am concerned, the patch fixes my issue, and I think it doesn't break the old behavior, so I think it would be good if it could be merged. Please let me know if the patch needs modifications to make that happen. Thanks. Uwe Brauer writes: >>>> "Eric" == Eric Ludlam <Eri...@ma...> writes: > > > Your patch looks good to me by inspection. I'm glad it is working out for you. > > Eric > > Hi > > Thanks Eric for looking into that. Now that this questions seems to be > settled shall I apply and commit the last patch? > > Uwe |