unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Sprague, Webb (OFM)" <Webb.Sprague@ofm.wa.gov>
To: "Stefan Monnier" <monnier@iro.umontreal.ca>
Cc: 6869@debbugs.gnu.org
Subject: bug#6869: Octave mode: incorrect "unbalanced block" warning
Date: Tue, 17 Aug 2010 08:44:00 -0700	[thread overview]
Message-ID: <AEABC21942B1974B82CB5B3605B8C452CED0BA@ofmmxalc712.ofm.wa.lcl> (raw)
In-Reply-To: <AEABC21942B1974B82CB5B3605B8C452CED0B8@ofmmxalc712.ofm.wa.lcl>

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
> 
> Hi Stefan.  See below...
> 
> > It's a bug in octave's indentation code, indeed.  It gets confused
by
> > the "end" in the following line:
> >
> > >   x = data(:,2:end);
> 
> Oh -- that makes sense.
> 
> >
> > 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).
> 
> There are two uses for "end" that are pretty different:
> 
>   1. Closing blocks (e.g. "if x==1 y=3 end")
> 
>   2. Indexing arrays. Here "end" is evaluated to give the length of a
> dimension in the array. For example  if x=[2 3 4 5], then x(end) == 5,
> x(end-1) == 4, etc.
> 
> 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.
> 
> Does that make sense?
> 
> 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.
> 
> Thanks so much for dealing with this!  I sort of have my hands full,
> and emacs indentation code just freaks me out ;)





  reply	other threads:[~2010-08-17 15:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16 23:35 bug#6869: Octave mode: incorrect "unbalanced block" warning Sprague, Webb (OFM)
2010-08-17  9:11 ` Stefan Monnier
2010-08-17 15:34   ` Sprague, Webb (OFM)
2010-08-17 15:44     ` Sprague, Webb (OFM) [this message]
2010-08-18 14:16     ` Stefan Monnier
2010-08-31 12:24 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AEABC21942B1974B82CB5B3605B8C452CED0BA@ofmmxalc712.ofm.wa.lcl \
    --to=webb.sprague@ofm.wa.gov \
    --cc=6869@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).