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

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

bug#17813: 24.3.91; bad linum display with `text-scale-adjust'


From: Stefan Monnier
Subject: bug#17813: 24.3.91; bad linum display with `text-scale-adjust'
Date: Tue, 08 Jul 2014 15:33:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Version:24.5

> (1) To change the width of left margin for line numbers.
> [attached patch]

I installed the patch below instead (I earlier used a similar patch for
nlinum), which should be slightly more robust.  Thank you,


        Stefan


=== modified file 'lisp/linum.el'
--- lisp/linum.el       2014-02-10 01:34:22 +0000
+++ lisp/linum.el       2014-07-08 19:27:00 +0000
@@ -138,6 +138,9 @@
       (mapc #'delete-overlay linum-available)
       (setq linum-available nil))))
 
+(defun linum--face-height (face)
+  (aref (font-info (face-font face)) 2))
+
 (defun linum-update-window (win)
   "Update line numbers for the portion visible in window WIN."
   (goto-char (window-start win))
@@ -178,6 +181,12 @@
       (let ((inhibit-point-motion-hooks t))
         (forward-line))
       (setq line (1+ line)))
+    (when (display-graphic-p)
+      (setq width (ceiling
+                   ;; We'd really want to check the widths rather than the
+                   ;; heights, but it's a start.
+                   (/ (* width 1.0 (linum--face-height 'linum))
+                      (frame-char-height)))))
     (set-window-margins win width (cdr (window-margins win)))))
 
 (defun linum-after-change (beg end _len)






reply via email to

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