* how to just back to previous location quickly?
@ 2003-04-24 8:52 wang yin
2003-04-24 12:50 ` Stefan Kamphausen
0 siblings, 1 reply; 5+ messages in thread
From: wang yin @ 2003-04-24 8:52 UTC (permalink / raw)
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.
Thanks.
--
Wang Yin
DA Lab, Tsinghua University,
100084
Beijing China
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to just back to previous location quickly?
2003-04-24 8:52 how to just back to previous location quickly? wang yin
@ 2003-04-24 12:50 ` Stefan Kamphausen
2003-04-24 14:27 ` wang yin
2003-04-25 8:27 ` Barman Brakjoller
0 siblings, 2 replies; 5+ messages in thread
From: Stefan Kamphausen @ 2003-04-24 12:50 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to just back to previous location quickly?
2003-04-24 12:50 ` Stefan Kamphausen
@ 2003-04-24 14:27 ` wang yin
2003-04-26 15:31 ` Oliver Scholz
2003-04-25 8:27 ` Barman Brakjoller
1 sibling, 1 reply; 5+ messages in thread
From: wang yin @ 2003-04-24 14:27 UTC (permalink / raw)
That's good!
But I'm that kinda careless people. I usually don't know if I should
return to some position. But if it's really needed, I can't find it.
Is there a way to push the jumping points to some stack that I can go
back and forth?
--
Wang Yin
DA Lab, Tsinghua University,
100084
Beijing China
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to just back to previous location quickly?
2003-04-24 14:27 ` wang yin
@ 2003-04-26 15:31 ` Oliver Scholz
0 siblings, 0 replies; 5+ messages in thread
From: Oliver Scholz @ 2003-04-26 15:31 UTC (permalink / raw)
wang yin <wy@wangyin.com> writes:
> That's good!
>
> But I'm that kinda careless people. I usually don't know if I should
> return to some position. But if it's really needed, I can't find it.
>
> Is there a way to push the jumping points to some stack that I can go
> back and forth?
[...]
Try `C-u C-SPC' and `C-x C-SPC'.
Oliver
--
7 Floréal an 211 de la Révolution
Liberté, Egalité, Fraternité!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to just back to previous location quickly?
2003-04-24 12:50 ` Stefan Kamphausen
2003-04-24 14:27 ` wang yin
@ 2003-04-25 8:27 ` Barman Brakjoller
1 sibling, 0 replies; 5+ messages in thread
From: Barman Brakjoller @ 2003-04-25 8:27 UTC (permalink / raw)
> 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...
And here is mine, which is very similar. The big difference is that
once you jumped back to the saved position, you can jump between the
two by using jump-last-posiiton:
(defun save-current-position ()
"Saves current cursor position in register 0"
(interactive)
(point-to-register 0)
(delete (assoc 1 register-alist) register-alist)
(message "Position saved."))
(defun jump-last-position ()
"Jump to position saved with previous `save-current-position´,
OR if run two times with no `save-current-position´ in between,
jump to the last position it was run from."
(interactive)
(if (get-register 0)
(progn
(point-to-register 1)
(jump-to-register 0)
(delete (assoc 0 register-alist) register-alist)
(message "Jumped to last saved or last jump-position"))
(if (get-register 1)
(progn
(point-to-register 0)
(jump-to-register 1)
(delete (assoc 1 register-alist) register-alist)
(message "Jumped to last saved or last jump-position"))
(message "No pos saved"))))
Of course it is quite ugly to just hijack register 0, but it is a
register that a user at least cannot type using the keyboard (or maybe
by using C-q first, I don't know and I don't care... :)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-04-26 15:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-24 8:52 how to just back to previous location quickly? wang yin
2003-04-24 12:50 ` Stefan Kamphausen
2003-04-24 14:27 ` wang yin
2003-04-26 15:31 ` Oliver Scholz
2003-04-25 8:27 ` Barman Brakjoller
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.