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

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

bug#39901: Emacs needs to update window-width when the user updates the


From: Katsumi Yamaoka
Subject: bug#39901: Emacs needs to update window-width when the user updates the text size
Date: Thu, 05 Mar 2020 08:00:09 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-cygwin)

Thanks Drew.  Jidanni, try the following two advices if interest.
Probably this would be what you want `text-scale-adjust' to do.
The first one tweaks the `window-width' function so to return
a value based on the text scaling, and the second one makes the
`text-scale-adjust' function redisplay an emacs-w3m page.  It's
only a quick hack, so I don't want to imprement it in emacs-w3m.

(defadvice w3m-redisplay-this-page (around adjust-window-width activate)
  "Adjust window-width value according to `face-remapping-alist'."
  (current-buffer)
  (let ((height (ignore-errors
                  (cadr (assq :height
                              (assq 'default face-remapping-alist))))))
    (if height
        (let ((ofn (symbol-function 'window-width)))
          (fset 'window-width (lambda (&rest args)
                                (floor (/ (funcall ofn) height))))
          (unwind-protect
              ad-do-it
            (fset 'window-width ofn)))
      ad-do-it)))

(defadvice text-scale-adjust (after redisplay-w3m-page activate)
  "Redisplay w3m page after scaling text."
  (when (eq major-mode 'w3m-mode)
    (let ((w3m-message-silent t))
      (w3m-redisplay-this-page))))





reply via email to

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