unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Mathias Dahl <brakjoller@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: how to set the initial point position when visit a file
Date: Mon, 15 Oct 2007 17:36:09 +0200	[thread overview]
Message-ID: <uhcksqtjq.fsf@gmail.com> (raw)
In-Reply-To: 1192375674.871514.83460@i13g2000prf.googlegroups.com

moonrie <moonrie@gmail.com> writes:

> intuitively, i do it this way:
>
> (search-forward "<TAG>")
> (backward-delete-char (length "<TAG>"))
>
> :P, dunno a better way?

You could make that into a command and bind it to a key and you could
even add it to a hook to be run when a file opens.

To make it into a command:

(defun jump-startpos ()
  (interactive)
  (let ((tag "<StartPosition>"))
    (search-forward tag)
    (backward-delete-char (length tag))))

(BTW, I did not bother to test the code above, or your original code.)

Bind the command to a key:

(global-set-key (kbd "[f5]") 'jump-startpos)

Place that into your .emacs and restart.

/Mathias

      parent reply	other threads:[~2007-10-15 15:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-14 13:53 how to set the initial point position when visit a file moonrie
2007-10-14 14:33 ` moonrie
2007-10-14 15:27   ` moonrie
2007-10-15 14:58     ` Sebastian Tennant
2007-10-15 15:36     ` Mathias Dahl [this message]

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=uhcksqtjq.fsf@gmail.com \
    --to=brakjoller@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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).