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:thibault.ma...@gmx.com] Sent: Thursday, June 02, 2016 12:05 PM To: Eric Ludlam <eric.lud...@mathworks.com> Cc: thibault.ma...@gmx.com; matlab-emacs-discuss@lists.sourceforge.net 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:thibault.marin...@ieee.org] > Sent: Wednesday, June 01, 2016 10:10 AM > To: matlab-emacs-discuss@lists.sourceforge.net > 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? ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e _______________________________________________ Matlab-emacs-discuss mailing list Matlab-emacs-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss