[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] add interactive browse of revisions from vc *Annotate* buffe
From: |
Kim F. Storm |
Subject: |
Re: [patch] add interactive browse of revisions from vc *Annotate* buffers |
Date: |
20 Jan 2004 02:28:34 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
Benjamin Rutt <address@hidden> writes:
> Kai Grossjohann <address@hidden> writes:
>
> > Andre Spiegel <address@hidden> writes:
> >
> >> I'm a bit puzzled by your function vc-current-line. I must admit that
> >> I'm totally clueless in this area, but is there really no simpler way to
> >> determine this? Surely, this problem must have occured elsewhere
> >> already. Anybody got a hint for us?
> >
> > Wow, what-line uses the same logic, it seems.
>
> So maybe what-line could be modified to return a useful value, namely
> the line number as an integer?
I think we should make a line-at-pos function:
(defun line-at-pos (&optional pos)
"Return buffer line number and narrowed line number at position POS.
If POS is nil, use current buffer location.
Return value is line-number or a cons (line-number narrowed-line-number)."
(let ((opoint (or pos (point))) start)
(save-excursion
(save-restriction
(goto-char (point-min))
(widen)
(forward-line 0)
(setq start (point))
(goto-char opoint)
(forward-line 0)
(if (/= start (point-min))
(cons (1+ (count-lines (point-min) (point)))
(1+ (count-lines start (point))))
(1+ (count-lines (point-min) (point))))))))
and then implement what-line in terms of this function:
(defun what-line ()
"Print the current buffer line number and narrowed line number of point."
(interactive)
(let ((l (line-at-pos (point))))
(if (consp l)
(message "line %d (narrowed line %d)" (car l) (cdr l))
(message "Line %d" l))))
--
Kim F. Storm <address@hidden> http://www.cua.dk
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, (continued)
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Richard Stallman, 2004/01/14
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Kim F. Storm, 2004/01/14
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Andre Spiegel, 2004/01/15
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Richard Stallman, 2004/01/16
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Kim F. Storm, 2004/01/16
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Richard Stallman, 2004/01/17
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Benjamin Rutt, 2004/01/17
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Andre Spiegel, 2004/01/19
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Kai Grossjohann, 2004/01/19
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Benjamin Rutt, 2004/01/19
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers,
Kim F. Storm <=
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Richard Stallman, 2004/01/20
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Kim F. Storm, 2004/01/21
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Stefan Monnier, 2004/01/21
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Kim F. Storm, 2004/01/21
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Stefan Monnier, 2004/01/21
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Kim F. Storm, 2004/01/22
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Andre Spiegel, 2004/01/22
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Benjamin Rutt, 2004/01/22
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Richard Stallman, 2004/01/22
- Re: [patch] add interactive browse of revisions from vc *Annotate* buffers, Miles Bader, 2004/01/22