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

Re: ASCII formatting for plain text email



On Tue 31 Jan 2023 at 23:06:44 (+0100), Pierre Willaime wrote:
> Le 31/01/2023 à 21:14, Greg Wooledge a écrit :
> > A .signature file is only written once, so it doesn't matter how
> > tedious it is to produce the desired formatting.  That said, I would
> > imagine relatively few people have octothorpe boxes around text in their
> > .signature files these days.  Even back in the 1990s, that would have
> > been considered a bit on the tacky side.
> 
> Of course, I misspoke about the signature. I often see *some* formatting
> (such as some text aligned to the left and some other text aligned to
> the right, same line).
> 
> But you are right, .signature file is only written once and I am looking
> for a simple way to write email with some minimal ASCII formatting. This
> is why I am looking for an automatic solution.
> 
> I do not want to do ASCII art, I am only searching a simple way to do
> something close to the debian-annouce emails.
> 
> ------------------------------------------------------------------------
> The Debian Project                               https://www.debian.org/
> Updated Debian 11: 11.6 released                        press@debian.org
> December 17th, 2022            https://www.debian.org/News/2022/20221217
> ------------------------------------------------------------------------
> 
> How this header is generated?

No idea. I guess you might ask someone who generates them.

> So do someone knows:
> 
> 
> 1- a simple way to draw a line (without pressing 72 times on "-")
> -----------------------------------------------------------------------

I would type ESC 7 2 -
which does, and reflects, the same as C-u 72 -, but is less awkward
to type.

> 2- a simple way to align some text to the right (that is to say to
> automatically calculate how many spaces are needed to fill the gap
> between the text on the left an the text on the right for 72 characters
> line.

That's beyond my paygrade: I don't do conditionals or computations
in emacs. So how would I tackle it to make it a little less painful:

First, I'd type the dashes, which give your eye the alignment to use.
Next, I'd type the left and right parts, but making sure that there
were two spaces between them.

I would define a macro, or preferably have defined it already and
bound it to some keystroke (it needs to be a single keystroke to
be sensible):
C-e C-r SPACE SPACE RETURN SPACE C-e
Every time you execute the macro, the line will lengthen by one.
The macro should be as easy to use whether you lengthen each line
as you type it, or leave it all to the end of the block.

If you're completely ham-fisted, you'd need the inverse macro,
which would have the last SPACE replaced by C-d. That macro would
be bound so that you couldn't easily repeat it by accident, as
it's destructive. (It will search backwards for /any/ double space.)

> 3- a simple way to do boxes (no present in debian-annouce header)

I thought I'd already covered that in
https://lists.debian.org/debian-user/2023/01/msg00792.html
but the buffer has to be in the correct mode to get octotherps
rather than comment characters appropriate to some other
language that emacs thinks the buffer contains.

(I'm assuming the ELPA people have got automated linedrawing
characters covered. I've never ventured there.)

Cheers,
David.

Reply to: