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

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

Re: Interactive window resize feedback?


From: Stephen Berman
Subject: Re: Interactive window resize feedback?
Date: Fri, 26 May 2017 19:12:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

On Fri, 26 May 2017 11:22:01 -0500 Skip Montanaro <skip.montanaro@gmail.com> 
wrote:

> I'm an old 80-column guy. Sometimes I need to widen a frame to view
> more text without truncation or line wrappage, though. Is it possible
> to get Emacs to provide a little interactive feedback as I resize the
> frame? Alternatively, can I display frame or window dimensions in the
> mode line? (I poked around some of the mode-line-format docs, but
> honestly didn't understand what I was looking at.)
>
> A bit of Googling and poking around in the customization didn't turn
> anything up. I'm stuck on Windows with Emacs running on a Linux
> server, so I can't go poking around window manager docs.

This will put frame-width and frame-height in the mode line:

(defvar my-frame-size-mode t)

(defun my-frame-size-mode (arg)
  "Toggle Frame Size mode.
With arg, turn Frame Size mode on iff arg is positive.  When
Frame Size mode is enabled, the frame's width and height appear
in the mode line."
  (interactive "P")
  (setq my-frame-size-mode
        (if (null arg) (not my-frame-size-mode)
          (> (prefix-numeric-value arg) 0)))
  (force-mode-line-update))

(setq mode-line-position
      (append mode-line-position
              '((my-frame-size-mode
                 (:eval (concat " W" (number-to-string
                                      (frame-parameter nil 'width))
                                " H" (number-to-string
                                      (frame-parameter nil 'height))))))))

Steve Berman



reply via email to

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