unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Thomas" <totohero@empal.com>
Subject: Re: vim's jumplist equivalent in emacs?
Date: 12 Dec 2006 16:50:15 -0800	[thread overview]
Message-ID: <1165971015.421504.100190@73g2000cwn.googlegroups.com> (raw)
In-Reply-To: <1165949023.276738.314350@n67g2000cwd.googlegroups.com>

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
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.

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...
> http://www.emacswiki.org/cgi-bin/wiki/doremi-cmd.el
>

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	other threads:[~2006-12-13  0:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-07  8:46 vim's jumplist equivalent in emacs? Thomas
2006-12-07 10:57 ` Mathias Dahl
2006-12-07 13:02 ` Robert Thorpe
2006-12-07 17:17   ` Holger Sparr
2006-12-12  5:43     ` totohero
2006-12-12  7:58       ` Holger Sparr
2006-12-12  5:54     ` Thomas
2006-12-12  7:41       ` Thomas
2006-12-12 18:43       ` Robert Thorpe
2006-12-13  0:50         ` Thomas [this message]
2006-12-13  1:15         ` Thomas
2006-12-17  2:17           ` Drew Adams
2006-12-13  8:29         ` Holger Sparr
2006-12-07 17:07 ` Holger Sparr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1165971015.421504.100190@73g2000cwn.googlegroups.com \
    --to=totohero@empal.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).