From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#11496: 24.1.50; Line numbers are not redrawn correctly in linum-mode Date: Thu, 17 May 2012 09:59:55 -0400 Message-ID: References: <86likr37id.fsf@googlemail.com> <4FB46A30.8070703@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT X-Trace: dough.gmane.org 1337263269 9275 80.91.229.3 (17 May 2012 14:01:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 17 May 2012 14:01:09 +0000 (UTC) Cc: 11496@debbugs.gnu.org To: Christoph Scholtes Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 17 16:01:07 2012 Return-path: Envelope-to: geb-bug-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 1SV1GM-0006Fh-Ho for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 May 2012 16:01:06 +0200 Original-Received: from localhost ([::1]:38808 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SV1GL-0004lV-TC for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 May 2012 10:01:05 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SV1GA-0004kQ-Mv for bug-gnu-emacs@gnu.org; Thu, 17 May 2012 10:01:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SV1G4-0004pa-FO for bug-gnu-emacs@gnu.org; Thu, 17 May 2012 10:00:54 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SV1G4-0004oM-Bq for bug-gnu-emacs@gnu.org; Thu, 17 May 2012 10:00:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SV1GI-0006eT-CB for bug-gnu-emacs@gnu.org; Thu, 17 May 2012 10:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 May 2012 14:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11496 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11496-submit@debbugs.gnu.org id=B11496.133726322525517 (code B ref 11496); Thu, 17 May 2012 14:01:02 +0000 Original-Received: (at 11496) by debbugs.gnu.org; 17 May 2012 14:00:25 +0000 Original-Received: from localhost ([127.0.0.1]:59344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SV1Fg-0006dU-PA for submit@debbugs.gnu.org; Thu, 17 May 2012 10:00:25 -0400 Original-Received: from relais.videotron.ca ([24.201.245.36]:25263) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SV1Fc-0006dL-TI for 11496@debbugs.gnu.org; Thu, 17 May 2012 10:00:21 -0400 Original-Received: from fmsmemgm.homelinux.net ([184.161.23.35]) by VL-VM-MR003.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0M4600LGM6VWL180@VL-VM-MR003.ip.videotron.ca> for 11496@debbugs.gnu.org; Thu, 17 May 2012 09:59:56 -0400 (EDT) Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 3B1CBAE0E5; Thu, 17 May 2012 09:59:55 -0400 (EDT) In-reply-to: <4FB46A30.8070703@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:60128 Archived-At: > Would it be hard to add the "relative line number" feature with your code? Depends on how badly you want it and how reliable you want it. `jit-lock' is not triggered by mere cursor movement, so you need to use another hook to detect when we move to another line, after which you'll have to flush all the nlinum overlays and recompute them, and since we want jit-lock to recompute them (so that all (but only) visible parts of the buffer get recomputed), that means telling jit-lock to redo the buffer, which will make it re-font-lock as well. So it'll be a bit costly. IOW, you need to hook into nlinum.el's display so it puts relative numbers (easy), and then add something like (add-hook 'post-command-hook (lambda () (if (current-line-number-changed-p) (remove-text-properties (point-min) (point-max) '(fontified nil))))) And of course, post-command-hook will not always be sufficient. Stefan PS: And of course, there's the problem (also present in the linum.el hack) that the cursor position is a window-property so when the buffer is shown in various windows the relative line numbers may not make that much sense in other buffers. So maybe you'd really want this relative numbering to be different for every window.