Use define-derived-mode from prog-mode and update auto-mode-alist
This commit is contained in:
parent
7bfbd1929d
commit
8472f03dbf
1 changed files with 8 additions and 13 deletions
|
@ -671,15 +671,12 @@ Returns the column to indent to."
|
||||||
:group 'sclang-mode
|
:group 'sclang-mode
|
||||||
:type 'hook)
|
:type 'hook)
|
||||||
|
|
||||||
(defun sclang-mode ()
|
;;;###autoload
|
||||||
|
(define-derived-mode sclang-mode prog-mode "SCLang"
|
||||||
"Major mode for editing SuperCollider language code.
|
"Major mode for editing SuperCollider language code.
|
||||||
\\{sclang-mode-map}"
|
\\{sclang-mode-map}"
|
||||||
(interactive)
|
:group 'sclang
|
||||||
(kill-all-local-variables)
|
:syntax-table sclang-mode-syntax-table
|
||||||
(set-syntax-table sclang-mode-syntax-table)
|
|
||||||
(use-local-map sclang-mode-map)
|
|
||||||
(setq mode-name "SCLang")
|
|
||||||
(setq major-mode 'sclang-mode)
|
|
||||||
(sclang-mode-set-local-variables)
|
(sclang-mode-set-local-variables)
|
||||||
(sclang-set-font-lock-keywords)
|
(sclang-set-font-lock-keywords)
|
||||||
(sclang-init-document)
|
(sclang-init-document)
|
||||||
|
@ -689,15 +686,14 @@ Returns the column to indent to."
|
||||||
(add-hook 'completion-at-point-functions
|
(add-hook 'completion-at-point-functions
|
||||||
#'sclang-completion-at-point nil 'local)
|
#'sclang-completion-at-point nil 'local)
|
||||||
(when (fboundp 'company-mode)
|
(when (fboundp 'company-mode)
|
||||||
(add-to-list 'company-backends 'company-capf))
|
(add-to-list 'company-backends 'company-capf)))
|
||||||
|
|
||||||
(run-hooks 'sclang-mode-hook))
|
|
||||||
|
|
||||||
;; =====================================================================
|
;; =====================================================================
|
||||||
;; module initialization
|
;; module initialization
|
||||||
;; =====================================================================
|
;; =====================================================================
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.\\(sc\\|scd\\)$" . sclang-mode))
|
;;;###autoload
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.scd?\\'" . sclang-mode))
|
||||||
(add-to-list 'interpreter-mode-alist '("sclang" . sclang-mode))
|
(add-to-list 'interpreter-mode-alist '("sclang" . sclang-mode))
|
||||||
|
|
||||||
(add-hook 'sclang-library-startup-hook 'sclang-document-library-startup-hook-function)
|
(add-hook 'sclang-library-startup-hook 'sclang-document-library-startup-hook-function)
|
||||||
|
@ -706,5 +702,4 @@ Returns the column to indent to."
|
||||||
(add-hook 'change-major-mode-hook 'sclang-document-change-major-mode-hook-function)
|
(add-hook 'change-major-mode-hook 'sclang-document-change-major-mode-hook-function)
|
||||||
|
|
||||||
(provide 'sclang-mode)
|
(provide 'sclang-mode)
|
||||||
|
;;; sclang-mode ends here
|
||||||
;; EOF
|
|
||||||
|
|
Loading…
Reference in a new issue