Large text files - no line numbers ?

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Large text files - no line numbers ?

jonetsu
When browsing large text files, 'L??' is shown instead of line
numbers.  Is it possible to have line numbers, is there an option hat
would allow it ?  Would be useful in setting bookmarks.


Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

Robert Pluim
>>>>> On Wed, 4 Dec 2019 09:47:04 -0500, jonetsu <[hidden email]> said:

    jonetsu> When browsing large text files, 'L??' is shown instead of line
    jonetsu> numbers.  Is it possible to have line numbers, is there an option hat
    jonetsu> would allow it ?  Would be useful in setting bookmarks.

I assume you mean in the mode line? What's your value of
line-number-display-limit? (and I donʼt think bookmarks depend on
being able to show the line number, at least not the ones created by
'C-x r m')

Robert


Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

jonetsu
On Wed, 04 Dec 2019 15:57:49 +0100
Robert Pluim <[hidden email]> wrote:

> I assume you mean in the mode line? What's your value of
> line-number-display-limit? (and I donʼt think bookmarks depend on
> being able to show the line number, at least not the ones created by
> 'C-x r m')

It's currently set to 'no limit'.  The mode is Fundamental and the
percentage into the file is shown.  But no line numbers. And yes, adding
bookmarks from that 733K file results in all bookmarks pointing at the
same location, Whereas bookmarks are working fine for other files.

There's another variable though, called line-number-display-limit-width
which was set to 200.  Setting it to 1000 (arbitrary number for
testing) brings back the line numbers in the mode line.

Thanks for the hint.

Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

Eli Zaretskii
In reply to this post by Robert Pluim
> From: Robert Pluim <[hidden email]>
> Date: Wed, 04 Dec 2019 15:57:49 +0100
>
> >>>>> On Wed, 4 Dec 2019 09:47:04 -0500, jonetsu <[hidden email]> said:
>
>     jonetsu> When browsing large text files, 'L??' is shown instead of line
>     jonetsu> numbers.  Is it possible to have line numbers, is there an option hat
>     jonetsu> would allow it ?  Would be useful in setting bookmarks.
>
> I assume you mean in the mode line? What's your value of
> line-number-display-limit?

There's also line-number-display-limit-width, for when the file has
long lines.

Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

jonetsu
In reply to this post by jonetsu
On Wed, 4 Dec 2019 10:07:41 -0500
jonetsu <[hidden email]> wrote:

> There's another variable though, called
> line-number-display-limit-width which was set to 200.  Setting it to
> 1000 (arbitrary number for testing) brings back the line numbers in
> the mode line.

I'm afraid that even with that set, bookmarks (C-x r m <name given> )
appears to be quite broken for that 733K log file in Fundamental mode.
Condition stays the same after restarting emacs.  Add a bookmark and all
bookmarks will be pointing to the last one.


Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

jonetsu
In reply to this post by Eli Zaretskii
On Wed, 04 Dec 2019 17:31:07 +0200
Eli Zaretskii <[hidden email]> wrote:

> There's also line-number-display-limit-width, for when the file has
> long lines.

It looks as if the bookmark functionality (C-x r m) is unaffected by
this setting and will simply behave wrongly no matter and is thus
useless in this case.


Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

Stefan Monnier
> It looks as if the bookmark functionality (C-x r m) is unaffected by
> this setting and will simply behave wrongly no matter and is thus
> useless in this case.
             ^^^^
For some value of "this" which you have kept secret so far.


        Stefan


Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

Robert Pluim
In reply to this post by jonetsu
>>>>> On Thu, 5 Dec 2019 09:44:21 -0500, jonetsu <[hidden email]> said:

    jonetsu> On Wed, 04 Dec 2019 17:31:07 +0200
    jonetsu> Eli Zaretskii <[hidden email]> wrote:

    >> There's also line-number-display-limit-width, for when the file has
    >> long lines.

    jonetsu> It looks as if the bookmark functionality (C-x r m) is unaffected by
    jonetsu> this setting and will simply behave wrongly no matter and is thus
    jonetsu> useless in this case.

