[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to set margins of buffer when window changes?
From: |
Emanuel Berg |
Subject: |
Re: How to set margins of buffer when window changes? |
Date: |
Wed, 08 Sep 2021 21:41:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> (when width
> (fill-column) )
Heh, I'm completely confused today, you will have to read what
I *think*, not what I type ... it should be `or'!
(or width fill-column)
Anyway here is the complete, fixed function. I don't know if
the computation is correct (I didn't change that) but it is
a good starting point ...
Note that I renamed it!
(defun center-text-with-margins (&optional window width)
(let ((win (or window (selected-window)))
(wid (or width fill-column) ))
(let*((space (max 0 (- (window-total-width) wid)))
(left (floor (/ space 2)))
(right (- space left)) )
(set-window-margins win left right)
(set-window-buffer win (current-buffer)) )))
--
underground experts united
https://dataswamp.org/~incal