From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Re: can I move back to the last edit position? Date: 13 Sep 2004 10:55:44 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <87oekea5ng.fsf@thalassa.informatimago.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1095066152 8483 80.91.229.6 (13 Sep 2004 09:02:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 13 Sep 2004 09:02:32 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 13 11:02:23 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C6mj9-0002Ym-00 for ; Mon, 13 Sep 2004 11:02:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6mof-0001fu-1X for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Sep 2004 05:08:05 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!proxad.net!newsfeed.stueberl.de!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-X-Trace: news.uni-berlin.de b6V01BJg3D2aHfx5xwBCFg6e4wr9EodRN4obMuyas+iSeFz5lW User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Xref: shelby.stanford.edu gnu.emacs.help:125299 Original-To: help-gnu-emacs@gnu.org 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: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:20654 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:20654 Oliver Scholz writes: > > Micha Feigin wrote on Fri, 10 Sep 2004 15:53:43 +0300: > >> On Fri, Sep 10, 2004 at 04:49:03PM +0800, Rokia wrote: > > > >>> I think this [moving back to the position of the last edit] is a necessary > >>> and basic function. why cant I find it? > > > > I tend to agree, but I've managed to get along without it for some years. > > You can't find it because it doesn't exist in Emacs. > [...] > > I think Eli was right to ask for more details here. For instance, > Emacs does store the current position of point to the global mark ring > in some circumstances. So you can jump back to the position of point > before you issued the command that moved it by hitting `C-u C-SPC' -- > depending on the command. That doesn't work for C-n, C-p etc. (I > hardly see how that would be useful), but it does work for M-<, > M-C-a, C-s ... For a newcomer in Emacs, it is very easy to press the "wrong" keystrokes and end up in some place in a buffer you did not intend to go to, I have been there myself but do not have this problem much nowadays. Anyway, in the book "Writing GNU Emacs Extensions" is a interesting idea to solve the I-navigated-ten-lightyears-by-mistake-and-don't-know-how-to-get-back problem by using advices on all, or most, functions that move point. If two or more functions adviced as a "move-point-function" was hit in a row, we would store the position all the time, so that, when you panic because you jumped somewhere you did not intend to, you could call the "take-me-back-please" function. The concept is fairly easy, the "only" way we need to do is to define which these functions are. I think I have some code some place regarding this. If I found it I will post it here. /Mathias