From 424e721d64215b317527c7cc08210163c8bcae6c Mon Sep 17 00:00:00 2001 From: xeals Date: Sat, 6 Jul 2019 21:34:50 +1000 Subject: [PATCH] Make mode derived from prog-mode --- cuda-mode.el | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/cuda-mode.el b/cuda-mode.el index ccd6acc..af35b59 100644 --- a/cuda-mode.el +++ b/cuda-mode.el @@ -318,29 +318,25 @@ Each list item should be a regexp matching a single identifier." (add-to-list 'auto-mode-alist '("\\.cuh\\'" . cuda-mode)) ;;;###autoload -(defun cuda-mode () +(define-derived-mode cuda-mode prog-mode "CUDA" () "Major mode for editing CUDA. Cuda is a C like language extension for mixed native/GPU coding created by NVIDIA -The hook `c-mode-common-hook' is run with no args at mode +The hook `c++-mode-common-hook' is run with no args at mode initialization, then `cuda-mode-hook'. Key bindings: \\{cuda-mode-map}" - (interactive) - (kill-all-local-variables) (c-initialize-cc-mode t) (set-syntax-table cuda-mode-syntax-table) - (setq major-mode 'cuda-mode - mode-name "Cuda" - local-abbrev-table cuda-mode-abbrev-table + (setq local-abbrev-table cuda-mode-abbrev-table abbrev-mode t) (use-local-map c-mode-map) ;; `c-init-language-vars' is a macro that is expanded at compile ;; time to a large `setq' with all the language variables and their ;; customized values for our language. - (c-init-language-vars cuda-mode) + (c-init-language-vars-for 'cuda-mode) ;; `c-common-init' initializes most of the components of a CC Mode ;; buffer, including setup of the mode menu, font-lock, etc. ;; There's also a lower level routine `c-basic-common-init' that