From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: William Gilbert Newsgroups: gmane.emacs.bugs Subject: bug#27281: Fix nlinum missing line numbers. Date: Wed, 7 Jun 2017 17:46:29 -0400 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a113e308637051a055165abca" X-Trace: blaine.gmane.org 1496872155 7344 195.159.176.226 (7 Jun 2017 21:49:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 7 Jun 2017 21:49:15 +0000 (UTC) To: 27281@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 07 23:49:10 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 1dIipB-0001Ur-Ue for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Jun 2017 23:49:10 +0200 Original-Received: from localhost ([::1]:46253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIipF-0000w2-PY for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Jun 2017 17:49:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIip5-0000ul-9i for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 17:49:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIip4-0007Ye-8G for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 17:49:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59249) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIip4-0007YY-3b for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 17:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dIip3-0003v9-TO for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 17:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: William Gilbert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Jun 2017 21:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27281 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.149687209615018 (code B ref -1); Wed, 07 Jun 2017 21:49:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Jun 2017 21:48:16 +0000 Original-Received: from localhost ([127.0.0.1]:33693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIioK-0003u9-GC for submit@debbugs.gnu.org; Wed, 07 Jun 2017 17:48:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIimn-0003rC-Dc for submit@debbugs.gnu.org; Wed, 07 Jun 2017 17:46:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIimh-0006vS-0M for submit@debbugs.gnu.org; Wed, 07 Jun 2017 17:46:36 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:54856) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dIimg-0006vO-TH for submit@debbugs.gnu.org; Wed, 07 Jun 2017 17:46:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIimf-0008T0-Lf for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 17:46:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIime-0006un-Oh for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 17:46:33 -0400 Original-Received: from mail-ot0-x22f.google.com ([2607:f8b0:4003:c0f::22f]:34455) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIime-0006uI-Ik for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 17:46:32 -0400 Original-Received: by mail-ot0-x22f.google.com with SMTP id t31so14125659ota.1 for ; Wed, 07 Jun 2017 14:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=3wdJQbwxCQKenxeJ1BXWvQUzxWAi3Lzj5XsbQC0niHU=; b=ox2wRiCALCIn3MmrEn4FJfVLV4jinlx1/hQ7X2bDBx44EsDVAEfswnPHGdq3iz80YR R37SKC2L+01QLpIIFgLxuZi1xM8vi+OzTMauminCdzde5VpZx6RkvUW1E+lDq9Bazdxd 2irD4glTjrei0eS/vhiGMK2Q20pwUdRBSIrVrsDfhkhLKiigpGx+sJB3apNZSPFtyi+X XNCl0ENr3IeCzl8CRFJEtqJT8kVGI7I4rA4ga4k+1V2hIpmmK5+kYSCVQCqeAzCIsj95 WmG9yp1YsD6ofi72H/gMDFmfuM9fTRjmQC8yuJ7AspPoPmg0MIpPLfd6DAGoy/5zd5tJ OD0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=3wdJQbwxCQKenxeJ1BXWvQUzxWAi3Lzj5XsbQC0niHU=; b=LXxudXx976reOV2RA+2SrO0LCuooS1XV165P5X4cJuniox4nEMxcMID/V3OHkKNCwo NtJKQhh9Sz2lsJDaedCQLyajNNFTX3RQVLdv9ulsEmxUMNz2X7y2WB31I25tHaoXbmCL wIupu02xD2kvXGmyeKhakgW84xWERZXQ4TybagBnOTm57I0WlfFQLnniYT/eKdUdg/4R cXs1+TlPLmXavPL8A/Wcuow5t6Wu8ZmjBPWl69dRBdJbGBWzcvJ9SGmo848YFcXq95e/ yVogkRbE+QKLYLHPPw9FCBKssj/wk49Q8nZwdZwDu8wysKWvSbBf0A1xKPwWPd/S1pdJ aK3g== X-Gm-Message-State: AODbwcAPsqC19EZxaysITUc4hcDuRRkUulifXYw14H6pC56nOx7xsgMC vNLb4XXspFLy2x2h9d9f9/nDLHOPNQWPlbk= X-Received: by 10.157.27.135 with SMTP id z7mr17446001otd.133.1496871989608; Wed, 07 Jun 2017 14:46:29 -0700 (PDT) Original-Received: by 10.157.22.234 with HTTP; Wed, 7 Jun 2017 14:46:29 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Wed, 07 Jun 2017 17:48:15 -0400 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:133386 Archived-At: --001a113e308637051a055165abca Content-Type: text/plain; charset="UTF-8" I've been working to track to down a bug where line numbers are occasionally missing when using nlinum mode. Currently there is a package written to workaround the problem that has a picture and description of the problem: https://github.com/hlissner/emacs-nlinum-hl. After extensive debugging I've tracked the problem down to the 'nlinum--region' function. Specifically the while loop check that determines if '(point)' is less than the limit. I've found that the problem exists when '(point)' is exactly equal to 'limit'. In this scenario the loop terminates and the last line in the region is not provided with a line number. I was able to remedy the problem by changing the condition from 'less than' to 'less than or equal to', which will allow the last line in the region to be properly assigned a line number. Thank you. Diff: diff --git a/packages/nlinum/nlinum.el b/packages/nlinum/nlinum.el index ca4f949fc..f82b61987 100644 --- a/packages/nlinum/nlinum.el +++ b/packages/nlinum/nlinum.el @@ -303,7 +303,7 @@ it may cause the margin to be resized and line numbers to be recomputed.") (remove-overlays (point) limit 'nlinum t) (let ((line (nlinum--line-number-at-pos))) (while - (and (not (eobp)) (< (point) limit) + (and (not (eobp)) (<= (point) limit) (let* ((ol (make-overlay (point) (1+ (point)))) (str (funcall nlinum-format-function line nlinum--width)) --001a113e308637051a055165abca Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I've been working to track to down a bug where li= ne numbers are occasionally missing when using nlinum mode. Currently there= is a package written to workaround the problem that has a picture and desc= ription of the problem: https://github.com/hlissner/emacs-nlinum-hl.

Aft= er extensive debugging I've tracked the problem down to the 'nlinum= --region' function. Specifically the while loop check that determines i= f '(point)' is less than the limit. I've found that the problem= exists when '(point)' is exactly equal to 'limit'. In this= scenario the loop terminates and the last line in the region is not provid= ed with a line number. I was able to remedy the problem by changing the con= dition from 'less than' to 'less than or equal to', which w= ill allow the last line in the region to be properly assigned a line number= .

Thank you.

Diff:

di= ff --git a/packages/nlinum/nlinum.el b/packages/nlinum/nlinum.el
index c= a4f949fc..f82b61987 100644
--- a/packages/nlinum/nlinum.el
+++ b/pack= ages/nlinum/nlinum.el
@@ -303,7 +303,7 @@ it may cause the margin to be = resized and line numbers to be recomputed.")
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (remove-overlays (point) limit 'nlinum t)
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (let ((line (nlinum--line-number-at-pos)))
= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (while
-=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (and (not (eobp)) (<= (point) limit)
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (and (not (eobp)) (<=3D (point) limit)
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (let* ((ol (make-overlay (point) (1+ (point))))
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (str (funcall = nlinum-format-function
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 line nlinum--width))
--001a113e308637051a055165abca--