all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Robert Thorpe" <rthorpe@realworldtech.com>
Subject: Re: vim's jumplist equivalent in emacs?
Date: 12 Dec 2006 10:43:43 -0800	[thread overview]
Message-ID: <1165949023.276738.314350@n67g2000cwd.googlegroups.com> (raw)
In-Reply-To: <1165902863.411164.54180@l12g2000cwl.googlegroups.com>

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.

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

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

  parent reply	other threads:[~2006-12-12 18:43 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 [this message]
2006-12-13  0:50         ` Thomas
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

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

  git send-email \
    --in-reply-to=1165949023.276738.314350@n67g2000cwd.googlegroups.com \
    --to=rthorpe@realworldtech.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.
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.