all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* recognizing "end" correctly in Octave mode
@ 2006-11-29 12:05 Nicolas Neuss
  2006-12-01  7:27 ` Dieter Wilhelm
       [not found] ` <mailman.1389.1164958064.2155.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Nicolas Neuss @ 2006-11-29 12:05 UTC (permalink / raw)


Hello,

Octave (which is similar to Matlab) allows both "end" and "end<op>" for
teminating constructs, e.g. I can write both "if ... endif" and "if
... end".  However, Octave mode does not recognize the "if ... end"
construct correctly (i.e. indentation is wrong).  Is it possible to change
this behaviour?

Thanks, Nicolas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: recognizing "end" correctly in Octave mode
  2006-11-29 12:05 recognizing "end" correctly in Octave mode Nicolas Neuss
@ 2006-12-01  7:27 ` Dieter Wilhelm
       [not found] ` <mailman.1389.1164958064.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Dieter Wilhelm @ 2006-12-01  7:27 UTC (permalink / raw)
  Cc: help-gnu-emacs

Nicolas Neuss <lastname@mathematik.uni-karlsruhe.de> writes:

> Hello,
>
> Octave (which is similar to Matlab) allows both "end" and "end<op>" for
> teminating constructs, e.g. I can write both "if ... endif" and "if
> ... end".  However, Octave mode does not recognize the "if ... end"
> construct correctly (i.e. indentation is wrong).  Is it possible to change
> this behaviour?

Yes, you could change the end keywords in the variable below:

(defvar octave-end-keywords
  '("end" "endfor" "endfunction" "endif" "endswitch" "end_try_catch"
    "end_unwind_protect" "endwhile"))

but according to this variable "end" is already a valid end-keyword.
Are you sure it doesn't work properly for "if ... end"?  Then there
might be a bug in the -calculate-indent function.

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: recognizing "end" correctly in Octave mode
       [not found] ` <mailman.1389.1164958064.2155.help-gnu-emacs@gnu.org>
@ 2006-12-01  9:47   ` Nicolas Neuss
  2006-12-01 17:32     ` Markus Triska
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Neuss @ 2006-12-01  9:47 UTC (permalink / raw)


Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:

> Yes, you could change the end keywords in the variable below:
> 
> (defvar octave-end-keywords
>   '("end" "endfor" "endfunction" "endif" "endswitch" "end_try_catch"
>     "end_unwind_protect" "endwhile"))
> 
> but according to this variable "end" is already a valid end-keyword.
> Are you sure it doesn't work properly for "if ... end"?  Then there
> might be a bug in the -calculate-indent function.

Hmm, for me "end" was not included in this list (Emacs 21.4.1, Debian).
Unfortunately, including it does still not help.

This is how Octave mode wants to indent:

function A = LR3 (A0)
  A=A0;
  m=rows(A); n=columns(A);
  for i=1:min(m,n)
    A(i+1:m,i)=A(i+1:m,i)/A(i,i);
    A(i+1:m,i+1:n) = A(i+1:m,i+1:n)-A(i+1:m,i)*A(i,i+1:n);
    end
    end

Thank you, Nicolas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: recognizing "end" correctly in Octave mode
  2006-12-01  9:47   ` Nicolas Neuss
@ 2006-12-01 17:32     ` Markus Triska
  2006-12-01 20:10       ` Dieter Wilhelm
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Triska @ 2006-12-01 17:32 UTC (permalink / raw)


Nicolas Neuss <lastname@mathematik.uni-karlsruhe.de> writes:

> This is how Octave mode wants to indent:
>
> function A = LR3 (A0)
>   A=A0;
>   m=rows(A); n=columns(A);
>   for i=1:min(m,n)
>     A(i+1:m,i)=A(i+1:m,i)/A(i,i);
>     A(i+1:m,i+1:n) = A(i+1:m,i+1:n)-A(i+1:m,i)*A(i,i+1:n);
>     end
>     end

indent-region on this gives:

function A = LR3 (A0)
  A=A0;
  m=rows(A); n=columns(A);
  for i=1:min(m,n)
    A(i+1:m,i)=A(i+1:m,i)/A(i,i);
    A(i+1:m,i+1:n) = A(i+1:m,i+1:n)-A(i+1:m,i)*A(i,i+1:n);
  end
end

in GNU Emacs 22.0.90.10.

All the best,
Markus Triska

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: recognizing "end" correctly in Octave mode
  2006-12-01 17:32     ` Markus Triska
@ 2006-12-01 20:10       ` Dieter Wilhelm
  0 siblings, 0 replies; 5+ messages in thread
From: Dieter Wilhelm @ 2006-12-01 20:10 UTC (permalink / raw)
  Cc: help-gnu-emacs

Markus Triska <triska@gmx.at> writes:

> Nicolas Neuss <lastname@mathematik.uni-karlsruhe.de> writes:
>
>> This is how Octave mode wants to indent:
>>
>> function A = LR3 (A0)
>>   A=A0;
>>   m=rows(A); n=columns(A);

...

>   for i=1:min(m,n)
>     A(i+1:m,i)=A(i+1:m,i)/A(i,i);
>     A(i+1:m,i+1:n) = A(i+1:m,i+1:n)-A(i+1:m,i)*A(i,i+1:n);
>   end
> end
>
> in GNU Emacs 22.0.90.10.
>

Yes thanks, forgot to mention that I had (as hopefully everybody on
this list Emacs 22), I'm sorry Nicolas, by the way, have you heard
about Emacs Calc, the great calculator mode in Emacs 22?  Might be
interesting for you.

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-12-01 20:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-29 12:05 recognizing "end" correctly in Octave mode Nicolas Neuss
2006-12-01  7:27 ` Dieter Wilhelm
     [not found] ` <mailman.1389.1164958064.2155.help-gnu-emacs@gnu.org>
2006-12-01  9:47   ` Nicolas Neuss
2006-12-01 17:32     ` Markus Triska
2006-12-01 20:10       ` Dieter Wilhelm

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.