[Top][All Lists]

[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: Fri, 16 Dec 2016 17:30:21 -0800 (PST)

> > Not a problem for me.  And doesn't have to be a problem for
> > vanilla Emacs users either, if the proper commands are added.
> You're actually proposing a change to the current narrowing-widening UI
> and API. That should indicate that the current one is insufficient, or,
> has problems.

I didn't propose anything.  The point is that it is not a big
deal to remember two positions and return the buffer limits
to them later.

> I'm not in any hurry to adopt it, though, because it doesn't solve any
> multi-mode problems. Not by itself, at least.

I'm not asking you to adopt it.

I'm asking you not to replace narrowing, as changing buffer
limits, to something else, based on overlays or whatever.

I'm asking you not to reserve narrowing for Lisp and give
users some ersatz for it.  Users and Lisp are not two
different universes.

> > In my case:
> > 1. `C-x n n' to "focus on reading" a paragraph in the node.
> > 2. `C-x n x' to return to the full node (not all of Info).
> > End of story.
> What happens if you press `C-x n x' once more?

If you have other restrictions in the ring, then it picks
up the previous one.  And so on, until it gets to the
beginning, and then it wraps around to the last one.

So if you have only one restriction, as in just #1 then #2,
above, then repeating `C-x n x' gets you back to #1: the

IOW, it's like any other ring in Emacs.

> In any case, you've introduced "a different kind of narrowing" yourself.
> Your `C-x n n' command does something else than just call narrow-to-region.

Oh, yes; a GIANT change (?) ;-)

(defadvice narrow-to-region (before zz-add-zone activate)
  "Push the region limits to the current `zz-izones-var'.
You can use `C-x n x' to widen to a previous buffer restriction.

This is a destructive operation. The list structure of the variable
value can be modified."
  (when (or (interactive-p)  zz-add-zone-anyway-p)
    (let ((start  (ad-get-arg 0))
          (end    (ad-get-arg 1)))
      (unless start (setq start  (region-beginning))) ; Needed for Emacs 20.
      (unless end   (setq end    (region-end)))
      (zz-add-zone start end nil nil nil 'MSG))))

Pretty drastic, huh?  It adds the restriction to a ring variable.

reply via email to

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