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

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

Scaling up to a column number


From: uzibalqa
Subject: Scaling up to a column number
Date: Sat, 15 Jul 2023 18:48:31 +0000

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)) )))






reply via email to

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