Thatʼs surprising, since the bookmark function records the value of
(point), which should always be available regardless of whether Emacs
can determine the line number.

Does it fail from 'emacs -Q' as well?

Robert



Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

jonetsu
In reply to this post by Stefan Monnier
On Thu, 05 Dec 2019 09:50:39 -0500
Stefan Monnier <[hidden email]> wrote:

> For some value of "this" which you have kept secret so far.

Yesterday I replied that the file size was 733K.  That it was a log
file.  And that setting an arbitrary/test value of 1000 (default: 200)
in line-number-display-limit-width solved the problem as far the the
mode line line numbers are concerned as they went from 'L??' to
'L<actual number>'.  I can add that the file is a text file.

What else ?  emacs is: GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, X
toolkit, Xaw3d scroll bars) of 2019-01-28.

Basically the use case is:

Load the log file.  See that the line number display is:
'L??'.  Try to set several bookmarks, they do not go back to the lines
they were set.  Ask here. Modify the line-number-display-limit-width to
1000.  See that the line numbers are now displayed.  Set some
bookmarks.  Bookmark behaviour is still wrong.

Let me know if there are other details that are needed.  



Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

Eli Zaretskii
In reply to this post by jonetsu
> Date: Thu, 5 Dec 2019 09:44:21 -0500
> From: jonetsu <[hidden email]>
>
> On Wed, 04 Dec 2019 17:31:07 +0200
> Eli Zaretskii <[hidden email]> wrote:
>
> > There's also line-number-display-limit-width, for when the file has
> > long lines.
>
> It looks as if the bookmark functionality (C-x r m) is unaffected by
> this setting and will simply behave wrongly no matter and is thus
> useless in this case.

Sorry, I don't understand.  What do you mean by "unaffected", and what
do you mean by "behave wrongly"?

All I was saying was that sometimes one sees L?? in the mode line
because the lines are too long, not because there are too many lines.
When the reason is the line length, you need to customize
line-number-display-limit-width, not line-number-display-limit.

How is this related to bookmarks?

Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

jonetsu
In reply to this post by Robert Pluim
On Thu, 05 Dec 2019 15:56:21 +0100
Robert Pluim <[hidden email]> wrote:

> Thatʼs surprising, since the bookmark function records the value of
> (point), which should always be available regardless of whether Emacs
> can determine the line number.
>
> Does it fail from 'emacs -Q' as well?

Yes it does.  I used bookmark-bmenu-list to list the named bookmarks.
The mode line line numbers were shown as 'L??'

Here is the content of the ~/.emacs.d/bookmarks file.  I'm afraid I had
to replace some text in there, eg. path and file name, reference text
(sometext). The rest is as is.


