help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: how to set the initial point position when visit a file


From: Mathias Dahl
Subject: Re: how to set the initial point position when visit a file
Date: Mon, 15 Oct 2007 17:36:09 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (windows-nt)

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


reply via email to

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