[Top][All Lists]

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

Re: vim's jumplist equivalent in emacs?

From: Thomas
Subject: Re: vim's jumplist equivalent in emacs?
Date: 12 Dec 2006 16:50:15 -0800
User-agent: G2/1.0

Hello, Robert.

Robert Thorpe 작성:

> Thomas wrote:
> > Thank you all for the answers about using marks.
> > But I thought they lack jumping forward
> How do you "jump forward".  You can't really jump to something you have
> not yet visited.

I mean I can jump forward N times after I have jump backward N times

> > and I decided to start my first
> >
> > emacs lisp code as follows. (I mapped C-p, C-o, C-l to the functions) I
> I find I use some of those, such as C-l quite a lot, you might not
> of-course.
> Maybe try mapping to places in the Emacs keymap that Emacs does not
> map.  For example both C-digit and M-digit produce a prefix argument
> corresponding to whatever the digit happens to be.  So C-8 C-p means
> move 8 lines previous.  You don't need both, so why not use one of them
> for your own personal keys.  Or use the function keys.
> > think this code is really ugly and any comments are welcome. And can
> > anyone please advice me how to make 'push-place-uniq' automatically
> > called every time when I execute some kind of jump actions like
> > searching texts, opening a file or searching tags etc?
> Jump actions are not treated uniformally in Emacs, except in that they
> set mark as we discussed earlier.  What you could do is look in the
> mark ring.

As far as I have understood, a mark ring records each marks in a buffer
and a global mark ring records a mark in each buffer but I intended a
global list that records each mark of each buffer.

> > (defvar backward-jump-list nil)
> > (defvar forward-jump-list nil)
> >
> >
> > (setq backward-jump-list nil)
> > (setq forward-jump-list nil)
> >
> >
> > (defmacro push-place-uniq (place jump-list)
> >   ;; if the place is already at the head of jump-list, ignore it
> >   ;; otherwise add it at the head of jump-list
> >   (list 'if
> >         (list 'equal place (list 'car jump-list))
> >         t
> >         (list 'push place jump-list)))
> You could do that a little more tidily with quasiquotation.  See C-h f
> backquote
> <remaining code snipped>
> Nothing in your code screams at me as though it's wrong, but it seems
> to replicate the job of the mark rings.

I think my code could be more compact if I remove unnecessary copies of
similar functions and abandon the habit of C-like programming. I have
to study more :-)

> I think I see your problem though.  It seems the behaviour of C-u C-SPC
> is quite strange.
> Maybe what you may want is something like the cycle function in this
> mode...

doremi-cmd is close to what I wanted though it is not the 'global list'
that I mentioned above. Thank you.

> There may be something better though, I'll think about it.

reply via email to

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