unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#2612: VC annotate mode places point on wrong line number when narrowing is in effect
@ 2009-03-09 14:28 ` Alexander Becher
  2009-03-10  1:05   ` bug#2612: marked as done (VC annotate mode places point on wrong line number when narrowing is in effect) Emacs bug Tracking System
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Becher @ 2009-03-09 14:28 UTC (permalink / raw)
  To: bug-gnu-emacs

Actual Behaviour:

The VC annotate mode automatically places point on the same line as it 
is in the buffer of the corresponding file. Thus, one sees the same line 
in the annotated buffer as in the file buffer. However, when narrowing 
is in effect in the file buffer when vc-annotate is called, point is 
placed on the wrong line.

How to Reproduce:

  * Visit a version-controlled file with at least 2 lines.
  * Narrow to a region that does not start on line 1 (say, on line 2).
  * Place point on say, line 1 of the narrowed portion (i.e., line 2 of 
the file).
  * Call vc-annotate (C-x v g)
  * Note how point is on line 1 of the file instead of the expected line 2.

Patch:

In vc.el, surround the call to (line-number-at-pos) by a 
(save-restriction (widen) ...):

diff -u "c:/Programme/emacs/emacs-22.2/lisp/vc.el~" 
"c:/Programme/emacs/emacs-22.2/lisp/vc.el"
--- c:/Programme/emacs/emacs-22.2/lisp/vc.el~	2008-02-04 
03:32:56.000000000 +0100
+++ c:/Programme/emacs/emacs-22.2/lisp/vc.el	2009-03-04 
17:57:40.078000000 +0100
@@ -3194,7 +3194,7 @@
           ;; If BUF is specified, we presume the caller maintains 
current line,
           ;; so we don't need to do it here.  This implementation may give
           ;; strange results occasionally in the case of REV != 
WORKFILE-REV.
-         (current-line (unless buf (line-number-at-pos))))
+         (current-line (unless buf (save-restriction (widen) 
(line-number-at-pos)))))
      (message "Annotating...")
      ;; If BUF is specified it tells in which buffer we should put the
      ;; annotations.  This is used when switching annotations to another

Diff finished.  Mon Mar 09 15:24:19 2009

By the Way:

vc.el contains '$Id$', looks like keyword expansion was not switched on.

In GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600)
  of 2008-03-26 on RELEASE
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'










^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#2612: marked as done (VC annotate mode places point on wrong  line number when narrowing is in effect)
  2009-03-09 14:28 ` bug#2612: VC annotate mode places point on wrong line number when narrowing is in effect Alexander Becher
@ 2009-03-10  1:05   ` Emacs bug Tracking System
  0 siblings, 0 replies; 2+ messages in thread
From: Emacs bug Tracking System @ 2009-03-10  1:05 UTC (permalink / raw)
  To: Chong Yidong

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]


Your message dated Mon, 09 Mar 2009 21:01:02 -0400
with message-id <87r616dwdt.fsf@cyd.mit.edu>
and subject line Re: VC annotate mode places point on wrong line number when narrowing is in effect
has caused the Emacs bug report #2612,
regarding VC annotate mode places point on wrong line number when narrowing is in effect
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
2612: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=2612
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 4408 bytes --]

From: Alexander Becher <alexander.becher@capgemini-sdm.com>
To: bug-gnu-emacs@gnu.org
Subject: VC annotate mode places point on wrong line number when narrowing is in effect
Date: Mon, 09 Mar 2009 15:28:12 +0100
Message-ID: <49B5277C.9060905@capgemini-sdm.com>

Actual Behaviour:

The VC annotate mode automatically places point on the same line as it 
is in the buffer of the corresponding file. Thus, one sees the same line 
in the annotated buffer as in the file buffer. However, when narrowing 
is in effect in the file buffer when vc-annotate is called, point is 
placed on the wrong line.

How to Reproduce:

  * Visit a version-controlled file with at least 2 lines.
  * Narrow to a region that does not start on line 1 (say, on line 2).
  * Place point on say, line 1 of the narrowed portion (i.e., line 2 of 
the file).
  * Call vc-annotate (C-x v g)
  * Note how point is on line 1 of the file instead of the expected line 2.

Patch:

In vc.el, surround the call to (line-number-at-pos) by a 
(save-restriction (widen) ...):

diff -u "c:/Programme/emacs/emacs-22.2/lisp/vc.el~" 
"c:/Programme/emacs/emacs-22.2/lisp/vc.el"
--- c:/Programme/emacs/emacs-22.2/lisp/vc.el~	2008-02-04 
03:32:56.000000000 +0100
+++ c:/Programme/emacs/emacs-22.2/lisp/vc.el	2009-03-04 
17:57:40.078000000 +0100
@@ -3194,7 +3194,7 @@
           ;; If BUF is specified, we presume the caller maintains 
current line,
           ;; so we don't need to do it here.  This implementation may give
           ;; strange results occasionally in the case of REV != 
WORKFILE-REV.
-         (current-line (unless buf (line-number-at-pos))))
+         (current-line (unless buf (save-restriction (widen) 
(line-number-at-pos)))))
      (message "Annotating...")
      ;; If BUF is specified it tells in which buffer we should put the
      ;; annotations.  This is used when switching annotations to another

Diff finished.  Mon Mar 09 15:24:19 2009

By the Way:

vc.el contains '$Id$', looks like keyword expansion was not switched on.

In GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600)
  of 2008-03-26 on RELEASE
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'







[-- Attachment #3: Type: message/rfc822, Size: 1481 bytes --]

From: Chong Yidong <cyd@stupidchicken.com>
To: Alexander Becher <alexander.becher@capgemini-sdm.com>
Cc: 2612-done@emacsbugs.donarmstrong.com
Subject: Re: VC annotate mode places point on wrong line number when narrowing is in effect
Date: Mon, 09 Mar 2009 21:01:02 -0400
Message-ID: <87r616dwdt.fsf@cyd.mit.edu>

> The VC annotate mode automatically places point on the same line as it
> is in the buffer of the corresponding file. Thus, one sees the same
> line in the annotated buffer as in the file buffer. However, when
> narrowing is in effect in the file buffer when vc-annotate is called,
> point is placed on the wrong line.

Thanks, I've checked your patch into CVS.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-10  1:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87r616dwdt.fsf@cyd.mit.edu>
2009-03-09 14:28 ` bug#2612: VC annotate mode places point on wrong line number when narrowing is in effect Alexander Becher
2009-03-10  1:05   ` bug#2612: marked as done (VC annotate mode places point on wrong line number when narrowing is in effect) Emacs bug Tracking System

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).