[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 17:15:55 -0800 |
User-agent: |
G2/1.0 |
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 may jump forward N times if I had jump backward N times
before.
>
> > 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.
Yes, the combination of mark ring and global mark ring may fulfill my
needs though what I want exactly is kind of one global list that
records all marks of all buffers.
>
> > (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 can remove unnecessary
copies of similar functions and abandon the habit of C-like
programming. I should 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...
> http://www.emacswiki.org/cgi-bin/wiki/doremi-cmd.el
>
> There may be something better though, I'll think about it.
doremi is helpful to me. Thank you.
- vim's jumplist equivalent in emacs?, Thomas, 2006/12/07
- Re: vim's jumplist equivalent in emacs?, Mathias Dahl, 2006/12/07
- Re: vim's jumplist equivalent in emacs?, Robert Thorpe, 2006/12/07
- Re: vim's jumplist equivalent in emacs?, Holger Sparr, 2006/12/07
- Re: vim's jumplist equivalent in emacs?, Thomas, 2006/12/12
- Re: vim's jumplist equivalent in emacs?, Thomas, 2006/12/12
- Re: vim's jumplist equivalent in emacs?, Robert Thorpe, 2006/12/12
- Re: vim's jumplist equivalent in emacs?, Thomas, 2006/12/12
- Re: vim's jumplist equivalent in emacs?,
Thomas <=
- RE: vim's jumplist equivalent in emacs?, Drew Adams, 2006/12/16
- Re: vim's jumplist equivalent in emacs?, Holger Sparr, 2006/12/13
Re: vim's jumplist equivalent in emacs?, Holger Sparr, 2006/12/07