Re: ASCII formatting for plain text email
On 2023-02-05, TRS-80 <lists.trs-80@isnotmyreal.name> wrote:
>
>> 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.
>
> #+begin_src emacs-lisp
> (defun my-insert-line-justified (left-text right-text)
> "Insert justified line.
> Spaces between LEFT-TEXT and RIGHT-TEXT will be calculated
> automatically, based on 72 character overall width."
> (let* ((left-chars (length left-text))
> (right-chars (length right-text))
> (spaces-count (- 72 left-chars right-chars))
> (spaces-string (make-string spaces-count ? )))
> (insert left-text spaces-string right-text)))
> #+end_src
(set-justification-full)
Reply to: