[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27281: Fix nlinum missing line numbers.
From: |
npostavs |
Subject: |
bug#27281: Fix nlinum missing line numbers. |
Date: |
Sat, 10 Jun 2017 18:12:38 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) |
Alex <agrambot@gmail.com> 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