Quantcast

bug#26417: 25.2; Add current-line in simple.el

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26417: 25.2; Add current-line in simple.el

Damien Cassou-2
Hi,

attached patch adds `current-line' and its tests. This new
function returns the line number at given position ignoring
narrowing.

I guess that `what-line' could be refactored using
`current-line'. I can do that if you want.

Best,

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

0001-Add-current-line-in-simple.el.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26417: 25.2; Add current-line in simple.el

Nicolas Petton-2
Damien Cassou <[hidden email]> writes:

> Hi,

Hi Damien,

> attached patch adds `current-line' and its tests. This new
> function returns the line number at given position ignoring
> narrowing.

I know narrowing have no effect on `current-column', but does it make
sense to widen the buffer for `current-line'? (I don't have a strong
opinion, but I think it's worth asking the question).

Other than that, I think this is useful, thanks for the patch.

> I guess that `what-line' could be refactored using
> `current-line'. I can do that if you want.

Yes, that'd be good.

Cheers,
Nico

signature.asc (482 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26417: 25.2; Add current-line in simple.el

Damien Cassou-2
Nicolas Petton <[hidden email]> writes:
> I know narrowing have no effect on `current-column', but does it
> make sense to widen the buffer for `current-line'? (I don't have
> a strong opinion, but I think it's worth asking the question).

The existing function `line-number-at-pos` returns the line number
relative to current narrowing. I need a function that returns the
absolute line number (as I need to save the line number in a
separate file so that I can later open at the appropriate
line). Do you think the function name is misleading? What about
one of these?

- line-number-at-pos-absolute
- current-absolute-line


--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#26417: 25.2; Add current-line in simple.el

Nicolas Petton-2
Damien Cassou <[hidden email]> writes:

> Nicolas Petton <[hidden email]> writes:
>> I know narrowing have no effect on `current-column', but does it
>> make sense to widen the buffer for `current-line'? (I don't have
>> a strong opinion, but I think it's worth asking the question).
>
> The existing function `line-number-at-pos` returns the line number
> relative to current narrowing. I need a function that returns the
> absolute line number (as I need to save the line number in a
> separate file so that I can later open at the appropriate
> line). Do you think the function name is misleading? What about
> one of these?
What about something like this:

    (defun current-line (&optional ignore-narrowing)
      ...)

Cheers,
Nico

signature.asc (482 bytes) Download Attachment
Loading...