Subject: bug#8379: The width of linum window is not adjusted after face-remapping

From: nixie <[email-masked]>
Date: Wed, 30 Mar 2011 10:43:49 +0900

Hi,

I am green hand in emacs, and starting using GNU Emacs since 23.1.

I found that the width of linum window is not changed with
(text-scale-increase) or (text-scale-decrease) function. 
This is annoying especially when I increase the text size, because the
line number can not be fully viewed.

currently, I use some alleviating code like below to solve this problem.
But I think it does not have generality.

Does someone have any good suggestion on it? Or it can be solved in a
more elegant and general way. I wish that it would be solved in future
version of GNU Emacs.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun rescale-window-margin-by-faceremapping (win)
  (let ((width (car (window-margins)))
	(scale (cadr (assoc ':height 
			    (assoc 'default 
				   face-remapping-alist)))))
    (if (numberp scale)
	(progn
	  (set-window-margins win (ceiling (* width scale)) (cdr
(window-margins win)))
	  (force-window-update))
      nil)))

(defadvice linum-update-window (after scaling-margin-width last (win)
activate)
  (rescale-window-margin-by-faceremapping win)
  ad-return-value)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Thanks for any help.

-- 
nixie <[email-masked]>