[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'end' odds & ends

From: Quentin Spencer
Subject: Re: 'end' odds & ends
Date: Thu, 10 Feb 2005 12:57:00 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041127)

address@hidden wrote:

address@hidden wrote:

| Now, the second detail about 'end'.  The emacs lisp file doesn't
| recognize 'end' except as the end of a conditional or loop.
| it claims a mismatch and loses track of indentation.  (I know zilch
| about Lisp.)  Anyone familiar with Lisp know if this is an easy fix?
| might there be something tricky about it?

Yes, it is somewhat tricky to decide whether end is being used inside
an index expression.  What rule would you use (need not be stated in
Lisp)?  Once you've decided that, the fix is to either modify
octave-block-end-regexp appropriately, or, if the rule can't be stated
in a regexp, to replace occurrences of

(looking-at octave-block-end-regexp)

with the function that can determine whether we are looking at the end
of a block and that is not confused by other uses of "end".

Yes, but can't the meaning be discerned from the fact that "end" used as
an index always has a round parentheses about it?  Parentheses around an
end wouldn't be valid when "end" means end of a loop or conditional.


It doesn't necessarily. I have used the following to extract the first
and last elements from a vector:
Or, suppose you wanted to do a cylic shift of a vector:
So, there are a lot of exceptions you could cook up ...

Well, I'd argue that both those examples you gave have round parentheses
around the "end" statements.  Analogous to "if", as opposed to "if and
only if", I'm not requiring there be nothing else inside of those round
parentheses.  Expanding the definition, can you now think of a case where
"end" used as an index will not have parentheses around it?

OK, good point. Anyway, because I came to Octave from Matlab, I have been using a Matlab-based emacs mode for years and never really tried the octave version (I tend to avoid octave-specific features such as # for comments anyway). It seems to correctly detect the context of 'end' for me, including the special cases John just pointed out. I just looked at the file and discovered that it is GPL liscensed, and the latest version can be downloaded from

So, we could use this as a source for this and any other nifty features we want. Unfortunately, I'm also not a Lisp expert, so I'm not volunteering.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]