unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* vc-annotate and jump to a specific line
@ 2011-03-24 19:01 Uwe Brauer
  2011-03-24 23:34 ` Juanma Barranquero
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2011-03-24 19:01 UTC (permalink / raw)
  To: emacs-devel

Hello 

Lately I use vc-annotate quite often with RCS.

I would find it very useful if from the vc-annotate buffer I
could jump directly to a specific line of the file.

Example I execute vc-annotate in the workfile version and I
obtain 
2011-03-22  1.11: \input{aned10-header-beamer}
2011-03-22  1.5 : %\input{aned10-header-article}


So putting to cursor to the second line I would like to jump
to the line in the corresponding file (which happens to be
line number two of the file.)


Anybody know about such a function?

Uwe Brauer 





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

* Re: vc-annotate and jump to a specific line
  2011-03-24 19:01 vc-annotate and jump to a specific line Uwe Brauer
@ 2011-03-24 23:34 ` Juanma Barranquero
  2011-03-25 11:43   ` Uwe Brauer
  0 siblings, 1 reply; 7+ messages in thread
From: Juanma Barranquero @ 2011-03-24 23:34 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-devel

On Thu, Mar 24, 2011 at 20:01, Uwe Brauer <oub@mat.ucm.es> wrote:

> Anybody know about such a function?

Something like that (warning: barely tested)

(defun vc-annotate-goto-line ()
  (interactive)
  (unless (eq major-mode 'vc-annotate-mode)
    (error "vc-annotate-goto-line must be used on a VC-Annotate buffer"))
  (let* ((name (buffer-name))
         (base (and (string-match "Annotate \\(.*\\) (rev" name)
                    (match-string 1 name)))
         (line (save-restriction
                 (widen)
                 (line-number-at-pos))))
    (with-current-buffer (get-buffer base)
      (pop-to-buffer (current-buffer))
      (save-restriction
        (widen)
        (goto-char (point-min))
        (forward-line (1- line))
        (recenter)))))


    Juanma



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

* Re: vc-annotate and jump to a specific line
  2011-03-24 23:34 ` Juanma Barranquero
@ 2011-03-25 11:43   ` Uwe Brauer
  2011-03-25 11:52     ` Juanma Barranquero
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2011-03-25 11:43 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-devel

