[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Understanding save-excursion
From: |
David Kastrup |
Subject: |
Re: Understanding save-excursion |
Date: |
Mon, 21 Mar 2011 09:45:48 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Deniz Dogan <deniz.a.m.dogan@gmail.com> writes:
> Why isn't point and mark restored after calling this function?
>
> (defun mark-paragraph-and-sort-lines ()
> (interactive "*")
> (save-excursion
> (mark-paragraph)
> (sort-lines nil (point) (mark))))
What makes you think they aren't restored? Point and mark are saved in
_pointers_, and pointers move along with text that is copied.
This would presumably do what you want if point was saved in a
rear-sticky pointer and mark in a front-sticky pointer. Or just in
integers.
As it is, it is not all too clear what happens when you transfer
material to and from the boundaries of the region.
--
David Kastrup