;;;; Emacs Bookmark Format Version 1 ;;;; -*- coding: utf-8-emacs -*-
;;; This format is meant to be slightly human-readable;
;;; nevertheless, you probably don't want to edit it.
;;; -*- End Of Bookmark File Format Version Stamp -*-
(("test2"
 (filename . "logfile.log")
 (front-context-string . "1/sometext")
 (rear-context-string . "nclude -I/home/x")
 (position . 264231))
("test1"
 (filename . "logfile.log")
 (front-context-string . "sometext production")
 (rear-context-string . "sutil3.empty.o\n\n")
 (position . 88415))

Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

jonetsu
In reply to this post by Eli Zaretskii
On Thu, 05 Dec 2019 17:22:55 +0200
Eli Zaretskii <[hidden email]> wrote:

> Sorry, I don't understand.  What do you mean by "unaffected", and what
> do you mean by "behave wrongly"?

Unaffected means that whereas putting 1000 in
line-number-display-limit-width has solved the 'L??' by making it
display actual line numbers, the bookmark functionality behaves wrongly
as it will not jump to a bookmark, but somewhere else in the file.  As
it did before updating the line-number-display-limit-width value.

It behaves wrongly in the sense that since line numbers are now
displayed correctly, it could be right to assume that the bookmarks
will now work as intended (they did not when L?? was displayed) - but
they do not.

It also behaves wrongly in this use case as setting bookmarks in other,
much smaller files, still works as expected.

> How is this related to bookmarks?

By assuming that the L?? display also prevented the bookmark
feature from functioning correctly.  Mind you, I do not know how the
bookmark feature works.


Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

Eli Zaretskii
> Date: Thu, 5 Dec 2019 10:46:11 -0500
> From: jonetsu <[hidden email]>
>
> Unaffected means that whereas putting 1000 in
> line-number-display-limit-width has solved the 'L??' by making it
> display actual line numbers, the bookmark functionality behaves wrongly
> as it will not jump to a bookmark, but somewhere else in the file.  As
> it did before updating the line-number-display-limit-width value.
>
> It behaves wrongly in the sense that since line numbers are now
> displayed correctly, it could be right to assume that the bookmarks
> will now work as intended (they did not when L?? was displayed) - but
> they do not.

AFAIK, there's no relation whatsoever between the line-number display
in the mode line and bookmarks.

> > How is this related to bookmarks?
>
> By assuming that the L?? display also prevented the bookmark
> feature from functioning correctly.

It doesn't, AFAICT.

Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

jonetsu
On Thu, 05 Dec 2019 18:40:57 +0200
Eli Zaretskii <[hidden email]> wrote:

> It doesn't, AFAICT.

It's OK.  So the bookmark functionality is simply broken in this case.


Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

Stefan Monnier
In reply to this post by jonetsu
> Load the log file.  See that the line number display is: 'L??'.

Line numbers shouldn't affect bookmarks at all, so this is likely a red herring.

> Try to set several bookmarks, they do not go back to the lines
> they were set.

How do you set the bookmarks?  How do you "go back" to them?
What happens between the two operations?  Where do they go instead of
where you wanted (they are not supposed to go back to "a line" but to
a buffer position instead)?


        Stefan


Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

jonetsu
On Fri, 06 Dec 2019 13:16:10 -0500
Stefan Monnier <[hidden email]> wrote:

> Line numbers shouldn't affect bookmarks at all, so this is likely a
> red herring.

Could very well be.  The main subject is about the display of L??.
Then I noticed that bookmarks on that file did not work.  So maybe by
having the correct line number being displayed ...  It's all
assumption.  Maybe I should have started another thread in retrospect.

> How do you set the bookmarks?  How do you "go back" to them?
> What happens between the two operations?  Where do they go instead of
> where you wanted (they are not supposed to go back to "a line" but to
> a buffer position instead)?

C-x r m for setting.  I always give a name to the bookmark.  Then
bookmark-bmenu-list to show them and cursor or mouse to select one.

I always delete the existing ~/emacs.d/boomarks file before doing any
tests.  Or erase the current ones if they were not saved.

In the 733K log file, I go to line # 423 and set a bookmark named
'test1'.  Then I scroll further down to line # 536 and set a 'test2'
bookmark.  Jumping to the first bookmark will jump to the last one.
Jumping to the last one will jump tot he last one.

Setting a 3rd bookmark named 'test3' at line # 762 makes all bookmarks
jump to that line/location.

Do you think there's a possibility that some other lisp code in
the .emacs file could interfere with the bookmarks behaviour ?
Through time I have copy/pasted some useful snippets found here and
there.


Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

Stefan Monnier
> Do you think there's a possibility that some other lisp code in
> the .emacs file could interfere with the bookmarks behaviour ?

That would be my first guess, yes.


        Stefan "via Teksavvy as well"


Reply | Threaded
Open this post in threaded view
|

Re: Large text files - no line numbers ?

jonetsu
On Fri, 06 Dec 2019 14:08:32 -0500
Stefan Monnier <[hidden email]> wrote:

> That would be my first guess, yes.

Thanks, I'll try to read through the lisp code :)  See if there could be
any interaction.

>         Stefan "via Teksavvy as well"

I noticed the UdM.  J'ai vécu à Montréal.

Cheers.