1
;;; xgit-rebase-todo.el --- Major mode for editting git-rebase-todo files.
3
;; Copyright (C) 2009 Matthieu Moy
5
;; Author: Matthieu Moy <Matthieu.Moy@imag.fr>
8
;; This program is free software; you can redistribute it and/or modify
9
;; it under the terms of the GNU General Public License as published by
10
;; the Free Software Foundation, either version 3 of the License, or
11
;; (at your option) any later version.
13
;; This program is distributed in the hope that it will be useful,
14
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
;; GNU General Public License for more details.
18
;; You should have received a copy of the GNU General Public License
19
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
28
(add-to-list 'auto-mode-alist '("/git-rebase-todo$" . xgit-rebase-todo-mode))
30
(defvar xgit-rebase-todo-mode-map
31
(let ((map (make-sparse-keymap)))
32
(define-key map [(meta ?n)] 'xgit-rebase-todo-move-down)
33
(define-key map [(meta ?p)] 'xgit-rebase-todo-move-up)
35
"Keymap used in `xgit-rebase-todo-mode' buffers.")
37
(defun xgit-rebase-todo-move-down ()
40
(let* ((next (+ 1 (line-end-position)))
41
(line (buffer-substring (point) next)))
42
(delete-region (point) next)
47
(defun xgit-rebase-todo-move-up ()
50
(let* ((next (+ 1 (line-end-position)))
51
(line (buffer-substring (point) next)))
52
(delete-region (point) next)
57
;; (easy-menu-define xgit-rebase-todo-mode-menu xgit-rebase-todo-mode-map
58
;; "`xgit-rebase-todo-mode' menu"
60
;; ["Action" xgit-rebase-todo-function t]
63
(defvar xgit-rebase-todo-font-lock-keywords
64
'(("^\\([a-z]+\\) \\([0-9a-f]+\\) \\(.*\\)$"
66
(2 'dvc-revision-name))
67
("^#.*$" . 'dvc-comment))
68
"Keywords in xgit-rebase-todo mode.")
71
(define-derived-mode xgit-rebase-todo-mode fundamental-mode "xgit-rebase-todo"
72
"Major Mode to edit xgit rebase-todo files.
74
These files are the ones on which git launches the editor for
75
'git rebase --interactive' commands.
78
\\{xgit-rebase-todo-mode-map}
80
(use-local-map xgit-rebase-todo-mode-map)
81
;;(easy-menu-add xgit-rebase-todo-mode-menu)
82
(dvc-install-buffer-menu)
83
(set (make-local-variable 'font-lock-defaults)
84
'(xgit-rebase-todo-font-lock-keywords t))
85
(set (make-local-variable 'comment-start) "#")
86
(set (make-local-variable 'comment-end) "")
87
(run-hooks 'xgit-rebase-todo-mode-hook))
90
(provide 'xgit-rebase-todo)
91
;;; xgit-rebase-todo.el ends here