emacs-devel
[Top][All Lists]
Advanced

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

Re: How to run indent command in arbitrary buffer while respecting user


From: Ihor Radchenko
Subject: Re: How to run indent command in arbitrary buffer while respecting user settings?
Date: Fri, 30 Jun 2023 11:51:04 +0000

Tassilo Horn <tsdh@gnu.org> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> Is there any reliable way to perform indentation in an arbitrary major
>> mode programmatically?
>
> Does `indent-region' do the right thing?  That honors
> `indent-region-function' if set (which it is also in cc-modes) or use
> `indent-according-to-mode' (which uses `indent-line-function')?

Thanks!
I completely forgot about `indent-according-to-mode'.

Although note that `c-indent-line-or-region' will behave differently
from `indent-according-to-mode'.

And what is the purpose of `indent-line-ignored-functions'? It is not
very well documented.  The only explanation is in the docstring of
`indent-according-to-mode', which is not very enlightening:

    However, if the value of that
    variable is present in the `indent-line-ignored-functions' variable,
    handle it specially (since those functions are used for tabbing);
    in that case, indent by aligning to the previous non-blank line.

what is "tabbing" in the above?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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