Re: Format inline code

Alejandro Colomar
2020-11-12T21:17:39Z

Hi Michael,

After the discovery I made today (See thread '.RS':
https://lore.kernel.org/linux-man/eaee2c6e-cbb7-94b2-f6c4-9039d184e129@gmail.com/T/),

[.RS 4/.RE] is not an option.
It simply doesn't work in some contexts.

I propose using the same as before:

[[
.in +4n
.EX
// Code
.EE
.in
]]

There are some cases using [.nf/.fi] instead of [.EX/.EE].
I would replace those by [.EX/.EE].

However, I would still do the change [.IP] -> [(.RS + .PP)/.RE],
so almost always you'll have [.PP] surrounding code examples,
and you'll only see [.IP] when it is really needed:
in cases where you use its argument ([.IP * n]).
In those cases, you should also use [.IP] for the code
(see perf_event_open.2:1426):

[[
.IP * 2
If
.B PERF_FORMAT_GROUP
was specified to allow reading all events in a group at once:
.IP
.in +4n
.EX
struct read_format {
u64 nr; /* The number of events */
u64 time_enabled; /* if PERF_FORMAT_TOTAL_TIME_ENABLED */
u64 time_running; /* if PERF_FORMAT_TOTAL_TIME_RUNNING */
struct {
u64 value; /* The value of the event */
u64 id; /* if PERF_FORMAT_ID */
} values[nr];
};
.EE
.in
.IP *
If
.B PERF_FORMAT_GROUP
was
.I not
specified:
.IP
.in +4n
.EX
struct read_format {
u64 value; /* The value of the event */
u64 time_enabled; /* if PERF_FORMAT_TOTAL_TIME_ENABLED */
u64 time_running; /* if PERF_FORMAT_TOTAL_TIME_RUNNING */
u64 id; /* if PERF_FORMAT_ID */
};
.EE
.in
]]

This way, inline code, and only inline code, will use [.in],
which will help grepping if it is ever needed.

Your thoughts?

Thanks,

Alex