Use newer p4_16-mode from jafingerhut/p4-guide

This commit is contained in:
Wojciech Kozlowski 2019-12-15 21:41:39 +01:00
parent 90438d3073
commit 8ed49aca41

View File

@ -19,10 +19,21 @@
;; Placeholder for user customization code
(defvar p4_16-mode-hook nil)
(defun p4_16-electric-brace (arg)
"Insert a brace."
(interactive "*P")
(self-insert-command (prefix-numeric-value arg))
(save-excursion
(move-beginning-of-line nil)
(indent-for-tab-command)))
;; Define the keymap (for now it is pretty much default)
(defvar p4_16-mode-map
(let ((map (make-keymap)))
(define-key map "\C-j" 'newline-and-indent)
(define-key map "\C-j" 'newline-and-indent)
(define-key map "{" 'p4_16-electric-brace)
(define-key map "}" 'p4_16-electric-brace)
(define-key map "\C-c\C-c" 'comment-region)
map)
"Keymap for P4_16 major mode")
@ -40,7 +51,7 @@
"package" "parser"
"return"
"select" "state" "struct" "switch"
"table" "transition" "tuple" "typedef"
"table" "transition" "tuple" "typedef" "type"
"verify"
))
@ -57,7 +68,7 @@
(setq p4_16-variables
'("packet_in" "packet_out"
))
))
(setq p4_16-operations
'("&&&" ".." "++" "?" ":"))
@ -213,10 +224,15 @@
(setq major-mode 'p4_16-mode)
(setq mode-name "P4_16")
(setq imenu-generic-expression p4_16-imenu-generic-expression)
;; Setting this to nil causes indentation to use only space
;; characters, never tabs.
(setq indent-tabs-mode nil)
(setq comment-start "// ")
(setq comment-end "")
(imenu-add-to-menubar "P4_16")
(cscope-minor-mode)
(run-hooks 'p4_16-mode-hook)
)
)
;; The most important line
(provide 'p4_16-mode)