all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Shigeru Fukaya <shigeru.fukaya@gmail.com>
Cc: 17813@debbugs.gnu.org
Subject: bug#17813: 24.3.91; bad linum display with `text-scale-adjust'
Date: Tue, 08 Jul 2014 15:33:53 -0400	[thread overview]
Message-ID: <jwvk37nps2x.fsf-monnier+bug#17813@gnu.org> (raw)
In-Reply-To: <37CF8BE3769E04shigeru.fukaya@gmail.com> (Shigeru Fukaya's message of "Fri, 20 Jun 2014 02:25:28 +0900")

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)






      parent reply	other threads:[~2014-07-08 19:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19 17:25 bug#17813: 24.3.91; bad linum display with `text-scale-adjust' Shigeru Fukaya
2014-06-19 18:46 ` Stefan Monnier
2014-06-20  9:30   ` Eli Zaretskii
2014-06-20 13:35     ` Stefan Monnier
2014-06-20 14:27       ` Eli Zaretskii
2014-06-20 15:35         ` Stefan Monnier
2014-07-08 19:33 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='jwvk37nps2x.fsf-monnier+bug#17813@gnu.org' \
    --to=monnier@iro.umontreal.ca \
    --cc=17813@debbugs.gnu.org \
    --cc=shigeru.fukaya@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.