GNU bug report logs -
#5042
23.1; linum-mode gives incorrect line numbers with narrowed buffers
Previous Next
Full log
View this message in rfc822 format
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.
Your bug report will be posted to the bug-gnu-emacs <at> gnu.org mailing list,
and to the gnu.emacs.bug news group.
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
Linum-mode does not work correctly with buffers that have been
narrowed. As a simple example, type ^h i. You will note that the first
line is assigned line number one. You can verify that this is wrong
either by using goto-line (watch what happens when you try to go to line
10) or widen, which reveals that the first line is actually line number
five.
The bug is the use by linum of line-number-at-pos,
linum.el:129:
(defun linum-update-window (win)
"Update line numbers for the portion visible in window WIN."
(goto-char (window-start win))
(let ((line (line-number-at-pos))
...
<help for line-number-at-pos>:
line-number-at-pos is a compiled Lisp function in `simple.el'.
(line-number-at-pos &optional pos)
Return (narrowed) buffer line number at position pos.
If pos is nil, use current buffer location.
Counting starts at (point-min), so the value refers
to the contents of the accessible portion of the buffer.
A simple fix is to change the line:
linum.el:132:
(let ((line (line-number-at-pos))
to:
(let ((line (save-restriction
(widen)
(line-number-at-pos)))
- Mark
This bug report was last modified 4 years and 228 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.