c*-mode-agnostic basic-offset value
JD Smith <[email protected]> Tue, 2 Jul 2024 11:32:45 -0400
| Newsgroups | gmane.emacs.cc-mode.general |
|---|---|
| Message-ID | <[email protected]> |
--===============5113061634883184175==
Content-Type: multipart/alternative;
boundary="Apple-Mail=_C2ED3306-3892-41CC-BBE6-F830BC6E8C50"
--Apple-Mail=_C2ED3306-3892-41CC-BBE6-F830BC6E8C50
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
I am the author of indent-bars[1], a mode providing indentation bars =
across modes. For its operation, indent-bars requires knowledge of the =
indentation offset, and uses a heuristic to discover that information. =20=
For c-modes it currently does a simple (in a large cond):
((and (local-variable-p 'c-basic-offset) (numberp c-basic-offset))
c-basic-offset)
But that fails to gather the needed information for various =
auto-configuration examples like 'set-from-style. Can anyone recommend =
a simple configuration that will work reliably across all the various =
c*-modes and their various style options? Indent-bars just needs to =
know the indent multiple (2 chars, 4 chars, 8 chars???). This code runs =
in a hook like prog-mode-hook (or equivalent mode-specific hooks) so =
initialization should already be done.
Thanks for the help.
[1] https://github.com/jdtsmith/indent-bars=
--Apple-Mail=_C2ED3306-3892-41CC-BBE6-F830BC6E8C50
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=us-ascii
<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><div><br></div><div>I am the author of =
indent-bars[1], a mode providing indentation bars across modes. =
For its operation, indent-bars requires knowledge of the =
indentation offset, and uses a heuristic to discover that information. =
</div><div><br></div><div>For c-modes it currently does a simple =
(in a large cond):</div><div><br></div><div><div>((and (local-variable-p =
'c-basic-offset) (numberp c-basic-offset))</div><div> =
c-basic-offset)</div></div><div><br></div><div>But that fails to gather =
the needed information for various auto-configuration examples like =
'set-from-style. Can anyone recommend a simple configuration that =
will work reliably across all the various c*-modes and their various =
style options? Indent-bars just needs to know the indent multiple =
(2 chars, 4 chars, 8 chars???). This code runs in a hook like =
prog-mode-hook (or equivalent mode-specific hooks) so initialization =
should already be done.</div><div><br></div><div>Thanks for the =
help.</div><div><br></div><div>[1] <a =
href=3D"https://github.com/jdtsmith/indent-bars">https://github.com/jdtsmi=
th/indent-bars</a></div></body></html>=
--Apple-Mail=_C2ED3306-3892-41CC-BBE6-F830BC6E8C50--
--===============5113061634883184175==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============5113061634883184175==--