代码之家  ›  专栏  ›  技术社区  ›  Adam Flott

将Emacs移动到特定文本的开头,以执行提交消息

  •  1
  • Adam Flott  · 技术社区  · 16 年前

    如何将elisp中的点移动到 <enter description here> 然后删掉那段文字。我想把这个放在我的~/.emacs-p4中,它是通过p4editor使用的,

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

    模板用于 p4 submit 是:

    # 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>
    
    1 回复  |  直到 16 年前
        1
  •  0
  •   Michael Mrozek    16 年前

    我认为(没有测试)你所需要做的就是:

    (search-forward "<enter description here>")
    (delete-region (line-beginning-position) (line-end-position))