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

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

Re: how to just back to previous location quickly?


From: Stefan Kamphausen
Subject: Re: how to just back to previous location quickly?
Date: 24 Apr 2003 05:50:18 -0700

Hi,

wang yin <wy@wangyin.com> wrote in message news:<phn0ig6zwu.fsf@wangyin.com>...
> Hi,
> 
> I use M-. to go to a tag. And I M-. to some other places...
> And I can M-* to get back to where I was step by step.
> 
> But how can I get forth then? 
> I mean, if I jump to other locations with grep, tag, ... How can I
> quickly get back to where I was? bookmarks are too slow.

I've been using the following code for several years and I am very
happy with it. You just quickly store your position (using C-. in my
setting), move somewhere else and then can toggle between the stored
and the new position using C-,.

Of course the keybinding is a matter of taste...

;; suggested key-bindings:
;;(global-set-key '(control \.) 'ska-point-to-register)
;;(global-set-key '(control \,) 'ska-jump-to-register)
(defun ska-point-to-register()
  "Store cursorposition _fast_ in a register. 
Use ska-jump-to-register to jump back to the stored 
position."
  (interactive)
  (setq zmacs-region-stays t)
  (point-to-register 8))

(defun ska-jump-to-register()
  "Switches between current cursorposition and position
that was stored with ska-point-to-register."
  (interactive)
  (setq zmacs-region-stays t)
  (let ((tmp (point-marker)))
        (jump-to-register 8)
        (set-register 8 tmp)))


Hope this helps...
Stefan Kamphausen


reply via email to

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