emacs-devel
[Top][All Lists]
Advanced

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

RE: widen-one-level [was: Emacs's handling of line numbers]


From: Drew Adams
Subject: RE: widen-one-level [was: Emacs's handling of line numbers]
Date: Sun, 18 Apr 2010 17:25:50 -0700

> > If you want to get a quick idea what this would be like, eval this
> > code and bind `widen-one-level' (e.g. to `C-x n w' ;-)).
> 
> I propose a better UI compatible with current commands:
> bind `C-x n w' to a new user command `widen-command' that
> by default works exactly like `widen' currently works,
> i.e. without a prefix argument, widen completely.
> 
> But with a numeric prefix it will widen that many levels,
> e.g. `C-u 1 C-x n w' for one level.

I prefer something like this:
http://www.emacswiki.org/emacs/wide-n.el

It follows this suggestion I made:

>> Another possibility would be to make a restriction ring, 
>> instead of a stack, and let you browse among the restrictions...

* The binding is `C-x n x', not `C-x n w'.
  You can still use `C-x n w' normally.
* You can repeat the `x' to cycle: `C-x n x x x'...
* Use a plain prefix arg (`C-u') to widen completely.
* Use a prefix arg N < 0 to widen completely and empty the ring.
* Use a prefix arg N >= 0 to go to the Nth previous restriction.

You can have any number of regions that you can return to as restrictions. They
can be, but need not be, nested.

---

One question I have, at least for this library if something like this is not
added to Emacs: In which of the two categories of primitive functions is
`narrow-to-region' (quoting from Stefan's mail to bug #5863 thread):

> there are several categories of functions:
> - functions that have their own byte-code (things like widen, 
>   car, cdr, ...).
> - functions that are implemented in C but don't have their own
>   byte-code.
> - other functions.
> 
> Pieces of advice on the first kind of functions only work for
> calls from interpreted Lisp code. Pieces of advice on the
> second kind of functions only work for calls from Lisp code
> (both interpreted and byte-compiled).

If `narrow-to-region' has its own byte-code, then I'll add a note to the library
telling users not to byte-compile it.

And for future reference, how to tell whether a primitive has its own byte-code?
And shouldn't this info about advising primitives be documented? (see bug #5863)










reply via email to

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