tags:

views:

48

answers:

1

How do you move the point in Elisp to the beginning of <enter description here> and kill that text. I'd like to place this in my ~/.emacs-p4, which is used via P4EDITOR,

$ echo $P4EDITOR
emacs -nw --no-init-file --no-splash --load ~/.emacs-p4

The template use for p4 submit is:

# A Perforce Change Specification.
#
#  Change:      The change number. 'new' on a new changelist.
#  Date:        The date this specification was last modified.
#  Client:      The client on which the changelist was created.  Read-only.
#  User:        The user who created the changelist.
#  Status:      Either 'pending' or 'submitted'. Read-only.
#  Description: Comments about the changelist.  Required.
#  Jobs:        What opened jobs are to be closed by this changelist.
#               You may delete jobs from this list.  (New changelists only.)
#  Files:       What opened files from the default changelist are to be added
#               to this changelist.  You may delete files from this list.
#               (New changelists only.)

Change: new

Client: aflott

User:   aflott

Status: new

Description:
        <enter description here>
A: 

I think (without testing) that all you need to do is:

(search-forward "<enter description here>")
(delete-region (line-beginning-position) (line-end-position))
Michael Mrozek
(replace-match "") might be better than (delete-region ...), because then you'd still have the leading tab if you wanted it.
Sean
I went with:(when (search-forward "<enter description here>") (replace-match ""))Thanks all!
Adam Flott