From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Gauthier Segay Newsgroups: gmane.emacs.help Subject: Re: UI glitch with text-scale-increase / text-scale-decrease with linum / nlinum Date: Mon, 9 Feb 2015 16:58:41 +0100 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1423497540 28425 80.91.229.3 (9 Feb 2015 15:59:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Feb 2015 15:59:00 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, markus.triska@gmx.at To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Feb 09 16:59:00 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YKqji-0007II-72 for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Feb 2015 16:58:58 +0100 Original-Received: from localhost ([::1]:33571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKqjh-00076R-PX for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Feb 2015 10:58:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKqjW-00076L-0O for help-gnu-emacs@gnu.org; Mon, 09 Feb 2015 10:58:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKqjR-00039E-Vk for help-gnu-emacs@gnu.org; Mon, 09 Feb 2015 10:58:45 -0500 Original-Received: from mail-ie0-f171.google.com ([209.85.223.171]:33231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKqjR-00038y-Rz for help-gnu-emacs@gnu.org; Mon, 09 Feb 2015 10:58:41 -0500 Original-Received: by iecrl12 with SMTP id rl12so17422313iec.0 for ; Mon, 09 Feb 2015 07:58:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=1dhj/Di6BDdFGIq6bPUPrniljDbeG4FhmHB2J4DxGnI=; b=WaQxGzcgy4LdSbAgmFcEPigtGNZnzBavuSn5cqbrvNIRAnYT9lqkxCW1aFza6bWWIz GpdhKnHSR1+a2JRARFemsm5clOlqg1Chmm/IPWUqDXkQABSz0RP/JOq9KR1oQJ1ech0i KI+XSUIzHwZvEocCSQR8M146/5TdKUqNGys5mPKYlzStoAMfPac/OUzLBlaeh3iB28XI UldanBX6jcar+tNztRwHRO1pJqpywIvQsbRMMlj2U4elavOtqbFn9osmfhloMIWtoWbp ZvNxo5ihzUf5/jI5S9bLSx6cm6j1/RL+hPgEu+9cpmB3TLHt+mVCnC1OqVK145euPtDb vEWg== X-Received: by 10.50.43.138 with SMTP id w10mr17711415igl.19.1423497521348; Mon, 09 Feb 2015 07:58:41 -0800 (PST) Original-Received: by 10.107.14.10 with HTTP; Mon, 9 Feb 2015 07:58:41 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.223.171 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102597 Archived-At: Hello Stefan, thanks for the update. I tried on this setup: GNU Emacs 24.4.1 (i686-pc-mingw32) of 2014-10-24 on LEG570 I disabled my theme/font settings (to ensure it doesn't interfere), patched the file, recompiled the extensions, but I still notice the same issue happening. That being said, when I issue M-x text-scale-increase (or decrease) instead of using ctrl+wheel , it seems to work properly and adjust the gutter, so I guess this is not necessarily an issue with the extension. I'll appreciate if someone can show me how to define my own function which disables nlinum, calls the text-scale functions and enables nlinum back; and how to attach that function to the hook. Thanks. On Mon, Feb 9, 2015 at 3:57 PM, Stefan Monnier wrote: >> (global-set-key (kbd "") 'text-scale-increase) >> (global-set-key (kbd "") 'text-scale-decrease) >> The issue is that linum or nlinum doesn't notice the change, the line >> number gutter doesn'adjust it's width. > > Can you test the patch below (for nlinum.el) to see if it solves > your problem? > > > Stefan > > > diff --git a/packages/nlinum/nlinum.el b/packages/nlinum/nlinum.el > index 82e274c..ca15800 100644 > --- a/packages/nlinum/nlinum.el > +++ b/packages/nlinum/nlinum.el > @@ -1,6 +1,6 @@ > ;;; nlinum.el --- Show line numbers in the margin -*- lexical-binding: t -*- > > -;; Copyright (C) 2012, 2014 Free Software Foundation, Inc. > +;; Copyright (C) 2012, 2014, 2015 Free Software Foundation, Inc. > > ;; Author: Stefan Monnier > ;; Keywords: convenience > @@ -54,6 +54,7 @@ Linum mode is a buffer-local minor mode." > :lighter nil ;; (" NLinum" nlinum--desc) > (jit-lock-unregister #'nlinum--region) > (remove-hook 'window-configuration-change-hook #'nlinum--setup-window t) > + (remove-hook 'text-scale-mode #'nlinum--setup-window t) > (remove-hook 'after-change-functions #'nlinum--after-change t) > (kill-local-variable 'nlinum--line-number-cache) > (remove-overlays (point-min) (point-max) 'nlinum t) > @@ -63,6 +64,7 @@ Linum mode is a buffer-local minor mode." > ;; FIXME: Another approach would be to make the mode permanent-local, > ;; which might indeed be preferable. > (add-hook 'change-major-mode-hook (lambda () (nlinum-mode -1))) > + (add-hook 'text-scale-mode #'nlinum--setup-window nil t) > (add-hook 'window-configuration-change-hook #'nlinum--setup-window nil t) > (add-hook 'after-change-functions #'nlinum--after-change nil t) > (jit-lock-register #'nlinum--region t)) > @@ -71,14 +73,24 @@ Linum mode is a buffer-local minor mode." > (defun nlinum--face-height (face) > (aref (font-info (face-font face)) 2)) > > +(defun nlinum--face-width (face) ;New info only in Emacs>=25. > + (let ((fi (font-info (face-font face)))) > + (when (> (length fi) 11) > + (let ((width (aref info 11))) > + (if (<= width 0) > + (aref info 10) > + width))))) > + > (defun nlinum--setup-window () > (let ((width (if (display-graphic-p) > (ceiling > - ;; We'd really want to check the widths rather than the > - ;; heights, but it's a start. > - (/ (* nlinum--width 1.0 > - (nlinum--face-height 'linum)) > - (frame-char-height))) > + (let ((width (nlinum--face-width 'linum))) > + (if width > + (/ (* nlinum--width 1.0 width) > + (frame-char-width)) > + (/ (* nlinum--width 1.0 > + (nlinum--face-height 'linum)) > + (frame-char-height))))) > nlinum--width))) > (set-window-margins nil (if nlinum-mode width) > (cdr (window-margins)))))