From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Lillibridge Newsgroups: gmane.emacs.bugs Subject: bug#5042: 23.1; linum-mode gives incorrect line numbers with narrowed buffers Date: Wed, 25 Nov 2009 16:39:29 -0800 Message-ID: <200911260039.nAQ0dTD1019384@mailhub-pa1.hpl.hp.com> Reply-To: mark.lillibridge@hp.com, 5042@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1259196499 3756 80.91.229.12 (26 Nov 2009 00:48:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Nov 2009 00:48:19 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 26 01:48:12 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NDSWq-0002Ol-Eq for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Nov 2009 01:48:12 +0100 Original-Received: from localhost ([127.0.0.1]:59767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDSWp-0002sQ-U8 for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Nov 2009 19:48:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDSWA-0002BW-GT for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2009 19:47:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDSW5-00026G-G4 for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2009 19:47:29 -0500 Original-Received: from [199.232.76.173] (port=60094 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDSW5-00025t-8j for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2009 19:47:25 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:38134) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NDSW4-0005Mf-J5 for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2009 19:47:25 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAQ0lMRL020253; Wed, 25 Nov 2009 16:47:22 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id nAQ0j47J019973; Wed, 25 Nov 2009 16:45:04 -0800 Resent-Date: Wed, 25 Nov 2009 16:45:04 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Mark Lillibridge Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Thu, 26 Nov 2009 00:45:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 5042 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.125919598919546 (code B ref -1); Thu, 26 Nov 2009 00:45:04 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 26 Nov 2009 00:39:49 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAQ0dlQ2019543 for ; Wed, 25 Nov 2009 16:39:48 -0800 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDSOh-0002ft-7W for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2009 19:39:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDSOc-0002Ya-C7 for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2009 19:39:46 -0500 Original-Received: from [199.232.76.173] (port=60207 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDSOc-0002YG-2V for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2009 19:39:42 -0500 Original-Received: from gundega.hpl.hp.com ([192.6.19.190]:54758) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NDSOb-0004lg-CA for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2009 19:39:41 -0500 Original-Received: from mailhub-pa1.hpl.hp.com (mailhub-pa1.hpl.hp.com [15.25.115.25]) by gundega.hpl.hp.com (8.14.3/8.14.1/HPL-PA Relay) with ESMTP id nAQ0dVkb001261 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 25 Nov 2009 16:39:31 -0800 (PST) Original-Received: from ts-rhel4.hpl.hp.com (ts-rhel4.hpl.hp.com [15.25.118.24]) by mailhub-pa1.hpl.hp.com (8.14.3/8.14.3/HPL-PA Hub) with ESMTP id nAQ0dTD1019384; Wed, 25 Nov 2009 16:39:30 -0800 X-MailScanner-ID: nAQ0dVkb001261 X-HPL-MailScanner: Found to be clean X-HPL-MailScanner-From: mark.lillibridge@hp.com X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Wed, 25 Nov 2009 19:47:29 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:32946 Archived-At: 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@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)) ... : 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