octave-maintainers
[Top][All Lists]
Advanced

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

Re: Indentation of current line or selected blocks in the code editor?


From: siko1056
Subject: Re: Indentation of current line or selected blocks in the code editor?
Date: Tue, 7 Nov 2017 16:13:22 -0700 (MST)

John W. Eaton wrote
> I'm looking for something that will indent the code according to syntax, 
> so that the bodies of loops and conditionals will be neatly aligned 
> automatically, as a pretty printer would.

Regarding this, I once stumbled about the `tree_print_code` class [1], used
in `__get_cmdline_fcn_txt__` [2], used in `type.m`.

It does pretty printing of command line functions, for example:

>> % Ugly one line function with preceding comment
>> function y = f(x); y = x; endfunction;
>> type f
f is the command-line function:

## Ugly one line function with preceding comment

function y = f (x)
  y = x;
endfunction

The code of [1] looks pretty much like doing this, even with indention.  I
don't know where this class is used/was used for.  But as you see, the
original code was not preserved, thus I did not investigate further.

Kai

[1]:
https://hg.savannah.gnu.org/hgweb/octave/file/014f47089682/libinterp/parse-tree/pt-pr-code.h#l42
[2]:
https://hg.savannah.gnu.org/hgweb/octave/file/014f47089682/libinterp/corefcn/symtab.cc#l2058



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-Maintainers-f1638794.html



reply via email to

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