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

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

Re: Why save-excursion doesn't restore cursor position after 3 kill-line


From: Barry Margolin
Subject: Re: Why save-excursion doesn't restore cursor position after 3 kill-line calls?
Date: Fri, 28 Nov 2008 05:00:15 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article 
<429c5cab-0015-4eb6-a794-ce990c6255d6@q26g2000prq.googlegroups.com>,
 "seberino@spawar.navy.mil" <seberino@spawar.navy.mil> wrote:

> I'm trying to map C-d to a function that deletes an entire line and
> stops on the *SAME* column number of the following line....
> 
> (global-set-key "\^d" (lambda () (interactive) (save-excursion (kill-
> line)
>  
> (kill-line 0)
>  
> (kill-line))))
> 
> Why doesn't save-excursion preserve the column number after these kill-
> line invocations?
> 
> chris

save-excursion restores the location in the buffer, not the row and 
column positions.  If the text around the location is deleted, it finds 
the closest remaining location.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

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