From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#27281: Fix nlinum missing line numbers. Date: Sat, 10 Jun 2017 18:12:38 -0400 Message-ID: <8737b7wkyx.fsf@users.sourceforge.net> References: <87h8zovz62.fsf@users.sourceforge.net> <87h8znu491.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1497132734 8791 195.159.176.226 (10 Jun 2017 22:12:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 10 Jun 2017 22:12:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: William Gilbert , 27281@debbugs.gnu.org To: Alex Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 11 00:12:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJoc4-0001pb-Th for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 Jun 2017 00:12:09 +0200 Original-Received: from localhost ([::1]:60394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJoc8-0008Ih-HY for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Jun 2017 18:12:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJoc2-0008IX-Qi for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2017 18:12:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJoby-0003rr-Hg for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2017 18:12:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36755) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dJoby-0003rm-DE for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2017 18:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dJoby-0006FY-1R for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2017 18:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Jun 2017 22:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27281 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27281-submit@debbugs.gnu.org id=B27281.149713267023964 (code B ref 27281); Sat, 10 Jun 2017 22:12:01 +0000 Original-Received: (at 27281) by debbugs.gnu.org; 10 Jun 2017 22:11:10 +0000 Original-Received: from localhost ([127.0.0.1]:39432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJob7-0006ES-RM for submit@debbugs.gnu.org; Sat, 10 Jun 2017 18:11:10 -0400 Original-Received: from mail-io0-f169.google.com ([209.85.223.169]:36069) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJob5-0006EE-BC for 27281@debbugs.gnu.org; Sat, 10 Jun 2017 18:11:07 -0400 Original-Received: by mail-io0-f169.google.com with SMTP id y77so43595980ioe.3 for <27281@debbugs.gnu.org>; Sat, 10 Jun 2017 15:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=GnWnfqM5DzyddDusUGhuXDgkt17938tuuuq0YuE0s5A=; b=jIs8wQcL048j/aQc4QYydgUCu3QmdF/CDRgGWlcf5ZCxgklBUwn7xgynjeXeMhWo5d 0StvwyHBLyEjrLSCECPJ+oLIc6Ars4s1OE8V6r09DUCSgJDJJATUqJn9T8KHX1lSLZsm 4E5g3davNjVjsAHTn3TAAOpOtRvGDfJz87pEpXqay2Wk+PcLYhAGOyzO/E6PoQrDxkXk VpUo/Vq37dmwd3JiRYmeqJw+Ah3OHRwhBo6eKRsQV1FJi2vT3cASkecOSFGKywiDenH/ QBJy4FBTZUiYqGlVGl3FFiTu+4vo587alMZhKory5jVIWils7JjngqJRjQpVVDHUBdCi 9Bdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=GnWnfqM5DzyddDusUGhuXDgkt17938tuuuq0YuE0s5A=; b=pzj4Ef1N0FlxH3jpECLFdvl8+0ugFuKqUmjmoUfdKLGCjrQV5TQaZ9jaVbiXOXtGrd 0ZEf0uZCcPaXdcThZpMYopnCHw/MrOGDYcdDqivASbN556xP4yK+z4rlAtADDaFHjBrn uRxGucIEj6/EY/qQE+9+fIAm1NUGtQwPtKelGCfgsrfCv6Tsm9bWl1MEHsCWP4HhzSLO /VLAFix6sd2wTEz8VM3+UCH8uuNvmnQ4CZF7ynnpiYPr5bjpyExkvBEKI4ZBzTIeJD6V NUxDafPhx6fA17xrZpAiqXNS3lrN0Fwx+6vTNaTZaomJ8Un5K03M3irM6lySAhQJJC9P JW3A== X-Gm-Message-State: AODbwcCpXbHzUf/iBLJK2BCkjcyzHMrDSBgdfwZVStKjyopTNgXe8gaU vMJEUvirMU9+cg== X-Received: by 10.107.63.214 with SMTP id m205mr12553181ioa.176.1497132661748; Sat, 10 Jun 2017 15:11:01 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id y40sm3559161ita.2.2017.06.10.15.11.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Jun 2017 15:11:00 -0700 (PDT) In-Reply-To: <87h8znu491.fsf@gmail.com> (Alex's message of "Sat, 10 Jun 2017 11:44:26 -0600") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:133454 Archived-At: Alex writes: >> >> This sounds like a workaround, possibly to a bug in jit-lock. Or >> perhaps we need to return a list of the form (jit-lock-bounds BEG END) >> from nlinum--region? > > FWIW I've encountered this issue before and this diff does not solve the > problem for me. I mostly see it when using the 3rd-party package > macroexpand with nlinum. Expanding and closing a macro will leave > several lines with no line number (from the 2nd line of the macro until > the last line of the macro). > > I've tried to use edebug on nlinum--region to figure out what's going > on, but it doesn't seem to be triggering for some reason. I suspect the debugger is suppressed while jit-lock occurs. You would need to log things silently and print it later. I think 'jit-lock--run-functions' and 'jit-lock-fontify-now' would be interesting targets. Something easy to check would be if there are certain values of 'jit-lock-functions' needed to trigger this (apart from nlinum--region of course). Here's my guess as to a fix (untested): --- i/packages/nlinum/nlinum.el +++ w/packages/nlinum/nlinum.el @@ -296,7 +296,8 @@ (defun nlinum--region (start limit) (save-excursion ;; Text may contain those nasty intangible properties, but ;; that shouldn't prevent us from counting those lines. - (let ((inhibit-point-motion-hooks t)) + (let ((inhibit-point-motion-hooks t) + (end start)) (goto-char start) (unless (bolp) (forward-line 1)) (remove-overlays (point) limit 'nlinum t) @@ -320,9 +321,10 @@ (defun nlinum--region (start limit) ;; (run-with-idle-timer 0.5 nil #'nlinum--flush-overlays ;; (current-buffer))) (setq line (1+ line)) - (zerop (forward-line 1)))))))) - ;; (setq nlinum--desc (format "-%d" (nlinum--ol-count))) - nil) + (setq end (line-end-position)) + (zerop (forward-line 1))))))) + ;; (setq nlinum--desc (format "-%d" (nlinum--ol-count))) + `(jit-lock-bounds ,start . ,end))) ;;;###autoload (define-globalized-minor-mode global-nlinum-mode nlinum-mode