emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs's handling of line numbers [from bug#5042]


From: Mark Lillibridge
Subject: Re: Emacs's handling of line numbers [from bug#5042]
Date: Sat, 17 Apr 2010 12:51:17 -0700

Eli wrote:
>  > From: Stefan Monnier <address@hidden>
>  > Cc: address@hidden,  address@hidden
>  > Date: Sat, 17 Apr 2010 10:45:19 -0400
>  > 
>  > > What are these two ``kinds'' of restriction you are talking about, and
>  > > how are they relevant to the issue at hand, which is how to number
>  > > lines when a buffer is narrowed?
>  > 
>  > He's proposing to distinguish between two different kinds of narrowing
>  > (aka "restrictions").
>  
>  Yes, but what _are_ these two kinds?  How are they different from one
>  another?

    Sorry, I should've explained better.  Originally, the issue was just
how to do line numbering, but Stefan suggested widening the issue.


    Broadly speaking, the issue arises with "applications" like Rmail
and Info that use a single Emacs buffer as what amounts to a collection
of logical buffers; they switch among these logical buffers by
restricting the Emacs buffer to the logical buffer in question.  Thus,
for example Rmail restricts my inbox file to just the current message.
When I advance to a different message, it changes the restriction to
the new message.  Info is similar, but instead of messages, it is
nodes(?).

    Unfortunately, many Emacs features don't expect this and so behave
suboptimally.  For example, font lock attempts to process the entire
buffer instead of just the current logical buffer; font-lock-dont-widen
was invented to allow these applications to prevent this.  The example
which started this discussion is line numbering: goto-line numbers lines
based on the physical buffer while linum mode numbers lines based on the
logical buffer (actually, the current restriction).

    Things get even messier when the user narrows the (logical) buffer
temporarily, say to limit macro application.  If the application used
font-lock-dont-widen, then font locking will attempt to run only on the
temporary restriction, probably with confusing results.


    The intuition is that these two kinds of restrictions, the first for
creating logical buffers, and the second for temporary limitation of
commands, are fundamentally different and should be distinguished.  Does
that make more sense?

- Mark




reply via email to

[Prev in Thread] Current Thread [Next in Thread]