Stop using generic-mode. Highlight comments manually.

This commit is contained in:
Phil Jackson 2010-05-31 21:45:53 +01:00
parent 56fb23cf0b
commit 18a3cd7657

View file

@ -40,11 +40,12 @@
line-end) line-end)
"Regexp that matches an action line in a rebase buffer.") "Regexp that matches an action line in a rebase buffer.")
(defvar rebase-font-lock-keywords (defvar rebase-mode-font-lock-keywords
(list (list
(list rebase-mode-action-line-re (list rebase-mode-action-line-re
'(1 font-lock-keyword-face) '(1 font-lock-keyword-face)
'(2 font-lock-builtin-face))) '(2 font-lock-builtin-face))
(list (rx line-start (char "#") (* not-newline)) 0 font-lock-comment-face))
"Font lock keywords for rebase-mode.") "Font lock keywords for rebase-mode.")
(defvar key-to-action-map (defvar key-to-action-map
@ -104,11 +105,6 @@ that of CHANGE-TO."
(goto-char (point-at-bol)) (goto-char (point-at-bol))
(looking-at rebase-mode-action-line-re))) (looking-at rebase-mode-action-line-re)))
(defun rebase-mode-setup ()
"Function run when initialising rebase-mode."
(setq buffer-read-only t)
(use-local-map rebase-mode-map))
(defun rebase-mode-move-line-up () (defun rebase-mode-move-line-up ()
"Move the current action line up." "Move the current action line up."
(interactive) (interactive)
@ -159,13 +155,16 @@ server connection)."
(text (apply 'buffer-substring region))) (text (apply 'buffer-substring region)))
(apply 'kill-region region)))) (apply 'kill-region region))))
(define-generic-mode 'rebase-mode (defun rebase-mode ()
'("#") (interactive)
nil (kill-all-local-variables)
rebase-font-lock-keywords
'("git-rebase-todo") (make-local-variable 'font-lock-defaults)
'(rebase-mode-setup) (setq font-lock-defaults
"Major mode for interactively editing git rebase files. '(rebase-mode-font-lock-keywords t t nil nil))
\\{rebase-mode-map}")
(use-local-map rebase-mode-map)
(setq buffer-read-only t)
(setq mode-name "rebase-mode" major-mode 'rebase-mode))
(provide 'rebase-mode) (provide 'rebase-mode)