[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: octave-mode: Indentation of multi-line expressions?
From: |
Klaus-Dieter Bauer |
Subject: |
Re: octave-mode: Indentation of multi-line expressions? |
Date: |
Mon, 7 Aug 2023 16:12:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 |
For reference, I do not need that e x a c t formatting. Any reasonable
indentation will do. Only, while cleaning up project code, the default behavior
did not give useful results. For instance in the (anonymized) code sample:
for i = 1:imax
% ...
if not(load_from_file)
[p_ext,c_ext,time,origin] = calculate_coefficients(
a,long,list,of,arguments,as,existing,
in,the,code,base,followed,by,
'an expression in a string'
);
else
% ...
end
% ...
end
Recommendations on how to write the code in a way that plays more nicely with
the indentation in Emacs would help as well. For reference, Octave's
Edit > Format > Indent Code
will produce an unhelpful
[p_ext,c_ext,time,origin] = calculate_coefficients(
a,long,list,of,arguments,as,existing,
in,the,code,base,followed,by,
'an expression in a string'
);
and Matlab's "Smart Indent" will produce
[p_wbt,cond_wbt,time,source] = wbt_surfacewise_ngauss(...
name,p,e,source,ar,as,at,nu_min,d_nu,nu_max,ngauss_steps,mult,...
'savesys=0; save_and_collect=0; externalsolver=1;
mlv_source_loaded=1;'...
);
but requires explicit continuation syntax ("...").
best regards,
Klaus
On 07.08.23 15:39, Klaus wrote:
Hello!
I am looking for a way to customize octave-modesuch that it will produce
indentation like
[a, b] = function_name(
first_argument,
second_argument
);
Out of the box, except for setting `octave-block-offset` to 4 for compatibility
with existing project code, I get an indentation
[a, b] = function_name(
first_argument,
second_argument
);
which is not ideal for readability.
Best regards,
Klaus
----------------------------------------------------------------------
Emacs information:
In GNU Emacs 27.1 (build 4, x86_64-pc-linux-gnu, GTK+ Version 2.24.32)
of 2022-07-29 built on a PC named so weirdly by the admin, I censored it
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description: openSUSE Leap 15.3