From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sprague, Webb (OFM)" Newsgroups: gmane.emacs.bugs Subject: bug#6869: Octave mode: incorrect "unbalanced block" warning Date: Tue, 17 Aug 2010 08:44:00 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1282063145 2788 80.91.229.12 (17 Aug 2010 16:39:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 17 Aug 2010 16:39:05 +0000 (UTC) Cc: 6869@debbugs.gnu.org To: "Stefan Monnier" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 17 18:39:02 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OlPBj-0002XA-V5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Aug 2010 18:39:00 +0200 Original-Received: from localhost ([127.0.0.1]:39131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OlPBj-00071K-7y for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Aug 2010 12:38:59 -0400 Original-Received: from [140.186.70.92] (port=44693 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OlPBe-00071F-9D for bug-gnu-emacs@gnu.org; Tue, 17 Aug 2010 12:38:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OlPBd-0005tf-6E for bug-gnu-emacs@gnu.org; Tue, 17 Aug 2010 12:38:54 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57301) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OlPBd-0005tV-2Y for bug-gnu-emacs@gnu.org; Tue, 17 Aug 2010 12:38:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OlOwI-0006ef-BA; Tue, 17 Aug 2010 12:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Sprague, Webb (OFM)" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Aug 2010 16:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6869 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6869-submit@debbugs.gnu.org id=B6869.128206214025562 (code B ref 6869); Tue, 17 Aug 2010 16:23:02 +0000 Original-Received: (at 6869) by debbugs.gnu.org; 17 Aug 2010 16:22:20 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OlOvc-0006eC-3I for submit@debbugs.gnu.org; Tue, 17 Aug 2010 12:22:20 -0400 Original-Received: from ofmmxalc712.ofm.wa.gov ([198.238.39.33] helo=ofmmxalc712.ofm.wa.lcl) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OlOJY-0006Mb-9D for 6869@debbugs.gnu.org; Tue, 17 Aug 2010 11:43:00 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: bug#6869: Octave mode: incorrect "unbalanced block" warning Thread-Index: Acs97DXPbEQ9FOE5QMe2Xrv87/mSJgANBxsQAACfkPA= X-Mailman-Approved-At: Tue, 17 Aug 2010 12:22:18 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 17 Aug 2010 12:23:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:39575 Archived-At: There is another nuance -- Matlab uses "end" for closing blocks only, while Octave allows "endxxx" where xxx signifies the opening ("endif", "endfunction" etc). Octave also allows the plain "end" for blocks. > -----Original Message----- > From: Sprague, Webb (OFM) > Sent: Tuesday, August 17, 2010 8:35 AM > To: 'Stefan Monnier' > Cc: 6869@debbugs.gnu.org > Subject: RE: bug#6869: Octave mode: incorrect "unbalanced block" > warning >=20 > Hi Stefan. See below... >=20 > > It's a bug in octave's indentation code, indeed. It gets confused by > > the "end" in the following line: > > > > > x =3D data(:,2:end); >=20 > Oh -- that makes sense. >=20 > > > > I don't know Octave much, as it so happens but I've recently been > > playing with a new indentation code for Octave (using SMIE), so I'm > > interested in fixing it. Could you explain to me what is this "end" > > (and more generally what the "data(:,2:end)" means: all I can guess > is > > that it's an array indexing of some sort). >=20 > There are two uses for "end" that are pretty different: >=20 > 1. Closing blocks (e.g. "if x=3D=3D1 y=3D3 end") >=20 > 2. Indexing arrays. Here "end" is evaluated to give the length of a > dimension in the array. For example if x=3D[2 3 4 5], then x(end) = =3D=3D 5, > x(end-1) =3D=3D 4, etc. >=20 > Note that ":" means all elements when evaluated as an index, and "x:y" > gives the vector of elements between x and y, and "3:end" means [3 4 5 > ... end] where end is the max index. So, "data(:,2:end)" means all the > rows of data (the first ":") and the columns from 2 to the end. >=20 > Does that make sense? >=20 > If you really want to learn octave and don't have much experience with > matlab I would suggest Attaway's book on matlab. Octave tracks it > pretty closely. >=20 > Thanks so much for dealing with this! I sort of have my hands full, > and emacs indentation code just freaks me out ;)