bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: save-excursion doesn't save point?


From: Miles Bader
Subject: Re: save-excursion doesn't save point?
Date: Tue, 11 Jun 2002 19:06:18 GMT

kevinr@ihs.com (Kevin Rodgers) writes:
> > It could be generally useful.  Emacs already has shuffle-vector.
> 
> Then it seems the simplest implementation would be to read the region
> into a vector, shuffle the vector, then overwrite the region with the
> vector's contents.

Or better yet, do it indirectly, just have two vectors, one holding the
position of the start of each line in the buffer, and the other holding
indices into the first vectors.  Use `shuffle-vector' to shuffle the
second vector and do a single pass over it inserting the shuffled lines
_after_ the original lines.  Then just delete the region holding the
original lines.

That would be _much_ more efficient....

-Miles
-- 
I'd rather be consing.



reply via email to

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