help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: same data appears twice, interactive then function body


From: Emanuel Berg
Subject: Re: same data appears twice, interactive then function body
Date: Wed, 16 Dec 2020 05:32:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jean Louis wrote:

> (defun insert-centered-text (text &optional width)
>   (interactive "MText: ")
>   (let* ((width (or width (window-text-width)))
>        (length (length (string-trim text)))
>        (pos (/ (- width length) 2)))
>     (move-to-column pos t)
>     (insert text)
>     (insert "\n")))

Oh, so there is a `window-text-width'!

Great, that will do!

Thanks!

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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