all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Stack of bookmarks
@ 2009-06-17  8:25 stephan.zimmer
  2009-06-17  9:32 ` Anselm Helbig
  2009-06-17 11:08 ` Stefan Kamphausen
  0 siblings, 2 replies; 6+ messages in thread
From: stephan.zimmer @ 2009-06-17  8:25 UTC (permalink / raw)
  To: help-gnu-emacs

Quite often while I'm browsing through source code I would like to
remember the current position to return to it later after having
looked for something else. I know that this can be achieved with
bookmarks. What I would like to have is a generalization of this:
instead of only returning once, I would like to do this recursively,
i.e., to maintain a stack of bookmarks. So somehow like

L1: push-current-location-to-bookmarks
L2: push-current-location-to-bookmarks
L3: push-current-location-to-bookmarks
pop-current-location-from-bookmarks ;; arrive again at L3
pop-current-location-from-bookmarks ;; arrive again at L2
pop-current-location-from-bookmarks ;; arrive again at L1

At the end this would be somehow similar to the "pop-tag-mark"
command, with the difference, that I can remember and go back to
arbitrary locations in the code. Has someone an idea?

Stephan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Stack of bookmarks
  2009-06-17  8:25 Stack of bookmarks stephan.zimmer
@ 2009-06-17  9:32 ` Anselm Helbig
  2009-06-17 11:08 ` Stefan Kamphausen
  1 sibling, 0 replies; 6+ messages in thread
From: Anselm Helbig @ 2009-06-17  9:32 UTC (permalink / raw)
  To: help-gnu-emacs

Hi!

> Quite often while I'm browsing through source code I would like to
> remember the current position to return to it later after having
> looked for something else. I know that this can be achieved with
> bookmarks. What I would like to have is a generalization of this:
> instead of only returning once, I would like to do this recursively,
> i.e., to maintain a stack of bookmarks. So somehow like
> 
> L1: push-current-location-to-bookmarks
> L2: push-current-location-to-bookmarks
> L3: push-current-location-to-bookmarks
> pop-current-location-from-bookmarks ;; arrive again at L3
> pop-current-location-from-bookmarks ;; arrive again at L2
> pop-current-location-from-bookmarks ;; arrive again at L1
> 
> At the end this would be somehow similar to the "pop-tag-mark"
> command, with the difference, that I can remember and go back to
> arbitrary locations in the code. Has someone an idea?

I use pop-global-mark for this purpose, bound to C-x C-SPACE here. You
can also call it by giving a prefix argument to set-mark-command: C-u
C-SPACE. 

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Stack of bookmarks
  2009-06-17  8:25 Stack of bookmarks stephan.zimmer
  2009-06-17  9:32 ` Anselm Helbig
@ 2009-06-17 11:08 ` Stefan Kamphausen
  2009-06-18 11:27   ` stephan.zimmer
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Kamphausen @ 2009-06-17 11:08 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Stephan,

"stephan.zimmer" <stephan.zimmer@googlemail.com> writes:

> Quite often while I'm browsing through source code I would like to
> remember the current position to return to it later after having
> looked for something else.
[...]
> At the end this would be somehow similar to the "pop-tag-mark"
> command, with the difference, that I can remember and go back to
> arbitrary locations in the code. Has someone an idea?

I once needed exactly that and wrote some stack-handling of markers (not
bookmarks) only to find that I didn't want a stack but a ring.  The
result was mtorus:
http://www.skamphausen.de/cgi-bin/ska/mtorus

(it was later re-written by Sebastian Freundt resulting in a much more
complex and probably more powerful implementation, but I don't really
know about the state of that version, I still use my old version.  See 
http://www.emacswiki.org/cgi-bin/wiki?MTorus
)


Cheers,
Stefan
-- 
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Stack of bookmarks
  2009-06-17 11:08 ` Stefan Kamphausen
@ 2009-06-18 11:27   ` stephan.zimmer
  2009-06-18 13:14     ` Stefan Kamphausen
  2009-06-18 14:15     ` Drew Adams
  0 siblings, 2 replies; 6+ messages in thread
From: stephan.zimmer @ 2009-06-18 11:27 UTC (permalink / raw)
  To: help-gnu-emacs

Many thanks for your answers. I installed the mtorus, and it exactly
suits my needs. Definitively very nice!

One question I still have in mind, though: what is the difference
between bookmarks and markers? Both encapsulate a buffer and a buffer
position, right?

Stephan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Stack of bookmarks
  2009-06-18 11:27   ` stephan.zimmer
@ 2009-06-18 13:14     ` Stefan Kamphausen
  2009-06-18 14:15     ` Drew Adams
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Kamphausen @ 2009-06-18 13:14 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

"stephan.zimmer" <stephan.zimmer@googlemail.com> writes:

> Many thanks for your answers. I installed the mtorus, and it exactly
> suits my needs. Definitively very nice!

:-)

>
> One question I still have in mind, though: what is the difference
> between bookmarks and markers? Both encapsulate a buffer and a buffer
> position, right?

I never use bookmarks, but from what I read they have names and are
persisted automatically.  A feature I wanted to implement in mtorus
years ago and got to.  Markers are actually not stored positions, they
shift along when text inserted somewhere earlier in the buffer.  Don't
know what bookmarks will do if you change the buffer.

Cheers,
Stefan
-- 
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Stack of bookmarks
  2009-06-18 11:27   ` stephan.zimmer
  2009-06-18 13:14     ` Stefan Kamphausen
@ 2009-06-18 14:15     ` Drew Adams
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2009-06-18 14:15 UTC (permalink / raw)
  To: 'stephan.zimmer', help-gnu-emacs

> One question I still have in mind, though: what is the difference
> between bookmarks and markers? Both encapsulate a buffer and a buffer
> position, right?

Bookmarks are persistent and they have names; not so, markers. Bookmarked
positions can also be relocated (found) if they move slightly because of text
changes.

(Yes, beyond emacs -Q one can find other kinds of bookmarks and markers that
blend these differences. This is the difference for vanilla GNU Emacs.)





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-18 14:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-17  8:25 Stack of bookmarks stephan.zimmer
2009-06-17  9:32 ` Anselm Helbig
2009-06-17 11:08 ` Stefan Kamphausen
2009-06-18 11:27   ` stephan.zimmer
2009-06-18 13:14     ` Stefan Kamphausen
2009-06-18 14:15     ` Drew Adams

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.