* Scaling up to a column number
@ 2023-07-15 18:48 uzibalqa
0 siblings, 0 replies; only message in thread
From: uzibalqa @ 2023-07-15 18:48 UTC (permalink / raw)
To: uzibalqa via Users list for the GNU Emacs text editor
I would like to scale the text in a window in a way that a certain
number of columns get displayed.
Consider having ruler-mode and change the window size until you get
to column 32. Then call a function "column-scale" with the desired column
being 75. The result should be a window with extent of 75 characters
on the ruler.
But this is not good enough to do the job
(defun column-scale (nc)
(interactive "nDesired number of columns: ")
(let ( (ncwin (window-width)) )
(when (> ncwin 0)
(let* ( (scaling-factor (/ (float nc) ncwin))
(step text-scale-mode-step)
(scale-steps (ceiling (/ scaling-factor step))) )
(when (> nc ncwin)
(setq scale-steps (* -1 scale-steps)))
(text-scale-set scale-steps)) )))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-15 18:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-15 18:48 Scaling up to a column number uzibalqa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).