unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: tyler <tyler.smith@mail.mcgill.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Why save-excursion doesn't restore cursor position after 3 kill-line calls?
Date: Sat, 29 Nov 2008 13:28:55 -0400	[thread overview]
Message-ID: <877i6mjvag.fsf@blackbart.sedgenet> (raw)
In-Reply-To: barmar-28CDD1.03211129112008@mara100-84.onlink.net

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <mailman.1463.1227914342.26697.help-gnu-emacs@gnu.org>,
>  tyler <tyler.smith@mail.mcgill.ca> wrote:
>
>> Thanks. I think I understand, at least generally, what's going on now.
>> Markers are a new concept for me, so I'll have to do some more reading
>> to sort out the details.
>
> Here's a simple example that may help.  Suppose you have a buffer 
> containing:
>
> 1 abcdef
> 2 123456
> 3 wxyz
>
> and point is on line 2 between 3 and 4.  You write a function that uses 
> save-excursion while it deletes line 1.  When the save-excursion ends, 
> point will still be between 3 and 4, although this will now be line 1.
>
> The intent is to continue pointing to the same text that it originally 
> pointed to.  But if that text itself is deleted, this is obviously not 
> possible.  Any markers that were within the deleted text will end up 
> pointing to the place where the text used to be.

Thanks, that does help!

Tyler

-- 
I never loan my books, for people never return them. The only books
remaining in my library are those I’ve borrowed from others. 





      reply	other threads:[~2008-11-29 17:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-28  4:40 Why save-excursion doesn't restore cursor position after 3 kill-line calls? seberino
2008-11-28 10:00 ` Barry Margolin
2008-11-28 15:59   ` tyler
2008-11-28 22:49     ` Stephen Berman
     [not found]   ` <mailman.1440.1227888009.26697.help-gnu-emacs@gnu.org>
2008-11-28 16:43     ` Xah Lee
2008-11-28 20:18       ` tyler
     [not found]       ` <mailman.1449.1227903504.26697.help-gnu-emacs@gnu.org>
2008-11-28 22:35         ` Andreas Politz
2008-11-28 23:18           ` tyler
     [not found]           ` <mailman.1463.1227914342.26697.help-gnu-emacs@gnu.org>
2008-11-29  8:21             ` Barry Margolin
2008-11-29 17:28               ` tyler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877i6mjvag.fsf@blackbart.sedgenet \
    --to=tyler.smith@mail.mcgill.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).