From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: Why save-excursion doesn't restore cursor position after 3 kill-line calls? Date: Fri, 28 Nov 2008 05:00:15 -0500 Organization: A noiseless patient Spider Message-ID: References: <429c5cab-0015-4eb6-a794-ce990c6255d6@q26g2000prq.googlegroups.com> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1227869041 7988 80.91.229.12 (28 Nov 2008 10:44:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Nov 2008 10:44:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 28 11:45:05 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L60qO-0007wC-1g for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Nov 2008 11:45:04 +0100 Original-Received: from localhost ([127.0.0.1]:34359 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L60pE-0003Nk-AM for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Nov 2008 05:43:52 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!feeder.erje.net!news.motzarella.org!motzarella.org!news.motzarella.org!barmar Original-Newsgroups: gnu.emacs.help Original-Lines: 28 Original-X-Trace: news.motzarella.org U2FsdGVkX19ZXuu2gb7qRwnjoLHS3fkGkU3yOfjiRRAqLSktqzIW44+DzDLsL8q6H/FtQvrL/MmFWYQWCQUuxwLp29geBSNZ+TbndKSuwsyVLDOvAqw/RBEV3lvEjJ5rW9a4fs3dE6Y= Original-X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers Original-NNTP-Posting-Date: Fri, 28 Nov 2008 10:00:14 +0000 (UTC) X-Auth-Sender: U2FsdGVkX1+HuX1VlCH6Wl9Ologh3KYhCJh7tgdLgDM= Cancel-Lock: sha1:YhGb/1RE0MwRSflYOJM0SoA43Qg= User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Mail-Copies-To: nobody Original-Xref: news.stanford.edu gnu.emacs.help:164859 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60187 Archived-At: In article <429c5cab-0015-4eb6-a794-ce990c6255d6@q26g2000prq.googlegroups.com>, "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 ***