Make mode derived from prog-mode

This commit is contained in:
xeals 2019-07-06 21:34:50 +10:00
parent 9ae9eacfdb
commit 424e721d64

View File

@ -318,29 +318,25 @@ Each list item should be a regexp matching a single identifier."
(add-to-list 'auto-mode-alist '("\\.cuh\\'" . cuda-mode)) (add-to-list 'auto-mode-alist '("\\.cuh\\'" . cuda-mode))
;;;###autoload ;;;###autoload
(defun cuda-mode () (define-derived-mode cuda-mode prog-mode "CUDA" ()
"Major mode for editing CUDA. "Major mode for editing CUDA.
Cuda is a C like language extension for mixed native/GPU coding Cuda is a C like language extension for mixed native/GPU coding
created by NVIDIA 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'. initialization, then `cuda-mode-hook'.
Key bindings: Key bindings:
\\{cuda-mode-map}" \\{cuda-mode-map}"
(interactive)
(kill-all-local-variables)
(c-initialize-cc-mode t) (c-initialize-cc-mode t)
(set-syntax-table cuda-mode-syntax-table) (set-syntax-table cuda-mode-syntax-table)
(setq major-mode 'cuda-mode (setq local-abbrev-table cuda-mode-abbrev-table
mode-name "Cuda"
local-abbrev-table cuda-mode-abbrev-table
abbrev-mode t) abbrev-mode t)
(use-local-map c-mode-map) (use-local-map c-mode-map)
;; `c-init-language-vars' is a macro that is expanded at compile ;; `c-init-language-vars' is a macro that is expanded at compile
;; time to a large `setq' with all the language variables and their ;; time to a large `setq' with all the language variables and their
;; customized values for our language. ;; 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 ;; `c-common-init' initializes most of the components of a CC Mode
;; buffer, including setup of the mode menu, font-lock, etc. ;; buffer, including setup of the mode menu, font-lock, etc.
;; There's also a lower level routine `c-basic-common-init' that ;; There's also a lower level routine `c-basic-common-init' that