>> Regarding Re: vc-annotate and jump to a specific line; Juanma Barranquero <lekktu@gmail.com> adds:

   > On Thu, Mar 24, 2011 at 20:01, Uwe Brauer <oub@mat.ucm.es> wrote:
   >> Anybody know about such a function?

   > Something like that (warning: barely tested)

   > (defun vc-annotate-goto-line ()
   >   (interactive)
   >   (unless (eq major-mode 'vc-annotate-mode)
   >     (error "vc-annotate-goto-line must be used on a VC-Annotate buffer"))
   >   (let* ((name (buffer-name))
   >          (base (and (string-match "Annotate \\(.*\\) (rev" name)
   >                     (match-string 1 name)))
   >          (line (save-restriction
   >                  (widen)
   >                  (line-number-at-pos))))
   >     (with-current-buffer (get-buffer base)
   >       (pop-to-buffer (current-buffer))
   >       (save-restriction
   >         (widen)
   >         (goto-char (point-min))
   >         (forward-line (1- line))
   >         (recenter)))))



Right from a practical point this is what  I am looking for,
thanks a lot. It does not jump precisely to the line, but as
close as 4 lines. 
Look at this example 
VC-annote buffer 
2010-03-06  1.7 :   \end{itemize}
2010-03-06  1.7 : \end{frame}
2011-03-01  1.10: 
2010-03-06  1.7 : \begin{frame}
2010-03-02  1.1 : 
2011-03-01  1.10:   \only<article>{ Si intentamos conseguir que el} Error Global de
2011-03-01  1.10:   Discretización sea del mismo orden que el Error Local de
2011-03-01  1.10:   Truncamiento, \only<article>{está claro que} necesitamos que
2011-03-01  1.10:   $|x_{0}-a|=O(h^{2})$ y $|x_{1}-x(t_{1})|=O(h^{2})$ en cuyo caso

Cursor is on 1.10    \only<article>{ Si intentamos conseguir que el} 

Your functions jumps to line starting with
\end{itemize}


As I said the difference of these for lines are not
important I was just wondering ...


Thanks again.

Uwe 




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

* Re: vc-annotate and jump to a specific line
  2011-03-25 11:43   ` Uwe Brauer
@ 2011-03-25 11:52     ` Juanma Barranquero
  2011-03-26 11:33       ` Uwe Brauer
  0 siblings, 1 reply; 7+ messages in thread
From: Juanma Barranquero @ 2011-03-25 11:52 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-devel

On Fri, Mar 25, 2011 at 12:43, Uwe Brauer <oub@mat.ucm.es> wrote:

> As I said the difference of these for lines are not
> important I was just wondering ...

I don't know. Perhaps you're using visual-line-mode or somesuch?

    Juanma



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

* Re: vc-annotate and jump to a specific line
  2011-03-25 11:52     ` Juanma Barranquero
@ 2011-03-26 11:33       ` Uwe Brauer
  2011-03-26 23:05         ` Juanma Barranquero
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2011-03-26 11:33 UTC (permalink / raw)
  To: emacs-devel

>> Regarding Re: vc-annotate and jump to a specific line; Juanma Barranquero <lekktu@gmail.com> adds:

   > On Fri, Mar 25, 2011 at 12:43, Uwe Brauer <oub@mat.ucm.es> wrote:
   >> As I said the difference of these for lines are not
   >> important I was just wondering ...

   > I don't know. Perhaps you're using visual-line-mode or somesuch?

No, edebug also did not give anything useful. In any case I
suggest to include your function in further releases of vc.

Uwe 




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

* Re: vc-annotate and jump to a specific line
  2011-03-26 11:33       ` Uwe Brauer
@ 2011-03-26 23:05         ` Juanma Barranquero
  2011-03-27  9:28           ` Uwe Brauer
  0 siblings, 1 reply; 7+ messages in thread
From: Juanma Barranquero @ 2011-03-26 23:05 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-devel

On Sat, Mar 26, 2011 at 12:33, Uwe Brauer <oub@mat.ucm.es> wrote:

> No, edebug also did not give anything useful.

Are you able to reproduce the effect with a file which I can annotate
(one on the Emacs sources, for example)? I'm curious about the
problem, because moving to the right line is straightforward enough
that there shouldn't be any discrepancy.

> In any case I
> suggest to include your function in further releases of vc.

Please send a "wishlist" bug report so the issue is not forgotten.

    Juanma



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

* Re: vc-annotate and jump to a specific line
  2011-03-26 23:05         ` Juanma Barranquero
@ 2011-03-27  9:28           ` Uwe Brauer
  0 siblings, 0 replies; 7+ messages in thread
From: Uwe Brauer @ 2011-03-27  9:28 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-devel

>> Regarding Re: vc-annotate and jump to a specific line; Juanma Barranquero <lekktu@gmail.com> adds:

   > On Sat, Mar 26, 2011 at 12:33, Uwe Brauer <oub@mat.ucm.es> wrote:
   >> No, edebug also did not give anything useful.

   > Are you able to reproduce the effect with a file which
   > I can annotate (one on the Emacs sources, for example)? 
   > I'm curious about the problem, because moving to the
   > right line is straightforward enough that there
   > shouldn't be any discrepancy.


I did some more testing and it might be that part of the
problem is hidden deep in my init file. So I have to dig
this out myself.

However I tried emacs -no-init and then the function worked
better. By better I mean it worked fine even in files with a
lot of checkins but only in the branch where the version
number started with 1.X, for version whose version number
started with 2. your function behaved in the way I
described.

I have only access to emacs 22.1 at the moment. 
What about taking simple.el? 
I think this file should the
same for emacs 22 and 23?
Thanks 

Uwe 




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

end of thread, other threads:[~2011-03-27  9:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-24 19:01 vc-annotate and jump to a specific line Uwe Brauer
2011-03-24 23:34 ` Juanma Barranquero
2011-03-25 11:43   ` Uwe Brauer
2011-03-25 11:52     ` Juanma Barranquero
2011-03-26 11:33       ` Uwe Brauer
2011-03-26 23:05         ` Juanma Barranquero
2011-03-27  9:28           ` Uwe Brauer

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).