emacs-devel
[Top][All Lists]
Advanced

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

RE: forward-comment and syntax-ppss


From: Drew Adams
Subject: RE: forward-comment and syntax-ppss
Date: Sun, 5 Feb 2017 15:33:05 -0800 (PST)

> 3) Interactive narrowing should be stack-based, so that
>    you can easily narrow to things, do something, then
>    narrow some more, and then pop that narrowing to return
>    to the previous.  It's something I have wanted for a
>    long time.

Well, you have it.  That's just what I showed with the
`zones.el' code I use.

See this message in the same thread:
http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00693.html
and https://www.emacswiki.org/emacs/MultipleNarrowings
for a general description.

Just as you requested, when you narrow the buffer
interactively (only), that narrowing (restriction, or
"zone") is put on a stack.

Only it's not just a stack.  It's a ring.  You can access
it as a stack, a list, or a ring, or directly access
(restore) any restriction by its identifier or its ring
position.  And markers are used for the restriction limits,
so the zones adjust to text insertions and deletions.

And don't think that the restrictions on the ring need
to all be nested inside each other like russian dolls.
They can each have any buffer limits.  They can even be
in different buffers (or not).  And you can have any
number of such rings at the same time.

Though very simple, it is really quite useful, IMO.

This message shows the code that pushes the restriction
to the current ring:
http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00702.html

It just advises `narrow-to-region' (which is defined in C).

Of course, _use_ of the ring is not limited to interactive
use.  It is just automatic pushing to the ring that is done
only interactively.



reply via email to

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